1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/base/content/test/social/social_mark.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,49 @@ 1.4 +<!DOCTYPE html> 1.5 +<html> 1.6 +<head> 1.7 + <link id="siteicon" rel="icon" href="./icon.png"/> 1.8 + <title>Demo Mark Window</title> 1.9 + <script type="text/javascript"> 1.10 + window.addEventListener("socialFrameShow", function(e) { 1.11 + var port = navigator.mozSocial.getWorker().port; 1.12 + port.postMessage({topic: "status-panel-visibility", result: "shown"}); 1.13 + }, false); 1.14 + window.addEventListener("socialFrameHide", function(e) { 1.15 + var port = navigator.mozSocial.getWorker().port; 1.16 + port.postMessage({topic: "status-panel-visibility", result: "hidden"}); 1.17 + }, false); 1.18 + 1.19 + function updateTextNode(parent, text) { 1.20 + var textNode = parent.childNodes[0]; 1.21 + if (textNode) 1.22 + parent.removeChild(textNode); 1.23 + textNode = document.createTextNode(text); 1.24 + parent.appendChild(textNode); 1.25 + } 1.26 + function onLoad() { 1.27 + updateTextNode(document.getElementById("shared"), location.search); 1.28 + socialMarkUpdate(true); 1.29 + } 1.30 + function socialMarkUpdate(isMarked) { 1.31 + var evt = document.createEvent("CustomEvent"); 1.32 + evt.initCustomEvent("socialMarkUpdate", true, true, JSON.stringify({marked: isMarked})); 1.33 + document.documentElement.dispatchEvent(evt); 1.34 + } 1.35 + var shareData; 1.36 + addEventListener("OpenGraphData", function(e) { 1.37 + shareData = JSON.parse(e.detail); 1.38 + updateTextNode(document.getElementById("shared"), shareData.url); 1.39 + socialMarkUpdate(true); 1.40 + }); 1.41 + </script> 1.42 +</head> 1.43 + 1.44 +<body onload="onLoad()"> 1.45 + <div id="content"> 1.46 + <h3>This window shows the mark data</h3> 1.47 + <div>Page Marked: <div id="shared" class="textbox"></div></div> 1.48 + <button id="unmark" onclick="socialMarkUpdate(false); window.close()">Unmark</button> 1.49 + <button onclick="window.close();">Close</button> 1.50 + </div> 1.51 +</body> 1.52 +</html>