The following code help you to add bookmarklet to other site……………….
javascript:(function(){ if(document.getElementById) {var x=document.getElementsByTagName(‘head’).item(0); var o=document.createElement(‘script’); if(typeof(o)!=’object’) o=document.standardCreateElement(‘script’); o.setAttribute(‘src’,'http://………………………./javascripts/mr.js’); o.setAttribute(‘type’,'text/javascript’) if (document.getElementById(“divAddToMyregistry_Panel_Container”)) { CreateDiv_AddToMyregistry(); } else { var documentBody = document.getElementsByTagName(“body”)[0]; var Divform = document.createElement(‘div’) Divform.id = “popup_name” Divform.className =”bookmark_popup_block” documentBody.appendChild(Divform) var Div_own = document.getElementById(‘popup_name’) var Divform2 = document.createElement(‘div’) Divform2.id = “bookmark_content” Div_own.appendChild(Divform2) var MrOtherStores1 = document.createElement(‘link’); MrOtherStores1.rel = “stylesheet”; MrOtherStores1.type = ‘text/css’; MrOtherStores1.href = “http://………………./stylesheets/bookmark.css”; documentBody.appendChild(MrOtherStores1); // Check Price var MrOtherStoresPrice = document.createElement(‘script’); MrOtherStoresPrice.id = “mr_scriptGetPrice”; MrOtherStoresPrice.type = ‘text/javascript’; MrOtherStoresPrice.src = “http://……………/javascripts/jquery.js”; documentBody.appendChild(MrOtherStoresPrice); var newScript1 = document.createElement(‘script’); newScript1.id = “pt_scriptAuthentication”; newScript1.type = ‘text/javascript’; newScript1.src = “http://………………………………/javascripts/jquery.xdomainajax.js”; documentBody.appendChild(newScript1); var drag_script = document.createElement(‘script’); drag_script.id = “drag_script”; drag_script.type = ‘text/javascript’; drag_script.src =”http://…………………./javascripts/event_drag.js”; documentBody.appendChild(drag_script); // Check Cookie var newScript = document.createElement(‘script’); newScript.id = “mr_scriptAuthentication”; newScript.type = ‘text/javascript’; newScript.src = “http://…………………../javascripts/bookmark.js”; documentBody.appendChild(newScript); jQuery(document).ready(function() { var popID = “popup_name” //jQuery(this).attr(‘rel’); //Get Popup Name var popURL = “#?w=685″ //jQuery(this).attr(‘href’); //Get Popup href to define size //Pull Query & Variables from href URL var query= popURL.split(‘?’); var dim= query[1].split(‘&’); var popWidth = dim[0].split(‘=’)[1]; //Gets the first query string value //Fade in the Popup and add close button jQuery(‘#’ + popID).fadeIn().css({ ‘width’: Number( popWidth ) }).prepend(‘<img src=”http://………………………./images/lightview/close_small.png” alt=”Close” />’); jQuery(‘#popup_name’).bind(‘drag’, function(event){ jQuery(this).css({ top: event.offsetY, left: event.offsetX }); }); ////Close Popups and Fade Layer jQuery(‘.book_close, #fade’).live(‘click’, function() { //When clicking on the close or fade layer… jQuery(‘#fade, .bookmark_popup_block’).fadeOut(function() { jQuery(‘#fade, .book_close’).remove(); //fade them both out }); return false; }); var d = document var w = window var e = w.getSelection var k = d.getSelection var x = d.selection var s = (e?e():(k)?k():(x?x.createRange().text:0)); var f = “http://……………………/item_from_bookmarklet”; var l = d.location e = encodeURIComponent var p= ‘?v=1&u=’+ e(l.href)%20 + ‘&t=’ + e(d.title.replace(/^\s*|\s*$/g,”))%20 + ‘&s=’+ e(s); var loadUrl=f; jQuery.ajaxSetup({ cache: false }); var ajax_load = “<img src=’img/load.gif’ alt=’Loading…’ />”; jQuery(“#bookmark_content”).html(ajax_load).load(“http://…………………………/item_from_bookmarklet?” + “u=”+ encodeURIComponent(l.href) +”&”+”s=”+ s + “&t=” + encodeURIComponent(d.title), null, function(responseText){ jQuery(‘#bookmark_content’).prepend(responseText); }); });
July 19, 2015 at 4:48 pm
Thanks for the marvelous posting! I certainly enjoyed reading it, you might be a great author.
I will ensure that I bookmark your blog and definitely will come back in the
foreseeable future. I want to encourage one to continue your great writing, have a nice holiday weekend!