var gabriel_id='128349062443667'; var logger_url='http://tools.miraiz.bz/gabriel/logger.php'; // jQuery JSONP plugin // version 1.1 // created by: // Toshimasa Ishibashi // iandeth99@ybb.ne.jp // http://iandeth.dyndns.org/mt/ian/archives/000654.html // Changes // 2007-08-26 v1.1 // * rewritten the script by wrapping with jQuery's $.extend() // 2007-08-12 v1.0 // * initial release // inspired by the original code: // JSON for jQuery by Michael Geary // http://mg.to/2006/01/25/json-for-jquery // // changes and modification I applied to the original code: // + changed API from $("div").json() to $.getJSONP() // + added jQuery.noConflict() compatibility // + added deletion of appended jsonp scripts after execution // + added counter-base anonymous function naming // + added script.charset = 'utf-8' // + redefined name() and load() as $.json class methods // + deleted $.json.callbacks reservoir hash since it wasn't used // thank you Michael, for sharing your code with us. (function($) { $.extend({ _jsonp : { scripts: {}, charset: 'utf-8', counter: 1, head: document.getElementsByTagName("head")[0], name: function( callback ) { var name = '_jsonp_' + (new Date).getTime() + '_' + this.counter; this.counter++; var cb = function( json ) { eval( 'delete ' + name ); callback( json ); $._jsonp.head.removeChild( $._jsonp.scripts[ name ] ); delete $._jsonp.scripts[ name ]; }; eval( name + ' = cb' ); return name; }, load: function( url, name ) { var script = document.createElement( 'script' ); script.type = 'text/javascript'; script.charset = this.charset; script.src = url; this.head.appendChild( script ); this.scripts[ name ] = script; } }, getJSONP : function ( url, callback ){ var name = $._jsonp.name( callback ); var url = url.replace( /{callback}/, name ); $._jsonp.load( url, name ); return this; } }); })(jQuery); var data_ar = {}; var now; var user_agent; var referer; var remote_addr; var before_referer; var b_width; var b_height; var get_url; data_ar['gabriel_id'] = encodeURI('128349062443667'); data_ar['now'] = encodeURI('1283490624'); data_ar['user_agent'] = encodeURI('CCBot/1.0 (+http://www.commoncrawl.org/bot.html)'); data_ar['remote_addr'] = encodeURI('38.107.191.95'); data_ar['before_referer'] = encodeURIComponent(document.referrer); data_ar['b_width'] = encodeURI(getBrowserWidth()); data_ar['b_height'] = encodeURI(getBrowserHeight()); data_ar['referer'] = encodeURI(document.URL); data_ar['title'] = encodeURI(document.title); get_url = logger_url + '?gabriel_id=' + data_ar['gabriel_id'] + '&now=' + data_ar['now'] + '&user_agent=' + data_ar['user_agent'] + '&referer=' + data_ar['referer'] + '&remote_addr=' + data_ar['remote_addr'] + '&before_referer=' + data_ar['before_referer'] + '&b_width=' + data_ar['b_width'] + '&b_height=' + data_ar['b_height'] + '&title=' + data_ar['title']; function getBrowserWidth() { if ( window.innerWidth ) { return window.innerWidth; } else if ( document.documentElement && document.documentElement.clientWidth != 0 ) { return document.documentElement.clientWidth; } else if ( document.body ) { return document.body.clientWidth; } return 0; } function getBrowserHeight() { if ( window.innerHeight ) { return window.innerHeight; } else if ( document.documentElement && document.documentElement.clientHeight != 0 ) { return document.documentElement.clientHeight; } else if ( document.body ) { return document.body.clientHeight; } return 0; } $.getJSONP(get_url, function(json) { alert(1); });