mirror of
https://github.com/discourse/discourse.git
synced 2025-05-29 01:17:36 +08:00
DEV: apply coding standards to plugins (#10594)
This commit is contained in:
@ -3,9 +3,9 @@ import { withPluginApi } from "discourse/lib/plugin-api";
|
||||
export default {
|
||||
name: "apply-lazyYT",
|
||||
initialize() {
|
||||
withPluginApi("0.1", api => {
|
||||
withPluginApi("0.1", (api) => {
|
||||
api.decorateCooked(
|
||||
$elem => {
|
||||
($elem) => {
|
||||
const iframes = $(".lazyYT", $elem);
|
||||
if (iframes.length === 0) {
|
||||
return;
|
||||
@ -21,11 +21,11 @@ export default {
|
||||
if (postId) {
|
||||
api.preventCloak(postId);
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
},
|
||||
{ id: "discourse-lazyyt" }
|
||||
);
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
@ -11,7 +11,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
(function($) {
|
||||
(function ($) {
|
||||
"use strict";
|
||||
|
||||
function setUp($el, settings) {
|
||||
@ -91,7 +91,7 @@
|
||||
|
||||
$el
|
||||
.css({
|
||||
"padding-bottom": padding_bottom
|
||||
"padding-bottom": padding_bottom,
|
||||
})
|
||||
.html(innerHtml.join(""));
|
||||
|
||||
@ -123,7 +123,7 @@
|
||||
id,
|
||||
"/",
|
||||
thumb_img,
|
||||
'">'
|
||||
'">',
|
||||
].join("")
|
||||
)
|
||||
);
|
||||
@ -132,7 +132,7 @@
|
||||
$thumb = $el
|
||||
.find(".ytp-thumbnail")
|
||||
.addClass("lazyYT-image-loaded")
|
||||
.on("click", function(e) {
|
||||
.on("click", function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
if (
|
||||
@ -156,15 +156,15 @@
|
||||
});
|
||||
}
|
||||
|
||||
$.fn.lazyYT = function(newSettings) {
|
||||
$.fn.lazyYT = function (newSettings) {
|
||||
var defaultSettings = {
|
||||
default_ratio: "16:9",
|
||||
callback: null, // ToDO execute callback if given
|
||||
container_class: "lazyYT-container"
|
||||
container_class: "lazyYT-container",
|
||||
};
|
||||
var settings = $.extend(defaultSettings, newSettings);
|
||||
|
||||
return this.each(function() {
|
||||
return this.each(function () {
|
||||
var $el = $(this).addClass(settings.container_class);
|
||||
setUp($el, settings);
|
||||
});
|
||||
|
Reference in New Issue
Block a user