Share = {} Share.onPageLoad = function() { Share.createPageActions(); } /************* Dynamically updates the page action links *************/ Share.createPageActions = function() { if (document.getElementById("link-link") != null) { document.getElementById("link-link").onclick = function() { Share.showLinkPopup() }; } if (document.getElementById("embed-link") != null) { document.getElementById("embed-link").onclick = function() { Share.showEmbedPopup() }; } //if (document.getElementById("print-link") != null) { // document.getElementById("print-link").onclick = function() { Share.showPrintVersion() }; //} if (document.getElementById("email-link") != null) { document.getElementById("email-link").onclick = function() { Share.showEmailPopup() }; } //Jungho Kim Nov 18, 2009 - RSS links should be displayed as plain links /* */ if (document.getElementById("rss-link") != null) { document.getElementById("rss-link").onclick = function() { Share.showRssPopup() }; } } /*//This is coded using JSTL on page instead Share.showPrintVersion = function() { document.getElementById("print-link").target = "_blank"; document.getElementById("print-link").href = location.href + "&print=true"; } */ Share.showEmailPopup = function() { } function replaceAll(content, find, replace) { while (content.indexOf(find) > -1) { content = content.replace(find,replace); } return content; } Share.showEmbedPopup = function() { //get the current navigation state/query string var url = location.href; var params; if (url.indexOf('/_/') > -1) params = url.substring(url.indexOf('/_/')); else params = url.substring(url.indexOf('?')+1); //set the querystring in the script textbox var script = document.getElementById("rss-script").innerHTML; script = replaceAll(script, "##serverName##", SERVER_NAME); script = replaceAll(script,"##siteRoot##", SITE_ROOT); script = replaceAll(script,"##querystring##", params); document.getElementById("rss-script").innerHTML = script; //show the popup var oIcon = document.getElementById("embed-link"); var oPopup = document.getElementById("share-embed"); oPopup.style.display = 'block'; oPopup.style.top = Common.getAbsoluteY(oIcon) - 280 + "px"; oPopup.style.left = Common.getAbsoluteX(oIcon) - 543 + "px"; oPopup.style.zIndex = 100; } Share.showLinkPopup = function() { //get the current navigation state/query string var url = location.href; //set the querystring in the url textbox document.getElementById("link-url").innerHTML = url; //show the popup var oIcon = document.getElementById("link-link"); var oPopup = document.getElementById("share-link"); oPopup.style.display = 'block'; oPopup.style.top = Common.getAbsoluteY(oIcon) - 280 + "px"; oPopup.style.left = Common.getAbsoluteX(oIcon) - 543 + "px"; oPopup.style.zIndex = 100; } Share.hidePopup = function(popupId) { var oPopup = document.getElementById(popupId); oPopup.style.display = 'none'; } Share.showRssPopup = function() { //get the current navigation state/query string var url = location.href; var params; if (url.indexOf('/_/') > -1) params = url.substring(url.indexOf('/_/')); else params = url.substring(url.indexOf('?')); //set the querystring in the url textbox var url = "http://##serverName####sitePages##/rss.jsp" + params; //set the querystring in the script textbox url = url.replace("##querystring##", params); url = url.replace("##serverName##", SERVER_NAME); url = url.replace("##sitePages##", SITE_PAGES); document.getElementById("rss-url").innerHTML = url; //show the popup var oIcon = document.getElementById("rss-icon"); var oPopup = document.getElementById("share-rss"); oPopup.style.display = 'block'; //Original positioning for small icon try { oPopup.style.top = oPopup.style.top + 37 + "px"; oPopup.style.left = 145 + oPopup.style.left - oPopup.offsetWidth + "px"; } catch (e) { } //oPopup.style.left = (Common.getAbsoluteX(oIcon) + 45 - oPopup.offsetWidth) + "px"; oPopup.style.zIndex = "100"; } Share.hideRssPopup = function() { var oPopup = document.getElementById("share-rss"); oPopup.style.display = 'none'; } Share.copyTextArea = function(oArea) { if (Common.checkIfIE()) { oArea.focus(); oArea.select(); var therange=oArea.createTextRange(); therange.execCommand("Copy"); alert("Content copied to clipboard!"); } else { alert("Automatic copy is not supported by your browser, please highlight and copy manually"); } }