summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorChristian Weiske <cweiske@cweiske.de>2015-01-21 22:05:12 +0100
committerChristian Weiske <cweiske@cweiske.de>2015-01-21 22:05:12 +0100
commit11e56e586189b52393875155e3c077ab0f83defd (patch)
tree7f8dd98def7dc38f69e74832bd187146b4e15ba6 /data
parentf6902bc09d8ef5b1df8090b6d2b54f0d91d27c10 (diff)
downloadsemanticscuttle-11e56e586189b52393875155e3c077ab0f83defd.tar.gz
semanticscuttle-11e56e586189b52393875155e3c077ab0f83defd.tar.bz2
Integrate Firefox Social API for bookmarking
Diffstat (limited to 'data')
-rw-r--r--data/templates/default/bookmarklet.inc.php35
-rw-r--r--data/templates/default/top.inc.php18
2 files changed, 51 insertions, 2 deletions
diff --git a/data/templates/default/bookmarklet.inc.php b/data/templates/default/bookmarklet.inc.php
index c93f581..b203735 100644
--- a/data/templates/default/bookmarklet.inc.php
+++ b/data/templates/default/bookmarklet.inc.php
@@ -115,3 +115,38 @@ echo jsEscTitle(htmlspecialchars($link));
}
//]]>
</script>
+
+
+<script type="text/javascript">
+function activateSocialApi(node) {
+ var baseurl = <?php echo json_encode(addProtocolToUrl(createURL())); ?>;
+ var socialApiData = {
+ // currently required
+ "name": <?php echo json_encode($GLOBALS['sitename']); ?>,
+ "iconURL": baseurl + "themes/default/images/logo.png",
+ "icon32URL": baseurl + "themes/default/images/logo.png",
+ "icon64URL": baseurl + "themes/default/images/logo.png",
+
+ "markURL": "<?php echo addProtocolToUrl(createURL('bookmarks', $GLOBALS['user'])); ?>?action=add&amp;popup=1&amp;width=800&amp;height=470&amp;address=%{url}&amp;title=%{title}&amp;description=%{description}%{text}",
+ "markedIcon": baseurl + "themes/default/images/logo.png",
+ "unmarkedIcon": baseurl + "themes/default/images/logo-empty.png",
+
+ // should be available for display purposes
+ "description": "Self-hosted bookmark manager",
+ "author": "Christian Weiske",
+ "homepageURL": "http://semanticscuttle.sf.net/",
+
+ // optional
+ "version": "0.0.3"
+ };
+
+ var event = new CustomEvent("ActivateSocialFeature");
+ node.setAttribute("data-service", JSON.stringify(socialApiData));
+ node.dispatchEvent(event);
+}
+</script>
+<p>
+ <button onclick="activateSocialApi(this)" title="activate semanticscuttle in firefox">
+ Add SemanticScuttle to Firefox
+ </button>
+</p>
diff --git a/data/templates/default/top.inc.php b/data/templates/default/top.inc.php
index 240e5b2..55be4a7 100644
--- a/data/templates/default/top.inc.php
+++ b/data/templates/default/top.inc.php
@@ -30,11 +30,25 @@ if (isset($rsschannels)) {
<?php endif ?>
</head>
- <body>
+<?php
+$bodystyle = '';
+if (isset($_GET['popup'])) {
+ if (isset($_GET['height'])) {
+ $bodystyle .= 'height:' . intval($_GET['height']) . 'px;';
+ }
+ if (isset($_GET['width'])) {
+ $bodystyle .= 'width:' . intval($_GET['width']) . 'px;';
+ }
+ if ($bodystyle != '') {
+ $bodystyle = ' style="' . $bodystyle . '"';
+ }
+}
+?>
+ <body<?php echo $bodystyle; ?>>
<?php
$headerstyle = '';
-if(isset($_GET['popup'])) {
+if (isset($_GET['popup'])) {
$headerstyle = ' class="popup"';
}
?>