Skip to content

Instantly share code, notes, and snippets.

@sonlard
Last active November 17, 2021 12:06
Show Gist options
  • Select an option

  • Save sonlard/013ba5fcd293921779112652f31b00db to your computer and use it in GitHub Desktop.

Select an option

Save sonlard/013ba5fcd293921779112652f31b00db to your computer and use it in GitHub Desktop.
//Sökord till ahrefs
javascript:{ var urlG = 'https://ahrefs.com/v3-keywords-explorer/google/se/ideas/havingSameTerms?keyword='; var inP = window.getSelection(); window.open(urlG + inP); }
//Sökord till ahrefs - markera ett sökord och klicka på bookmarklet så öppnas ahrefs med en sökning på enbart ett sökord och att markerat sökord ska hittas i ahrefs
javascript:{ var urlG = 'https://app.ahrefs.com/keywords-explorer/google/se/overview?wordCount=Min-1&include=all:%27; var inP = window.getSelection(); window.open( urlG + "*" + inP + "*"); }
//extern och intern duplicering
javascript:{ var urlG = 'https://www.google.com/search?q='; var inP = window.getSelection(); window.open(urlG +'"'+inP + '"'); }
//intern duplicering
javascript:{ var urlG = 'https://www.google.com/search?q='; var inP = window.getSelection(); var siteUrl = location.host; window.open(urlG + "site:" + siteUrl + " " + '"'+ inP + '"'); }
//räknar ord och tecken i en markering
javascript:(function()%7Bfunction f(d)%7Bvar t%3Bif(d.getSelection)t%3Dd.getSelection()%3Belse if(d.selection)t%3Dd.selection.createRange()%3Bif(t.text!%3Dundefined)t%3Dt.text%3Bif(!t%7C%7Ct%3D%3D%27%27)%7Bvar a%3Dd.getElementsByTagName(%27textarea%27)%3Bfor(var i%3D0%3Bi<a.length%3B%2B%2Bi)%7Bif(a%5Bi%5D.selectionStart!%3Dundefined%26%26a%5Bi%5D.selectionStart!%3Da%5Bi%5D.selectionEnd)%7Bt%3Da%5Bi%5D.value.substring(a%5Bi%5D.selectionStart,a%5Bi%5D.selectionEnd)%3Bbreak%3B%7D%7D%7D return t%3B%7D%3Bfunction g(d)%7Bvar t%3Btry%7Bt%3Df(d)%3B%7Dcatch(e)%7B%7D%3Bif(!t%7C%7Ct%3D%3D%27%27)%7Bvar fs%3Dd.getElementsByTagName(%27frame%27)%3Bfor(var i%3D0%3Bi<fs.length%3B%2B%2Bi)%7Bt%3Dg(fs%5Bi%5D.contentDocument)%3Bif(t%26%26t.toString()!%3D%27%27)break%3B%7D if(!t%7C%7Ct.toString()%3D%3D%27%27)%7Bfs%3Dd.getElementsByTagName(%27iframe%27)%3Bfor(var i%3D0%3Bi<fs.length%3B%2B%2Bi)%7Bt%3Dg(fs%5Bi%5D.contentDocument)%3Bif(t%26%26t.toString()!%3D%27%27)break%3B%7D%7D%7Dreturn t%3B%7D%3Bvar t%3Dg(document)%3Bif(!t%7C%7Ct%3D%3D%27%27)alert(%27please select some text%27)%3Belse alert(%27Chars: %27%2Bt.toString().length%2B%27%5CnWords: %27%2Bt.toString().match(/(%5CS%2B)/g).length)%3B%7D)()
//Kolla URL:en man är på i Pagespeed insight
javascript:location.href='https://developers.google.com/speed/pagespeed/insights/?url='+window.location
//Kollar URL:en man är på i googles testverktyg för strukturerad data
javascript:location.href='https://search.google.com/structured-data/testing-tool/u/0/#url='+window.location
//Markera en text och klicka på bookmarklet så får man veta hur många ord det är
javascript:(function()%7Bfunction f(d)%7Bvar t%3Bif(d.getSelection)t%3Dd.getSelection()%3Belse if(d.selection)t%3Dd.selection.createRange()%3Bif(t.text!%3Dundefined)t%3Dt.text%3Bif(!t%7C%7Ct%3D%3D%27%27)%7Bvar a%3Dd.getElementsByTagName(%27textarea%27)%3Bfor(var i%3D0%3Bi<a.length%3B%2B%2Bi)%7Bif(a%5Bi%5D.selectionStart!%3Dundefined%26%26a%5Bi%5D.selectionStart!%3Da%5Bi%5D.selectionEnd)%7Bt%3Da%5Bi%5D.value.substring(a%5Bi%5D.selectionStart,a%5Bi%5D.selectionEnd)%3Bbreak%3B%7D%7D%7D return t%3B%7D%3Bfunction g(d)%7Bvar t%3Btry%7Bt%3Df(d)%3B%7Dcatch(e)%7B%7D%3Bif(!t%7C%7Ct%3D%3D%27%27)%7Bvar fs%3Dd.getElementsByTagName(%27frame%27)%3Bfor(var i%3D0%3Bi<fs.length%3B%2B%2Bi)%7Bt%3Dg(fs%5Bi%5D.contentDocument)%3Bif(t%26%26t.toString()!%3D%27%27)break%3B%7D if(!t%7C%7Ct.toString()%3D%3D%27%27)%7Bfs%3Dd.getElementsByTagName(%27iframe%27)%3Bfor(var i%3D0%3Bi<fs.length%3B%2B%2Bi)%7Bt%3Dg(fs%5Bi%5D.contentDocument)%3Bif(t%26%26t.toString()!%3D%27%27)break%3B%7D%7D%7Dreturn t%3B%7D%3Bvar t%3Dg(document)%3Bif(!t%7C%7Ct%3D%3D%27%27)alert(%27please select some text%27)%3Belse alert(%27Chars: %27%2Bt.toString().length%2B%27%5CnWords: %27%2Bt.toString().match(/(%5CS%2B)/g).length)%3B%7D)()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment