Last active
August 2, 2016 19:28
-
-
Save mtandre/5d2f537c57cdc3fd88ba to your computer and use it in GitHub Desktop.
CMS Bookmarklet: Open current page in CMS search
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(function() { | |
var siteCodes = {"www.jsonline.com": "PMJS"}; | |
var siteCode = siteCodes[window.location.host]; | |
if (siteCode === "PMJS") { | |
var id = parseInt(window.location.pathname.split("/").slice(-2)[0],10); | |
if (id > 0) { | |
var searchUrl = 'https://presto-wigroup.gannettdigital.com/#/?k=' + id + '&st=' + siteCode + '&pg=1&pgs=25'; | |
window.open(searchUrl, '_blank'); | |
} | |
} else { | |
alert("This only works on www.jsonline.com."); | |
} | |
})(); | |
// minified | |
//javascript:(function(){var siteCodes={"www.jsonline.com":"PMJS"},siteCode=siteCodes[window.location.host];if("PMJS"===siteCode){var id=parseInt(window.location.pathname.split("/").slice(-2)[0],10);if(0<id){var searchUrl="https://presto-wigroup.gannettdigital.com/#/?k="+id+"&st="+siteCode+"&pg=1&pgs=25";window.open(searchUrl,"_blank")}}else alert("This only works on www.jsonline.com.");})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment