Last active
August 29, 2015 14:26
-
-
Save oniksfly/dd12895b2cadd91971c3 to your computer and use it in GitHub Desktop.
SERP site position bookmarklet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getUrlParameter(sParam){var sPageURL = window.location.search.substring(1);var sURLVariables = sPageURL.split('&');for (var i = 0; i < sURLVariables.length; i++) {var sParameterName = sURLVariables[i].split('=');if (sParameterName[0] == sParam) {return sParameterName[1];}}} | |
var site_url = ''; | |
var message = ''; | |
var $onPageItems = jQuery('#ires .g:not(#imagebox_bigimages)'); | |
var start = getUrlParameter('start'); | |
if (!start) { | |
start = 0; | |
} else { | |
start = parseInt(start); | |
} | |
var result = jQuery('#ires .g:not(#imagebox_bigimages) h3 a[href*=' + site_url + ']:eq(0)').parents('.g'); | |
var current_page_position = $onPageItems.index(result) + 1; | |
var position = start + current_page_position; | |
if (current_page_position == 0) { | |
message = message + "There is no site on this page.\n"; | |
} else { | |
message = message + "Position: " + position + ".\n"; | |
} | |
alert(message); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Use http://mrcoles.com/bookmarklet/ with 'include jQuery' option to create bookmarklet.