summaryrefslogtreecommitdiff
path: root/plugins/share
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/share')
-rw-r--r--plugins/share/init.php15
-rw-r--r--plugins/share/notshared.pngbin657 -> 0 bytes
-rw-r--r--plugins/share/share.css3
-rw-r--r--plugins/share/share.js20
-rw-r--r--plugins/share/share.pngbin343 -> 0 bytes
5 files changed, 24 insertions, 14 deletions
diff --git a/plugins/share/init.php b/plugins/share/init.php
index 752e8ac1e..095cffbdf 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')."'>link</i>";
}
function shareArticle() {
@@ -104,7 +107,7 @@ class Share extends Plugin {
$url_path = get_self_url_prefix();
$url_path .= "/public.php?op=share&key=$uuid";
- print "<div class=\"tagCloudContainer\">";
+ print "<div class='panel text-center'>";
print "<a id='gen_article_url' href='$url_path' target='_blank' rel='noopener noreferrer'>$url_path</a>";
print "</div>";
diff --git a/plugins/share/notshared.png b/plugins/share/notshared.png
deleted file mode 100644
index 523575306..000000000
--- a/plugins/share/notshared.png
+++ /dev/null
Binary files 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..c49f64b4b 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();
@@ -47,17 +47,21 @@ Plugins.Share = {
unshare: function () {
if (confirm(__("Remove sharing for this article?"))) {
- Notify.progress("Trying to unshare...", true);
-
const query = {op: "pluginhandler", plugin: "share", method: "unshare", id: id};
xhrPost("backend.php", query, () => {
- notify("Article unshared.");
+ try {
+ const img = $("SHARE-IMG-" + id);
- var img = $("SHARE-IMG-" + id);
- if (img) img.src = img.src.replace("share.png", "notshared.png");
+ if (img) {
+ img.removeClassName("shared");
+ img.up("div[id*=RROW]").removeClassName("shared");
+ }
- dialog.hide();
+ dialog.hide();
+ } catch (e) {
+ console.error(e);
+ }
});
}
@@ -68,7 +72,7 @@ Plugins.Share = {
dialog.show();
const img = $("SHARE-IMG-" + id);
- if (img) img.src = img.src.replace("notshared.png", "share.png");
+ img.addClassName("shared");
}
};
diff --git a/plugins/share/share.png b/plugins/share/share.png
deleted file mode 100644
index 25eacb7c2..000000000
--- a/plugins/share/share.png
+++ /dev/null
Binary files differ