Hi All:
I’m trying to write a wordpress plugin that incorporates baseball-reference.com’s B-R Linker (http://www.baseball-reference.com/linker/) functionality with my wordpress installation (if you follow the link - the B-R Linker is currently just a bookmarketlet - I want to have it ran automatically when hitting submit); however it does not seem to be working:
I tried to bind the javascript code to the “Submit” button on Wordpress to no avail; however if I replace the sr_link function’s code with ‘alert(“Testing”);’ it works - I believe it may be an intentional “defect” of javascript to not allow running off domain scripts. If this is the case - is there any way to get around this? or can anyone tell if I am doing anything wrong? Thanks so much.
-MS
function sr_link() {
var s=document.createElement("script");
s.charset="UTF-8";
var rand_param = "rand=" + Math.floor(Math.random()*10000);
s.src="http://baseball-reference.com/linker/linker.js?"+ rand_param;
void(document.body.appendChild(s));
}
jQuery(document).ready(function() {
jQuery('#publish').bind('click', function()
{
jQuery("#edButtonHTML").click();
sr_link();
});
});