remove some plugin JS code out of global context
This commit is contained in:
parent
84affc7b1d
commit
78cc470193
|
@ -907,8 +907,8 @@ class Article extends Handler_Protected {
|
|||
|
||||
static function format_article_note($id, $note, $allow_edit = true) {
|
||||
|
||||
$str = "<div class='articleNote' onclick=\"editArticleNote($id)\">
|
||||
<div class='noteEdit' onclick=\"editArticleNote($id)\">".
|
||||
$str = "<div class='articleNote' onclick=\"Plugins.Note.edit($id)\">
|
||||
<div class='noteEdit' onclick=\"Plugins.Note.edit($id)\">".
|
||||
($allow_edit ? __('(edit note)') : "")."</div>$note</div>";
|
||||
|
||||
return $str;
|
||||
|
|
|
@ -7,6 +7,8 @@ let Filters;
|
|||
let Users;
|
||||
let Prefs;
|
||||
|
||||
const Plugins = {};
|
||||
|
||||
require(["dojo/_base/kernel",
|
||||
"dojo/_base/declare",
|
||||
"dojo/ready",
|
||||
|
|
|
@ -10,6 +10,8 @@ let Article;
|
|||
let ArticleCache;
|
||||
let PluginHost;
|
||||
|
||||
const Plugins = {};
|
||||
|
||||
require(["dojo/_base/kernel",
|
||||
"dojo/_base/declare",
|
||||
"dojo/ready",
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
function showTrgmRelated(id) {
|
||||
try {
|
||||
|
||||
Plugins.Psql_Trgm = {
|
||||
showRelated: function (id) {
|
||||
const query = "backend.php?op=pluginhandler&plugin=af_psql_trgm&method=showrelated¶m=" + encodeURIComponent(id);
|
||||
|
||||
if (dijit.byId("trgmRelatedDlg"))
|
||||
|
@ -17,9 +16,6 @@ function showTrgmRelated(id) {
|
|||
});
|
||||
|
||||
dialog.show();
|
||||
|
||||
} catch (e) {
|
||||
exception_error("showTrgmRelated", e);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -115,7 +115,7 @@ class Af_Psql_Trgm extends Plugin {
|
|||
function hook_article_button($line) {
|
||||
return "<img src=\"plugins/af_psql_trgm/button.png\"
|
||||
style=\"cursor : pointer\" style=\"cursor : pointer\"
|
||||
onclick=\"showTrgmRelated(".$line["id"].")\"
|
||||
onclick=\"Plugins.Psql_Trgm.showRelated(".$line["id"].")\"
|
||||
class='tagsPic' title='".__('Show related articles')."'>";
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ class Note extends Plugin {
|
|||
function hook_article_button($line) {
|
||||
return "<img src=\"plugins/note/note.png\"
|
||||
style=\"cursor : pointer\" style=\"cursor : pointer\"
|
||||
onclick=\"editArticleNote(".$line["id"].")\"
|
||||
onclick=\"Plugins.Note.edit(".$line["id"].")\"
|
||||
class='tagsPic' title='".__('Edit article note')."'>";
|
||||
}
|
||||
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
function editArticleNote(id) {
|
||||
try {
|
||||
|
||||
var query = "backend.php?op=pluginhandler&plugin=note&method=edit¶m=" + encodeURIComponent(id);
|
||||
Plugins.Note = {
|
||||
edit: function(id) {
|
||||
const query = "backend.php?op=pluginhandler&plugin=note&method=edit¶m=" + encodeURIComponent(id);
|
||||
|
||||
if (dijit.byId("editNoteDlg"))
|
||||
dijit.byId("editNoteDlg").destroyRecursive();
|
||||
|
||||
dialog = new dijit.Dialog({
|
||||
const dialog = new dijit.Dialog({
|
||||
id: "editNoteDlg",
|
||||
title: __("Edit article note"),
|
||||
style: "width: 600px",
|
||||
|
@ -38,9 +37,5 @@ function editArticleNote(id) {
|
|||
});
|
||||
|
||||
dialog.show();
|
||||
|
||||
} catch (e) {
|
||||
exception_error("editArticleNote", e);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
|
@ -40,7 +40,7 @@ class Share extends Plugin {
|
|||
|
||||
print "<p>" . __("You can disable all articles shared by unique URLs here.") . "</p>";
|
||||
|
||||
print "<button class=\"btn-danger\" dojoType=\"dijit.form.Button\" onclick=\"return clearArticleAccessKeys()\">".
|
||||
print "<button class=\"btn-danger\" dojoType=\"dijit.form.Button\" onclick=\"return Plugins.Share.clearKeys()\">".
|
||||
__('Unshare all articles')."</button> ";
|
||||
|
||||
print "</p>";
|
||||
|
@ -74,7 +74,7 @@ class Share extends Plugin {
|
|||
|
||||
return "<img id='SHARE-IMG-".$line['int_id']."' src=\"plugins/share/$img\"
|
||||
class='tagsPic' style=\"cursor : pointer\"
|
||||
onclick=\"shareArticle(".$line['int_id'].")\"
|
||||
onclick=\"Plugins.Share.shareArticle(".$line['int_id'].")\"
|
||||
title='".__('Share by URL')."'>";
|
||||
}
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
function shareArticle(id) {
|
||||
try {
|
||||
Plugins.Share = {
|
||||
shareArticle: function(id) {
|
||||
if (dijit.byId("shareArticleDlg"))
|
||||
dijit.byId("shareArticleDlg").destroyRecursive();
|
||||
|
||||
var query = "backend.php?op=pluginhandler&plugin=share&method=shareArticle¶m=" + encodeURIComponent(id);
|
||||
const query = "backend.php?op=pluginhandler&plugin=share&method=shareArticle¶m=" + encodeURIComponent(id);
|
||||
|
||||
dialog = new dijit.Dialog({
|
||||
const dialog = new dijit.Dialog({
|
||||
id: "shareArticleDlg",
|
||||
title: __("Share article by URL"),
|
||||
style: "width: 600px",
|
||||
|
@ -62,16 +62,15 @@ function shareArticle(id) {
|
|||
}
|
||||
|
||||
},
|
||||
href: query});
|
||||
href: query
|
||||
});
|
||||
|
||||
dialog.show();
|
||||
|
||||
const img = $("SHARE-IMG-" + id);
|
||||
if (img) img.src = img.src.replace("notshared.png", "share.png");
|
||||
|
||||
} catch (e) {
|
||||
exception_error("shareArticle", e);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
function clearArticleAccessKeys() {
|
||||
Plugins.Share = {
|
||||
clearKeys: function() {
|
||||
if (confirm(__("This will invalidate all previously shared article URLs. Continue?"))) {
|
||||
Notify.progress("Clearing URLs...");
|
||||
|
||||
|
@ -11,6 +12,4 @@ function clearArticleAccessKeys() {
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue