Execute Bookmarklet Javascript

richim1

Client
Регистрация
19.10.2013
Сообщения
17
Благодарностей
0
Баллы
1
Hey guys,
How can i execute bookmarklet Javascript on browser. I have tried put JS on "Own code Javascript" run on current page & run locally but nothing.

Ex:
Bookmarklet for Storify
Код:
javascript:(function()%7Bvar%20_my_script=document.createElement('SCRIPT');%20_my_script.type='text/javascript';%20_my_script.src='//storify.com/public/js/bookmarklet.js?1.9.1';%20document.getElementsByTagName('head')%5B0%5D.appendChild(_my_script);%7D());
OR
Bookmarklet for HackerNews
Код:
javascript:window.location=%22http://news.ycombinator.com/submitlink?u=%22+encodeURIComponent(document.location)+%22&t=%22+encodeURIComponent(document.title)
OR
Bookmarklet for Delicious
Код:
javascript:(function(e,t){var%20n=e.document;setTimeout(function(){function%20a(e){if(e.data===%22destroy_bookmarklet%22){var%20r=n.getElementById(t);if(r){n.body.removeChild(r);r=null}}}var%20t=%22DELI_bookmarklet_iframe%22,r=n.getElementById(t);if(r){return}var%20i=%22https://delicious.com/save?%22,s=n.createElement(%22iframe%22);s.id=t;s.src=i+%22url=%22+encodeURIComponent(e.location.href)+%22&title=%22+encodeURIComponent(n.title)+%22&note=%22+encodeURIComponent(%22%22+(e.getSelection?e.getSelection():n.getSelection?n.getSelection():n.selection.createRange().text))+%22&v=1.1%22;s.style.position=%22fixed%22;s.style.top=%220%22;s.style.left=%220%22;s.style.height=%22100%25%22;s.style.width=%22100%25%22;s.style.zIndex=%2216777270%22;s.style.border=%22none%22;s.style.visibility=%22hidden%22;s.onload=function(){this.style.visibility=%22visible%22};n.body.appendChild(s);var%20o=e.addEventListener?%22addEventListener%22:%22attachEvent%22;var%20u=o==%22attachEvent%22?%22onmessage%22:%22message%22;e[o](u,a,false)},1)})(window)
Any help is much appreciated...
 

darkdiver

Administrator
Команда форума
Регистрация
13.01.2009
Сообщения
2 284
Благодарностей
2 728
Баллы
113
You should run such script via OwnCode->Javascript->Execute on page
for ycombinator
Код:
var a = document.createElement('a');
var linkText = document.createTextNode("ycombinator");
a.appendChild(linkText);
a.id = "ycombinator_link";
a.href = "javascript:window.location=%22http://news.ycombinator.com/submitlink?u=%22+encodeURIComponent(document.location)+%22&t=%22+encodeURIComponent(document.title)";
document.body.appendChild(a);
Or for storify
Код:
var a = document.createElement('a');
var linkText = document.createTextNode("storify");
a.appendChild(linkText);
a.id = "storify_link";
a.href = "javascript:(function()%7Bvar%20_my_script=document.createElement('SCRIPT');%20_my_script.type='text/javascript';%20_my_script.src='//storify.com/public/js/bookmarklet.js?1.9.1';%20document.getElementsByTagName('head')%5B0%5D.appendChild(_my_script);%7D());";
document.body.appendChild(a);
At end of the page a link wiil appear, you should click on it.
 
  • Спасибо
Реакции: richim1

richim1

Client
Регистрация
19.10.2013
Сообщения
17
Благодарностей
0
Баллы
1
Thanks darkdiver...

Is it works like this with another bookmarklet script?

Код:
var a = document.createElement('a');
var linkText = document.createTextNode("ycombinator");
a.appendChild(linkText);
a.id = "ycombinator_link";
a.href = "[COLOR="#FF0000"][B]JS BOOKMARKLET HERE[/B][/COLOR]";
document.body.appendChild(a);
 

darkdiver

Administrator
Команда форума
Регистрация
13.01.2009
Сообщения
2 284
Благодарностей
2 728
Баллы
113
should work
if no please write here, we will look.
 

richim1

Client
Регистрация
19.10.2013
Сообщения
17
Благодарностей
0
Баллы
1
Not work with this.

Код:
javascript:(%20function%20bookmarkCompressed()%20{%20if(typeof%20VEGA_installbk!=='undefined'){VEGA_installbk.call();return;}%20else%20if(typeof%20Vega!="undefined"&&Vega&&Vega.pageDataProxy){alert(Vega.pageDataProxy.data.bkAlreadyInstalled);}%20else%20if(typeof%20Vega==="undefined"||typeof%20Vega.g==="undefined")%20{window.Vega=window.Vega||{};window.Vega.g=window.Vega.g||{};this.BaseUrl="https://liiist.com";document.VzV={};%20var%20x%20=%20document.documentElement["clientWidth"];var%20y%20=%20document.documentElement["clientHeight"];x%20=%20Math.round(Math.max(0,%20x/2-70));y%20=%20Math.round(Math.max(0,%20y/2-45));var%20d%20=%20document.createElement('div');d.setAttribute('style',"position:fixed;top:"+y+"px;left:"+x+"px;z-index:99999999;background:#000;background:rgba(0,0,0,0.8);padding:20px;border-radius:10px;");d.setAttribute('id',"v-splashscreen");var%20s%20=%20document.createElement('img');s.setAttribute('src',this.BaseUrl+"/assets/layouts/img/waiting-2.gif");d.appendChild(s);document.body.appendChild(d);%20var%20VegaGrabberAdd=function(){this.BaseUrl="https://liiist.com";this.addJs=function(c,a){var%20d=false,e=document.getElementsByTagName("head")[0]?document.getElementsByTagName("head")[0]:document.body,b=document.createElement("script");b.setAttribute("type","text/javascript");%20b.setAttribute("src",this.BaseUrl+c);if(typeof%20a!="undefined"&&a!=null)b.onload=b.onreadystatechange=function(){if(!d&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){d=true;a();b.onload=b.onreadystatechange=null;e.removeChild(b)}};e.appendChild(b)};this.addCss=function(c){var%20a=document.createElement("link");a.setAttribute("rel","stylesheet");a.setAttribute("type","text/css");a.setAttribute("media","screen");a.setAttribute("href",this.BaseUrl+c);document.body.appendChild(a)};%20this._init=function(){var%20c=new%20Date;c=c.getTime();this.addJs("/grabber/services/version?v="+c,function(){document.VzV.add.addJs("/grabber/services/js?v="+VERSION+"&l="+LOCALE);document.VzV.add.addCss("/grabber/services/css?v="+VERSION+"&l="+LOCALE)})};document.VzV.add=this;this._init()};document.VzV.add=new%20VegaGrabberAdd}else%20typeof%20Vega.g.bus!="undefined"&&Vega.g.bus!=null&&window.Vega.g.bus.trigger(Vega.g.E_TOGGLE);%20})();
And this,

Код:
javascript:function%20memit(){if(window.location.host%20==%20'memit.com'){alert('It%20is%20not%20feasible%20to%20clip%20from%20the%20Memit-site.%20Please%20clip%20content%20from%20other%20web%20sites.');return;}window.mcv='0.16';var%20em='We\'re%20sorry!%20memit%20was%20unable%20to%20clip%20the%20page.\nA%20message%20has%20been%20sent%20to%20our%20technical%20department.\nWe\'re%20on%20it.';var%20D=window.document;var%20Pr=window.location.protocol;var%20ht=document.getElementsByTagName('html')[0];var%20h=document.getElementsByTagName('head')[0];if(!h){h=D.createElement('head');ht.appendChild(h);}var%20B=D.getElementsByTagName('body')[0];var%20g=window.memitPortalDomain='memit.com';if(!h||!B||!D){try{var%20re=new%20Image();re.src=Pr+'//'+g+'/webclipper/report/?url='+encodeURI(window.location.href);}catch(e){}alert(em);return;}var%20ih='<img%20src=\''+Pr+'//'+g+'/images/',z=ih+'t.png\'%20id=\'memitf\'>'+ih+'b.png\'%20id=\'memitg\'>',p='<div%20id=\'memita\'><div%20id=\'memitb\'>'+z+'<div%20id=\'memitc\'><div%20id=\'memitz\'><img%20src=\''+Pr+'//'+g+'/images/preloader.gif\'%20id=\'memitd\'><h1%20id=\'memite\'>Memming...</h1></div></div></div></div>';window.memitd=D.createElement('DIV');window.memitd.id='memitpreloaderoverlay';window.memitd.innerHTML=p;var%20cs=document.createElement('link');cs.setAttribute('rel',%20'stylesheet');cs.setAttribute('type',%20'text/css');cs.setAttribute('href',%20Pr+'//'+g+'/css/wcp.css');h.appendChild(cs);B.appendChild(window.memitd);if%20(window.memitClipper%20!=%20undefined)%20{memitClipper.clipArticle();%20return;}var%20script=document.createElement('SCRIPT');script.type='text/javascript';script.src=Pr+'//'+g+'/webclipper/code/filename/jwebclipper.min';h.appendChild(script);}try%20{memit();}catch(e){window.document.removeChild(window.memitd);var%20message='Clipper%20Error';alert(message)}
 

darkdiver

Administrator
Команда форума
Регистрация
13.01.2009
Сообщения
2 284
Благодарностей
2 728
Баллы
113
For list liiist.com just replace " with '
You can not make a mixture of quotas types.
Код:
javascript:(%20function%20bookmarkCompressed()%20{%20if(typeof%20VEGA_installbk!=='undefined'){VEGA_installbk.call();return;}%20else%20if(typeof%20Vega!='undefined'&&Vega&&Vega.pageDataProxy){alert(Vega.pageDataProxy.data.bkAlreadyInstalled);}%20else%20if(typeof%20Vega==='undefined'||typeof%20Vega.g==='undefined')%20{window.Vega=window.Vega||{};window.Vega.g=window.Vega.g||{};this.BaseUrl='https://liiist.com';document.VzV={};%20var%20x%20=%20document.documentElement['clientWidth'];var%20y%20=%20document.documentElement['clientHeight'];x%20=%20Math.round(Math.max(0,%20x/2-70));y%20=%20Math.round(Math.max(0,%20y/2-45));var%20d%20=%20document.createElement('div');d.setAttribute('style','position:fixed;top:'+y+'px;left:'+x+'px;z-index:99999999;background:#000;background:rgba(0,0,0,0.8);padding:20px;border-radius:10px;');d.setAttribute('id','v-splashscreen');var%20s%20=%20document.createElement('img');s.setAttribute('src',this.BaseUrl+'/assets/layouts/img/waiting-2.gif');d.appendChild(s);document.body.appendChild(d);%20var%20VegaGrabberAdd=function(){this.BaseUrl='https://liiist.com';this.addJs=function(c,a){var%20d=false,e=document.getElementsByTagName('head')[0]?document.getElementsByTagName('head')[0]:document.body,b=document.createElement('script');b.setAttribute('type','text/javascript');%20b.setAttribute('src',this.BaseUrl+c);if(typeof%20a!='undefined'&&a!=null)b.onload=b.onreadystatechange=function(){if(!d&&(!this.readyState||this.readyState=='loaded'||this.readyState=='complete')){d=true;a();b.onload=b.onreadystatechange=null;e.removeChild(b)}};e.appendChild(b)};this.addCss=function(c){var%20a=document.createElement('link');a.setAttribute('rel','stylesheet');a.setAttribute('type','text/css');a.setAttribute('media','screen');a.setAttribute('href',this.BaseUrl+c);document.body.appendChild(a)};%20this._init=function(){var%20c=new%20Date;c=c.getTime();this.addJs('/grabber/services/version?v='+c,function(){document.VzV.add.addJs('/grabber/services/js?v='+VERSION+'&l='+LOCALE);document.VzV.add.addCss('/grabber/services/css?v='+VERSION+'&l='+LOCALE)})};document.VzV.add=this;this._init()};document.VzV.add=new%20VegaGrabberAdd}else%20typeof%20Vega.g.bus!='undefined'&&Vega.g.bus!=null&&window.Vega.g.bus.trigger(Vega.g.E_TOGGLE);%20})();
For second code I don't what is the problem. This code does not work in FireFox, it works in Chrome but not in FireFox. Plese find version for Firefox.
 
  • Спасибо
Реакции: richim1

richim1

Client
Регистрация
19.10.2013
Сообщения
17
Благодарностей
0
Баллы
1
That's the only one code i found.
You can check here : memit.com/tools OR memit.com/mobileclipper

I've tried on firefox directly (i use firefox 25) and it works, when on ProjectMaker nothing happen, it's weird. :confused:
 

darkdiver

Administrator
Команда форума
Регистрация
13.01.2009
Сообщения
2 284
Благодарностей
2 728
Баллы
113
if you open it in PM browser it generate slightly different script, you should use it.
Код:
javascript:function memit(){if(window.location.host == 'memit.com'){alert('It is not feasible to clip from the Memit-site. Please clip content from other web sites.');return;}window.mcv='0.16';var em='We\'re sorry! memit was unable to clip the page.\nA message has been sent to our technical department.\nWe\'re on it.';var D=window.document;var Pr=window.location.protocol;var ht=document.getElementsByTagName('html')[0];var h=document.getElementsByTagName('head')[0];if(!h){h=D.createElement('head');ht.appendChild(h);}var B=D.getElementsByTagName('body')[0];var g=window.memitPortalDomain='memit.com';if(!h||!B||!D){try{var re=new Image();re.src=Pr+'//'+g+'/webclipper/report/?url='+encodeURI(window.location.href);}catch(e){}alert(em);return;}var ih='<img src=\''+Pr+'//'+g+'/images/',z=ih+'t.png\' id=\'memitf\'>'+ih+'b.png\' id=\'memitg\'>',p='<div id=\'memita\'><div id=\'memitb\'>'+z+'<div id=\'memitc\'><div id=\'memitz\'><img src=\''+Pr+'//'+g+'/images/preloader.gif\' id=\'memitd\'><h1 id=\'memite\'>Memming...</h1></div></div></div></div>';window.memitd=D.createElement('DIV');window.memitd.id='memitpreloaderoverlay';window.memitd.innerHTML=p;var cs=document.createElement('link');cs.setAttribute('rel', 'stylesheet');cs.setAttribute('type', 'text/css');cs.setAttribute('href', Pr+'//'+g+'/css/wcp.css');h.appendChild(cs);B.appendChild(window.memitd);if (window.memitClipper != undefined) {memitClipper.clipArticle(); return;}var script=document.createElement('SCRIPT');script.type='text/javascript';script.src=Pr+'//'+g+'/webclipper/code/filename/jwebclipper.min';h.appendChild(script);setTimeout(function(){if(!window.memitClipper){B.removeChild(window.memitd);alert('Sorry, the clipper is not currently supported on this page.');}},2000);}try {memit();}catch(e){window.document.body.removeChild(window.memitd);var message='Clipper Error';alert(message)}
 
  • Спасибо
Реакции: Vasar

Vasar

Client
Регистрация
08.04.2010
Сообщения
150
Благодарностей
75
Баллы
28
Please, could you help me to adapt this code?

Код:
<a id="bookmarklet" href="javascript: (function() { var d = document, e = d.getElementById('wappalyzer-container') ; if ( e !== null ) { d.body.removeChild(e); } var u = 'http://wappalyzer.com/bookmarklet/', t = new Date().getTime(), c = d.createElement('div'), p = d.createElement('div'), l = d.createElement('link'), s = d.createElement('script') ; c.setAttribute('id', 'wappalyzer-container'); l.setAttribute('rel', 'stylesheet'); l.setAttribute('href', u + 'css/wappalyzer.css'); d.head.appendChild(l); p.setAttribute('id', 'wappalyzer-pending'); p.setAttribute('style', 'background-image: url(' + u + 'images/pending.gif) !important'); c.appendChild(p); s.setAttribute('src', u + 'js/wappalyzer.js?' + t); s.onload = function() { s = d.createElement('script'); s.setAttribute('src', u + 'js/apps.js?' + t); s.onload = function() { s = d.createElement('script'); s.setAttribute('src', u + 'js/driver.js?' + t); c.appendChild(s); }; c.appendChild(s); }; c.appendChild(s); d.body.appendChild(c); })();">Wappalyzer</a>
Just done that:
Код:
var a = document.createElement('a');var linkText = document.createTextNode("wappalyzer");
a.appendChild(linkText);
a.id = "wappalyzer_link";
a.href = "javascript: (function() { var d = document, e = d.getElementById('wappalyzer-container') ; if ( e !== null ) { d.body.removeChild(e); } var u = 'http://wappalyzer.com/bookmarklet/', t = new Date().getTime(), c = d.createElement('div'), p = d.createElement('div'), l = d.createElement('link'), s = d.createElement('script') ; c.setAttribute('id', 'wappalyzer-container'); l.setAttribute('rel', 'stylesheet'); l.setAttribute('href', u + 'css/wappalyzer.css'); d.head.appendChild(l); p.setAttribute('id', 'wappalyzer-pending'); p.setAttribute('style', 'background-image: url(' + u + 'images/pending.gif) !important'); c.appendChild(p); s.setAttribute('src', u + 'js/wappalyzer.js?' + t); s.onload = function() { s = d.createElement('script'); s.setAttribute('src', u + 'js/apps.js?' + t); s.onload = function() { s = d.createElement('script'); s.setAttribute('src', u + 'js/driver.js?' + t); c.appendChild(s); }; c.appendChild(s); }; c.appendChild(s); d.body.appendChild(c); })(); ";
document.body.appendChild(a);
 

darkdiver

Administrator
Команда форума
Регистрация
13.01.2009
Сообщения
2 284
Благодарностей
2 728
Баллы
113
Just done that:
Код:
var a = document.createElement('a');
var linkText = document.createTextNode("wappalyzer");
a.appendChild(linkText);
a.id = "wappalyzer_link";
a.href = "javascript: (function() { var d = document, e = d.getElementById('wappalyzer-container') ; if ( e !== null ) { d.body.removeChild(e); } var u = 'http://wappalyzer.com/bookmarklet/', t = new Date().getTime(), c = d.createElement('div'), p = d.createElement('div'), l = d.createElement('link'), s = d.createElement('script') ; c.setAttribute('id', 'wappalyzer-container'); l.setAttribute('rel', 'stylesheet'); l.setAttribute('href', u + 'css/wappalyzer.css'); d.head.appendChild(l); p.setAttribute('id', 'wappalyzer-pending'); p.setAttribute('style', 'background-image: url(' + u + 'images/pending.gif) !important'); c.appendChild(p); s.setAttribute('src', u + 'js/wappalyzer.js?' + t); s.onload = function() { s = d.createElement('script'); s.setAttribute('src', u + 'js/apps.js?' + t); s.onload = function() { s = d.createElement('script'); s.setAttribute('src', u + 'js/driver.js?' + t); c.appendChild(s); }; c.appendChild(s); }; c.appendChild(s); d.body.appendChild(c); })(); ";
document.body.appendChild(a);
yes this should work.
 

Кто просматривает тему: (Всего: 1, Пользователи: 0, Гости: 1)