diff options
Diffstat (limited to 'plugins/share')
-rw-r--r-- | plugins/share/init.php | 13 | ||||
-rw-r--r-- | plugins/share/notshared.png | bin | 657 -> 0 bytes | |||
-rw-r--r-- | plugins/share/share.css | 3 | ||||
-rw-r--r-- | plugins/share/share.js | 8 |
4 files changed, 15 insertions, 9 deletions
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 "<img id='SHARE-IMG-".$line['int_id']."' src=\"plugins/share/$img\" - class='tagsPic' style=\"cursor : pointer\" - onclick=\"Plugins.Share.shareArticle(".$line['int_id'].")\" - title='".__('Share by URL')."'>"; + return "<i id='SHARE-IMG-".$line['int_id']."' class='material-icons icon-share $img_class' + style='cursor : pointer' onclick=\"Plugins.Share.shareArticle(".$line['int_id'].")\" + title='".__('Share by URL')."'>share</i>"; } function shareArticle() { diff --git a/plugins/share/notshared.png b/plugins/share/notshared.png Binary files differdeleted file mode 100644 index 523575306..000000000 --- a/plugins/share/notshared.png +++ /dev/null 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"); } }; |