Advertisement
tamanmerah

Bookmarklet

Dec 5th, 2023 (edited)
16
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.73 KB | None | 0 0
  1. --- google translate
  2. https://translate.google.com/?sl=en&tl=id&op=translate
  3. --- chicago system ---
  4. javascript:(function(){var s=window.getSelection().toString();var t=document.title;var u=window.location.href;var date=new Date();var options={weekday: 'long', year: 'numeric', month: 'long', day: 'numeric'};var chicagoCitation='"'+t+'." Web page. Diakses pada '+date.toLocaleDateString('id-ID', options)+'. '+u;var d=document.createElement('div');d.style.position='fixed';d.style.top='10%';d.style.left='10%';d.style.width='80%';d.style.height='80%';d.style.backgroundColor='white';d.style.color='black';d.style.padding='20px';d.style.border='1px solid black';d.style.zIndex='1000';d.style.overflow='scroll';d.innerText="Quote:\n"+s+"Source:"+chicagoCitation;var b=document.createElement('button');b.textContent='Close';b.style.position='absolute';b.style.bottom='20px';b.style.right='20px';b.onclick=function(){document.body.removeChild(d);};d.appendChild(b);document.body.appendChild(d);})();
  5. --- extract images ---
  6. javascript:(function(){/* Extract images and dimension, sorted by dimension */var imgs=Array.from(document.getElementsByTagName('img'));imgs.sort((a,b)=>(b.naturalWidth*b.naturalHeight)-(a.naturalWidth*a.naturalHeight));var t=['<style>.img-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(120px,1fr));gap:10px;}.img-item{text-align:center;font-size:12px;}</style><div class="img-grid">'];for(var i=0;i<imgs.length;i++){t.push('<div class="img-item"><a href="'+imgs[i].src+'"><img src="'+imgs[i].src+'" width="100"><br>'+imgs[i].naturalWidth+'x'+imgs[i].naturalHeight+' pixels</a></div>');}t.push('</div>');if(t.length){var w=window.open('','_blank');if(w){w.document.write(t.join(''));w.document.close();}else{alert('cannot pop a window');}}})();
  7. --- search in google scholar ---
  8. javascript:(function(){/* search selected keyword in google scholar */var t=window.getSelection?window.getSelection().toString():document.selection.createRange().text;if(t){window.open('https://scholar.google.com/scholar?q='+encodeURIComponent(t));}})();
  9. --- outline this ---
  10. javascript:(function(){function processParagraphs(){var paragraphs=document.querySelectorAll('h1, h2, h3, h4, h1[id], h2[id], h3[id], h4[id], h1[class], h2[class], h3[class], h4[class], p, p[style], p[class], ol, ol[style], ol[class], ul, ul[style], ul[class], a, a[style], a[class], blockquote');paragraphs.forEach(p=>{if(p.closest('h2,h3,h4'))return;var sentences=p.innerText.split('.').map(s=>s.trim()).filter(s=>s.length>0);if(sentences.length>=3){p.innerText=sentences[0]+'. '+sentences[sentences.length-1]+'.';}});}function boldSubheadings(){var subheadings=document.querySelectorAll('h3, h4');subheadings.forEach(h=>{h.style.fontWeight='bold';});}processParagraphs();boldSubheadings();})();
  11.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement