From 9703162f57a91a570b61f51522db7446fd7175b6 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 5 Dec 2018 22:19:46 +0300 Subject: plugins: note,shared - move to iconfont --- plugins/share/init.php | 13 ++++++++----- plugins/share/notshared.png | Bin 657 -> 0 bytes plugins/share/share.css | 3 +++ plugins/share/share.js | 8 ++++---- 4 files changed, 15 insertions(+), 9 deletions(-) delete mode 100644 plugins/share/notshared.png create mode 100644 plugins/share/share.css (limited to 'plugins/share') diff --git a/plugins/share/init.php b/plugins/share/init.php index 752e8ac1e..d71986e83 100644 --- a/plugins/share/init.php +++ b/plugins/share/init.php @@ -20,6 +20,10 @@ class Share extends Plugin { return file_get_contents(dirname(__FILE__) . "/share.js"); } + function get_css() { + return file_get_contents(dirname(__FILE__) . "/share.css"); + } + function get_prefs_js() { return file_get_contents(dirname(__FILE__) . "/share_prefs.js"); } @@ -72,12 +76,11 @@ class Share extends Plugin { } function hook_article_button($line) { - $img = $line['uuid'] ? "share.png" : "notshared.png"; + $img_class = $line['uuid'] ? "shared" : ""; - return ""; + return "share"; } function shareArticle() { diff --git a/plugins/share/notshared.png b/plugins/share/notshared.png deleted file mode 100644 index 523575306..000000000 Binary files a/plugins/share/notshared.png and /dev/null differ diff --git a/plugins/share/share.css b/plugins/share/share.css new file mode 100644 index 000000000..00bad68dd --- /dev/null +++ b/plugins/share/share.css @@ -0,0 +1,3 @@ +i.icon-share.shared { + color : #0a0; +} \ No newline at end of file diff --git a/plugins/share/share.js b/plugins/share/share.js index 7366c2aff..c30dd03e0 100644 --- a/plugins/share/share.js +++ b/plugins/share/share.js @@ -32,7 +32,7 @@ Plugins.Share = { new Effect.Highlight(e); const img = $("SHARE-IMG-" + id); - if (img) img.src = img.src.replace("notshared.png", "share.png"); + img.addClassName("shared"); Notify.close(); @@ -54,8 +54,8 @@ Plugins.Share = { xhrPost("backend.php", query, () => { notify("Article unshared."); - var img = $("SHARE-IMG-" + id); - if (img) img.src = img.src.replace("share.png", "notshared.png"); + const img = $("SHARE-IMG-" + id); + img.removeClassName("shared"); dialog.hide(); }); @@ -68,7 +68,7 @@ Plugins.Share = { dialog.show(); const img = $("SHARE-IMG-" + id); - if (img) img.src = img.src.replace("notshared.png", "share.png"); + img.addClassName("shared"); } }; -- cgit v1.2.3-54-g00ecf