Skip to content

Instantly share code, notes, and snippets.

@ArthurHoaro
Created April 16, 2016 11:40
Show Gist options
  • Save ArthurHoaro/3d3c0e9b39f106f58e725728825e6628 to your computer and use it in GitHub Desktop.
Save ArthurHoaro/3d3c0e9b39f106f58e725728825e6628 to your computer and use it in GitHub Desktop.
Firefox Social API - Text bug
<?php
var_dump($_SERVER['QUERY_STRING']);
?>
<!DOCTYPE html>
<html>
<head></head>
<body>
<a onclick="activateFirefoxSocial(this)">Add</a>
<script>
function activateFirefoxSocial(node) {
var loc = location.href;
var baseURL = loc.substring(0, loc.lastIndexOf("/"));
var data = {
name: "Firefox Social API Bug report",
description: "I want to pass the selected text.",
author: "ArthurHoaro",
version: "1.0.0",
iconURL: baseURL + "/images/favicon.ico",
icon32URL: baseURL + "/images/favicon.ico",
icon64URL: baseURL + "/images/favicon.ico",
shareURL: baseURL + "/socialapi.php?title=%{title}&description=%{text}",
homepageURL: baseURL
};
node.setAttribute("data-service", JSON.stringify(data));
var activate = new CustomEvent("ActivateSocialFeature");
node.dispatchEvent(activate);
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment