From 54f47c1e25e77c22844132444fe7776b92316877 Mon Sep 17 00:00:00 2001 From: Pierre Andrews Date: Mon, 13 Aug 2007 18:18:02 +0100 Subject: [PATCH] initial commit 2 --- .gitignore | 1 + flickrautopage.user.js | 2229 ++++++++++++++++++++-------------------- flickrbuddyinteresting.user.js | 204 +++- flickreasynsid.user.js | 772 +++++++------- flickreasyphotopost.user.js | 876 ++++++++-------- flickrexifinfo.user.js | 2 +- flickrphotomagnifier.user.js | 1458 +++++++++++++------------- flickrrefercomment.user.js | 5 +- flickrsnap.user.js | 270 +---- flickrstylecontacts.user.js | 1 + flickrupcomingevent.user.js | 1353 ++++++++++++------------ 11 files changed, 3536 insertions(+), 3635 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e43b0f9 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.DS_Store diff --git a/flickrautopage.user.js b/flickrautopage.user.js index 19f7c81..5b5b81a 100644 --- a/flickrautopage.user.js +++ b/flickrautopage.user.js @@ -1,1099 +1,1130 @@ -// Flickr Auto Page -// Copyright (c) 2007, Pierre Andrews. -// Released under the GPL license -// http://www.gnu.org/copyleft/gpl.html -// -// ==UserScript== -// @name Flickr Auto Page -// @namespace http://6v8.gamboni.org/Flickr-Auto-Pagination.html -// @description removes the need to paginate when browsing flickr -// @version 0.8 -// @date 2007-06-13 -// @creator Pierre Andrews (mortimer.pa@free.fr) -// @include http://*flickr.com/groups/*/pool* -// @include http://*flickr.com/groups/*/admin -// @include http://*flickr.com/groups/*/discuss* -// @include http://*flickr.com/photos/*/* -// @include http://*flickr.com/photos/*/*/sets/*/detail* -// @include http://*flickr.com/recent_activity.gne* -// @include http://*flickr.com/photos_comments.gne* -// @include http://*flickr.com/search* -// @include http://*flickr.com/photos/friends* -// @include http://*flickr.com/help/forum* -// @include http://*flickr.com/explore/intersting/* -// @include http://*flickr.com/people/*/contacts* -// @include http://*flickr.com/creativecommons/* -// @include http://*flickr.com/groups_members_detail.gne* -// @exclude http://*flickr.com/*#disableautopage - -// ==/UserScript== - -//TODO javascript oddness -//TODO new photo - -(function () { - - var win = window; - - //update information - var SCRIPT = { - name: "Flickr Auto Page", - namespace: "http://6v8.gamboni.org/Flickr-Auto-Pagination.html", - description: "removes the need to paginate when browsing flickr.", - source: "http://6v8.gamboni.org/Flickr-Auto-Page.html", // script homepage/description URL - identifier: "http://6v8.gamboni.org/IMG/js/flickrautopage.user.js", - version: "0.8", // version - date: (new Date(2007, 06, 13)) // update date - .valueOf() - }; - - //====================================================================== - //to do the closure and get the right this. - //adapted from http://persistent.info/greasemonkey/gmail.user.js - - function getObjectMethodClosure3(object, method,args,args1,args2,args3) { - return function() { - return object[method](args,args1,args2,args3); - } - } - function getObjectMethodClosure2(object, method,args,args1,args2) { - return function() { - return object[method](args,args1,args2); - } - } - function getObjectMethodClosure1(object, method,args,args1) { - return function() { - return object[method](args,args1); - } - } - - function getObjectMethodClosure0(object, method,args) { - return function() { - return object[method](args); - } - } - - function getObjectMethodClosure(object, method) { - return function(args) { - return object[method](args); - } - } - - /* - Xpath trickery, from: - http://ecmanaut.blogspot.com/2006/07/expressive-user-scripts-with-xpath-and.html - */ - function $x( xpath, root ) - { - var doc = root ? root.evaluate?root:root.ownerDocument : document; - var got = doc.evaluate( xpath, root||doc, null, 0, null ), next; - var result = []; - while( next = got.iterateNext() ) - result.push( next ); - return result; - } - - - function $x1(xpath) { - return document.evaluate( - xpath, - document, - null, - XPathResult.FIRST_ORDERED_NODE_TYPE, null - ).singleNodeValue; - } - - function foreach( xpath, cb, root ) - { - var nodes = $x( xpath, root ), e = 0; - for( var i=0; i nbr) nbr = x; - } - M8_log(nbr); - return nbr; - }, - - //inspired by http://squarefree.com/userscripts - //using iframes instead of xmlhttpRequest applies javascripts and other GM scripts to the page :D - pullMore: function(url,processReply, special) { - var iframe = document.createElement("iframe"); - var self = this; - iframe.width = 1; - iframe.height = 1; - iframe.style.display = "none"; - iframe.id = 'autopageframe'; - document.body.appendChild(iframe); - iframe.addEventListener("load", - function(){ - self.msg_div.innerHTML = ''; - - if(url.indexOf('photos/friends') >= 0) self.insert.innerHTML += '
'; - - if(self.insert) { - var anchor = self.insert.appendChild(document.createElement('a')); - anchor.name = 'infinitepage'+(self.next_request-1); - } - var b = iframe.contentDocument.body; - - //self.insert.innerHTML = - processReply(b, self.insert); - - self.received = true; - var link; - switch(special) { - case 1: - link = $x1("//div[@id='Pages']//div[@class='Paginator']//a[text()='"+(self.next_request-1)+"']"); - break; - default: - link = $x1("//div[@class='Paginator']//a[text()='"+(self.next_request-1)+"']"); - } - if(!link) { - switch(special) { - case 1: - link = $x1("//div[@id='Pages']//div[@class='Paginator']//span[text()='...']"); - break; - default: - link = $x1("//div[@class='Paginator']//span[text()='...']"); - } - var a = link.parentNode.insertBefore(document.createElement('a'),link); - a.className = 'this-page'; - a.setAttribute('style',"margin: 0pt; display: block; width: 2em;"); - a.href='#infinitepage'+(self.next_request-1); - a.innerHTML = (self.next_request-1); - } else { - link.href='#infinitepage'+(self.next_request-1); - link.className += 'this-page'; - } - self.first = false; - - //get rid of iframe - setTimeout( function() { iframe.parentNode.removeChild(iframe); }, 1500); - }, false); - iframe.src = url+'#disableautopage'; - }, - - cb_shortcut: function(url,msg,processReply,special) { - if(this.received) { - if(this.next_request > this.nbr_page) { - this.msg_div.innerHTML = self.localiser.localise('showing',{'page':(self.next_request-1),'total':self.nbr_page})+' '+msg; - } else if(this.insert) { - this.next_request++; - var self = this; - M8_log('get'+url); - this.msg_div.innerHTML = this.localiser.localise('loading',{ - 'nbrpage':(this.next_request-1), - 'total': this.nbr_page - })+ '
'; - this.received = false; - this.pullMore(url,processReply,special); - } - - } - }, - - generic_cb: function(msg,url,xpath,additionalBits) { - url = url.replace('@P@',this.next_request); - var self = this; - var processReply = function(body,insert) { - //move the elements - var cnt = 0; - foreach(xpath, - function(elt) { - cnt++; - insert.appendChild(elt); - elt.className += ' AutoPageAddition'+self.next_request; - }, - body - ); - - //fix the buddy icons over for the moved element - foreach("//.[contains(@class,'AutoPageAddition"+self.next_request+"')]//img[contains(@src,'buddyicon')]", - function(img) { - img.addEventListener('mouseover',getObjectMethodClosure(unsafeWindow.document.getElementById('person_hover'),'icon_mouseover'),true); - img.addEventListener('mouseout',getObjectMethodClosure(unsafeWindow.document.getElementById("person_hover"),'icon_mouseout'),true); - var nsid = '' - if(img.src.indexOf('buddyicon.jpg') >= 0) { - nsid = img.src.replace(/.*\?/,''); - } else { - nsid = img.src.replace(/.*\/(.*)\.jpg(\?.*)?$/,'$1'); - } - img.nsid = nsid; - var hover; - var hover_insert = document.getElementById("person_hover_link") - if(!document.getElementById('hover_img'+nsid) && (hover = body.ownerDocument.getElementById('hover_img'+nsid))) { - hover_insert.appendChild(hover); - } - },document); - additionalBits("AutoPageAddition"+self.next_request,body); - } - this.cb_shortcut(url,msg,processReply); - }, - - /* messages_cb: function(query) { - var msg = 'No More Messages'; - url = "http://"+document.location.host+"/messages.gne?ok=1&page="+(this.next_request); - - var processReply = function(text,html) { - var start = 0; - var end = 0; - - - start = text.indexOf(''); - start+=47; - end = text.indexOf('
',start); - text = text.slice(start,end); - - html +=text; - return html; - } - this.cb_shortcut(url,msg,processReply); - },*/ - - - init: function() { - var matches; - var cb = undefined; - var msg; - var url; - var xpath; - var special = 0; - var additionalBits = function() {}; - - //for the group pool - if(matches = /\/groups\/(.*)\/pool\/?(page([0-9]+))?\/?$/.exec(document.location.pathname)) { - - this.paginator = $x1("//div[@class='Pages']/div[@class='Paginator']"); - var pp = $x1("//div[@class='Pages']/div[@class='Results']"); - this.nbr_page = Math.ceil(this.findTotalPage(pp.innerHTML)/30); - - if(matches[3]) this.next_request= parseInt(matches[3]); - this.insert = $x1("//div[@class='HoldPhotos']"); - msg = this.localiser.localise('nophoto'); - url = "http://"+document.location.host+"/groups/"+matches[1]+"/pool/page@P@"; - xpath = "//div[@class='HoldPhotos']/p"; - } //for the group discuss - else if(matches = /\/groups\/(.*)\/discuss\/?(page([0-9]+))?\/?$/.exec(document.location.pathname)) { - - this.paginator = $x1("//div[@class='Pages']/div[@class='Paginator']"); - var pp = $x1("//div[@class='Pages']/div[@class='Results']"); - this.nbr_page = Math.ceil(this.findTotalPage(pp.innerHTML)/20); - - if(matches[3]) this.next_request= parseInt(matches[3]); - this.insert = $x1("//table[@class='TopicListing']/tbody"); - - url = "http://"+document.location.host+"/groups/"+matches[1]+"/discuss/page@P@"; - msg = this.localiser.localise('nodiscussion'); - xpath = "//table[@class='TopicListing']/tbody/tr"; - } //for the group topics - else if(matches = /\/groups\/(.*)\/discuss\/([0-9]+)\/?(page([0-9]+))?\/?$/.exec(document.location.pathname)) { - special = 1; - var otherpage = $x1("//div[@id='DiscussTopic']/div[@class='Pages']/div[@class='Paginator']"); - if(otherpage) { - otherpage.className = ''; - otherpage.parentNode.style.display = 'none'; - } - this.paginator = $x1("//div[@id='Pages']/div/div[@class='Paginator']"); - var pp = $x1("//div[@id='Pages']/div/div[@class='Results']"); - this.nbr_page = Math.ceil(this.findTotalPage(pp.innerHTML)/100); - - if(matches[4]) this.next_request= parseInt(matches[4]); - this.insert = $x1("//table[@class='TopicReply']/tbody"); - - msg = this.localiser.localise('noreply'); - url = "http://"+document.location.host+"/groups/"+matches[1]+"/discuss/"+matches[2]+"/page@P@"; - xpath = "//table[@class='TopicReply']/tbody/tr"; - } //for the help topics - else if(matches = /\/help\/forum\/([A-Za-z-]+)\/([0-9]+)\/?(page([0-9]+))?\/?$/.exec(document.location.pathname)) { - special = 2; - var otherpage = $x1("//div[@id='DiscussTopic']/div[@class='Pages']/div[@class='Paginator']"); - if(otherpage) { - otherpage.className = ''; - otherpage.parentNode.style.display = 'none'; - } - this.paginator = $x1("//div[@class='Pages']/div[@class='Paginator']"); - - var pp = $x1("//div[@class='Pages']//div[@class='Results']"); - this.nbr_page = Math.ceil(this.findTotalPage(pp.innerHTML)/100); - - if(matches[4]) this.next_request= parseInt(matches[4]); - this.insert = $x1("//table[@class='TopicReply']/tbody"); - url = "http://"+document.location.host+"/help/forum/"+matches[1]+'/'+matches[2]+"/page@P@"; - xpath = "//table[@class='TopicReply']/tbody/tr"; - msg = this.localiser.localise('nodiscussion'); - } //for the help forum - else if(document.location.pathname.indexOf('/help/forum') >= 0) { - matches = /([?&]page=([0-9]+))?/.exec(document.location.search); - - this.paginator = $x1("//div[@class='Pages']/div[@class='Paginator']"); - var as = this.paginator.getElementsByTagName('a'); - var lang = 'en-us'; - if(as && as.length >0) { - var tmp = /\/help\/forum\/([^\/]+)\//.exec(as[0].href); - if(tmp) lang = tmp[1]; - } - - var pp = $x1("//div[@class='Pages']/div[@class='Results']"); - this.nbr_page = Math.ceil(this.findTotalPage(pp.innerHTML)/20); - - this.insert = $x1("//table[@class='TopicListing'][2]/tbody"); - if(matches[3]) this.next_request= parseInt(matches[2]); - msg = this.localiser.localise('noreply'); - url = "http://"+document.location.host+"/help/forum/"+lang+"/?page=@P@"; - xpath = "//table[@class='TopicListing'][2]/tbody/tr"; - } //for the contacts photo - else if(matches = /\/photos\/friends\/?(page([0-9]+))?\/?$/.exec(document.location.pathname)) { - this.paginator = $x1("//div[@class='Pages']/div[@class='Paginator']"); - var pp = $x1("//div[@class='Pages']/div[@class='Results']"); - this.nbr_page = Math.ceil(this.findTotalPage(pp.innerHTML)/24); - - if(matches[2]) this.next_request= parseInt(matches[2]); - this.insert = $x1("//div[@class='HoldPhotos']"); - url = "http://"+document.location.host+"/photos/friends/page@P@"; - xpath = "//div[@class='HoldPhotos']/p"; - msg = this.localiser.localise('nophoto'); - } //for everyone's tag - else if(matches = /\/photos\/tags\/([^\/]+)\/?(interesting)?\/?$/.exec(document.location.pathname)) { - - var matches2 = /\?page=([0-9]+)$/.exec(document.location.search); - - this.paginator = $x1("//div[@class='Pages']/div[@class='Paginator']"); - var pp = $x1("//div[@class='Pages']/div[@class='Results']"); - this.nbr_page = Math.ceil(this.findTotalPage(pp.innerHTML)/20); - - if(matches2 && matches2[1]) this.next_request= parseInt(matches2[1]); - this.insert = $x1("//td[@id='GoodStuff']/div"); - url = "http://"+document.location.host+"/photos/tags/"+matches[1]; - if(matches[2]) url += "/interesting" - url += "/?page=@P@"; - msg = this.localiser.localise('nophoto'); - xpath = "//td[@id='GoodStuff']/div/p"; - } //for tag cluster - else if(matches = /\/photos\/tags\/([^\/]+)\/clusters\/([^\/]+)\/?(page([0-9]+))?\/?$/.exec(document.location.pathname)) { - - this.paginator = $x1("//div[@class='Pages']/div[@class='Paginator']"); - var pp = $x1("//div[@class='Pages']/div[@class='Results']"); - this.nbr_page = Math.ceil(this.findTotalPage(pp.innerHTML)/20); - - if(matches[3]) this.next_request= parseInt(matches[3]); - this.insert = $x1("//div[@id='tagThumbs']"); - M8_log(this.insert); - url = "http://"+document.location.host+"/photos/tags/"+matches[1]+"/clusters/"+matches[2]+"/page@P@"; - msg = this.localiser.localise('nophoto'); - xpath = "//div[@id='tagThumbs']/p"; - } //for user's tag - else if(matches = /\/photos\/([^\/]+)\/tags\/([^\/]+)\/?(page([0-9]+))?\/?$/.exec(document.location.pathname)) { - - this.paginator = $x1("//div[@class='Pages']/div[@class='Paginator']"); - var pp = $x1("//div[@class='Pages']/div[@class='Results']"); - this.nbr_page = Math.ceil(this.findTotalPage(pp.innerHTML)/20); - - if(matches[4]) this.next_request= parseInt(matches[4]); - this.insert = $x1("//td[@id='GoodStuff']/div"); - url = "http://"+document.location.host+"/photos/"+matches[1]+"/tags/"+matches[2]+"/page@P@"; - msg = this.localiser.localise('nophoto'); - xpath = "//td[@id='GoodStuff']/div/p"; - } //for interesting-popular page - else if(matches = /\/photos\/([^\/]+)\/popular-interesting\/?(page([0-9]+))?\/?$/.exec(document.location.pathname)) { - - this.paginator = $x1("//div[@class='Pages']/div[@class='Paginator']"); - var pp = $x1("//div[@class='Pages']/div[@class='Results']"); - this.nbr_page = Math.ceil(this.findTotalPage(pp.innerHTML)/20); - - if(matches[2]) this.next_request= parseInt(matches[2]); - this.insert = $x1("//table[@class='PopularPic']/tbody"); - url = "http://"+document.location.host+"/photos/"+matches[1]+"/popular-interesting/page@P@"; - - msg = this.localiser.localise('nophoto'); - xpath = "//table[@class='PopularPic']/tbody/tr"; - } //for popular-view page - else if(matches = /\/photos\/([^\/]+)\/popular-views\/?(page([0-9]+))?\/?$/.exec(document.location.pathname)) { - - this.paginator = $x1("//div[@class='Pages']/div[@class='Paginator']"); - var pp = $x1("//div[@class='Pages']/div[@class='Results']"); - this.nbr_page = Math.ceil(this.findTotalPage(pp.innerHTML)/20); - - if(matches[2]) this.next_request= parseInt(matches[2]); - this.insert = $x1("//table[@class='PopularPic']/tbody"); - url = "http://"+document.location.host+"/photos/"+matches[1]+"/popular-views/page@P@"; - msg = this.localiser.localise('nophoto'); - xpath = "//table[@class='PopularPic']/tbody/tr"; - } //for popular-comments page - else if(matches = /\/photos\/([^\/]+)\/popular-comments\/?(page([0-9]+))?\/?$/.exec(document.location.pathname)) { - - this.paginator = $x1("//div[@class='Pages']/div[@class='Paginator']"); - var pp = $x1("//div[@class='Pages']/div[@class='Results']"); - this.nbr_page = Math.ceil(this.findTotalPage(pp.innerHTML)/20); - - if(matches[2]) this.next_request= parseInt(matches[2]); - this.insert = $x1("//table[@class='PopularPic']/tbody"); - url = "http://"+document.location.host+"/photos/"+matches[1]+"/popular-comments/page@P@"; - - msg = this.localiser.localise('nophoto'); - xpath = "//table[@class='PopularPic']/tbody/tr"; - } //for popular-faves page - else if(matches = /\/photos\/([^\/]+)\/popular-faves\/?(page([0-9]+))?\/?$/.exec(document.location.pathname)) { - - this.paginator = $x1("//div[@class='Pages']/div[@class='Paginator']"); - var pp = $x1("//div[@class='Pages']/div[@class='Results']"); - this.nbr_page = Math.ceil(this.findTotalPage(pp.innerHTML)/20); - - if(matches[2]) this.next_request= parseInt(matches[2]); - this.insert = $x1("//table[@class='PopularPic']/tbody"); - url = "http://"+document.location.host+"/photos/"+matches[1]+"/popular-faves/page@P@"; - msg = this.localiser.localise('nophoto'); - xpath = "//table[@class='PopularPic']/tbody/tr"; - } //for comments on a photo - else if(unsafeWindow.page_photo_id) { - - special = 3; - var otherpage = $x1("//div[@id='DiscussPhoto']/div[@class='Pages']/div[@class='Paginator']"); - if(otherpage) { - otherpage.className = ''; - otherpage.parentNode.style.display = 'none'; - } - - - this.paginator = $x1("//div[@class='Pages']/div[@class='Paginator']"); - var pp = $x1("//div[@class='Pages']/div[@class='Results']"); - this.nbr_page = Math.ceil(this.findTotalPage(pp.innerHTML)/100); - - matches = /\/page([0-9]+)/.exec(document.location.pathname); - if(matches && matches[1]) this.next_request= parseInt(matches[1]); - this.insert = $x1("//div[@id='DiscussPhoto']/table/tbody"); - msg = this.localiser.localise('nophoto'); - - xpath = "//div[@id='DiscussPhoto']/table/tbody/tr"; - url = "http://"+document.location.host+unsafeWindow.global_photos[unsafeWindow.page_photo_id].ownersUrl+unsafeWindow.page_photo_id+"/page@P@"; - - } //for the user that faved a shot - else if(matches = /\/photos\/([^\/]+)\/([^\/]+)\/favorites\/?$/.exec(document.location.pathname)) { - var matches2 = /\?page=([0-9]+)$/.exec(document.location.search); - - this.paginator = $x1("//div[@class='Pages']/div[@class='Paginator']"); - var pp = $x1("//div[@class='Pages']/div[@class='Results']"); - this.nbr_page = Math.ceil(this.findTotalPage(pp.innerHTML)/20); - - - if(matches2 && matches2[1]) this.next_request= parseInt(matches[1]); - this.insert = $x1("//table[@id='InBox']/tbody"); - msg = this.localiser.localise('nopeople'); - url = "http://"+document.location.host+matches[0]+"/?page=@P@"; - xpath = "//table[@id='InBox']/tbody/tr"; - } //for the user stream - else if(matches = /\/photos\/([^\/]+)\/?(page([0-9]+))?\/?$/.exec(document.location.pathname)) { - this.paginator = $x1("//div[@class='Pages']/div[@class='Paginator']"); - var pp = $x1("//div[@class='Pages']/div[@class='Results']"); - - if(matches[3]) this.next_request= parseInt(matches[3]); - this.insert = $x1("/html/body/div[3]/table[2]/tbody/tr/td/table"); - var type = 0; - var tot = this.findTotalPage(pp.innerHTML); - if(!this.insert) { - this.insert = $x1("//td[contains(@class,'Big5Column')]"); - type= 1; - if(tot > 5) this.nbr_page = 1+Math.ceil((tot-5)/18); - else this.nbr_page = 1; - } else { - this.nbr_page = Math.ceil(tot/18); - } - msg = this.localiser.localise('nophoto'); - url = "http://"+document.location.host+"/photos/"+matches[1]+"/page@P@"; - xpath = "//tbody/tr/td/table[@width='100%']/tbody/tr"; - if(function() { - for(p in unsafeWindow.global_photos) return true; - return false; - }()) { - additionalBits = function(id,body) { - var photos = new Array(); - foreach("//.[contains(@class,'AutoPageAddition"+self.next_request+"')]//h4[contains(@id,'title_div')]|//.[contains(@class,'AutoPageAddition"+self.next_request+"')]//div[contains(@id,'description_div')]", - function(elt) { - elt.onclick = ''; - elt.onmouseover=''; - elt.onmouseout = ''; - var photo_id = elt.id.replace(/description_div|title_div/,''); - if(photos.indexOf(photo_id) < 0) photos.push(photo_id); - if(!unsafeWindow.global_photos[photo_id]) { - unsafeWindow.global_photos[photo_id] = new Object(); - unsafeWindow.global_photos[photo_id].title = ''; - unsafeWindow.global_photos[photo_id].description = ''; - } - if(elt.id.indexOf('title_div') == 0) { - unsafeWindow.global_photos[photo_id].title = elt.innerHTML.replace('\n',''); - } else { - unsafeWindow.global_photos[photo_id].description = elt.innerHTML.replace('click here to add a description',''); - } - }, - unsafeWindow.document - ); - photos.forEach(function(photo_id,i,a) { - unsafeWindow.insitu_init_page_photos_user_title_div(photo_id,240); - unsafeWindow.insitu_init_page_photos_user_description_div(photo_id,240); - }); - }; - } - }//for set details - else if(matches = /\/photos\/([^\/]+)\/sets\/([^\/]+)\/detail\/?$/.exec(document.location.pathname)) { - - var matches2 = /\?page=([0-9]+)$/.exec(document.location.search); - this.paginator = $x1("//div[@class='Pages']/div[@class='Paginator']"); - var pp = $x1("//div[@class='Pages']/div[@class='Results']"); - var tot = this.findTotalPage(pp.innerHTML); - if(tot > 40) - this.nbr_page = Math.ceil(tot/18); - else - this.nbr_page = Math.ceil(tot/20); - - if(matches2 && matches2[1]) this.next_request= parseInt(matches2[1]); - this.insert = $x1("/html/body/div[3]/table[2]/tbody"); - url = "http://"+document.location.host+"/photos/"+matches[1]+"/sets/"+matches[2]+"/detail/?page=@P@"; - xpath = "//div[@id='Main']/table[@width='100%']/tbody/tr"; - msg = this.localiser.localise('nophoto'); - if(function() { - for(p in unsafeWindow.global_photos) return true; - return false; - }()) { - additionalBits = function(id,body) { - var photos = new Array(); - foreach("//.[contains(@class,'AutoPageAddition"+self.next_request+"')]//h4[contains(@id,'title_div')]|//.[contains(@class,'AutoPageAddition"+self.next_request+"')]//div[contains(@id,'description_div')]", - function(elt) { - elt.onclick = ''; - elt.onmouseover=''; - elt.onmouseout = ''; - var photo_id = elt.id.replace(/description_div|title_div/,''); - if(photos.indexOf(photo_id) < 0) photos.push(photo_id); - if(!unsafeWindow.global_photos[photo_id]) { - unsafeWindow.global_photos[photo_id] = new Object(); - unsafeWindow.global_photos[photo_id].title = ''; - unsafeWindow.global_photos[photo_id].description = ''; - } - if(elt.id.indexOf('title_div') == 0) { - unsafeWindow.global_photos[photo_id].title = elt.innerHTML.replace('\n',''); - } else { - unsafeWindow.global_photos[photo_id].description = elt.innerHTML.replace('click here to add a description',''); - } - }, - unsafeWindow.document - ); - photos.forEach(function(photo_id,i,a) { - unsafeWindow.insitu_init_page_photos_user_title_div(photo_id,240); - unsafeWindow.insitu_init_page_photos_user_description_div(photo_id,240); - }); - }; - } - - } //for set thumbs - else if(matches = /\/photos\/([^\/]+)\/sets\/([^\/]+)\/?$/.exec(document.location.pathname)) { - - var matches2 = /\?page=([0-9]+)$/.exec(document.location.search); - this.paginator = $x1("//div[@class='Pages']/div[@class='Paginator']"); - var pp = $x1("//div[@class='Pages']/div[@class='Results']"); - this.nbr_page = Math.ceil(this.findTotalPage(pp.innerHTML)/60); - - if(matches2 && matches2[1]) this.next_request= parseInt(matches2[1]); - this.insert = document.getElementById('setThumbs'); - url = "http://"+document.location.host+"/photos/"+matches[1]+"/sets/"+matches[2]+"/?page=@P@"; - msg = this.localiser.localise('nophoto'); - xpath = "//div[@id='setThumbs']/a"; - } //for comments on your photos - else if(document.location.pathname == '/recent_activity.gne') { - matches = /(\?days=([0-9]+))?([?&]page=([0-9]+))?$/.exec(document.location.search); - this.paginator = $x1("//div[@class='Pages']/div[@class='Paginator']"); - var pp = $x1("//div[@class='Pages']/div[@class='Results']"); - this.nbr_page = Math.ceil(this.findTotalPage(pp.innerHTML)/10); - - if(matches && matches[4]) this.next_request= parseInt(matches[4]); - this.insert = $x1("//table[@class='RecentActivity']/tbody"); - msg = this.localiser.localise('nocomment'); - url = "http://"+document.location.host+"/recent_activity.gne?page=@P@"; - if(parseInt(matches[2])>0) url += "&days="+matches[2]; - xpath = "//table[@class='RecentActivity']/tbody/tr"; - } //for comments you've made - else if(document.location.pathname == '/photos_comments.gne') { - matches = /\?page=([0-9]+)$/.exec(document.location.search); - this.paginator = $x1("//div[@class='Pages']/div[@class='Paginator']"); - var pp = $x1("//div[@class='Pages']/div[@class='Results']"); - this.nbr_page = Math.ceil(this.findTotalPage(pp.innerHTML)/10); - - if(matches && matches[1]) this.next_request= parseInt(matches[1]); - this.insert = $x1("//table[@class='RecentActivity']/tbody"); - if(this.paginator && this.paginator.parentNode.parentNode.style.display != 'none') { - msg = this.localiser.localise('nocomment'); - url = "http://"+document.location.host+"/photos_comments.gne?page=@P@"; - xpath = "//table[@class='RecentActivity']/tbody/tr"; - } - } //for people search - else if(document.location.pathname == '/search/people/') { - var reg = /[?&]page=([0-9]+)/g; - - var query; - var search = document.location.search; - - if(matches = reg.exec(search)) { - if(matches[1]) this.next_request= parseInt(matches[1]); - search = search.replace(matches[0],''); - } - query = search.replace(/^[?&]/,'?'); - - - this.paginator = $x1("//div[@class='Pages']/div[@class='Paginator']"); - var pp = $x1("//div[@class='Pages']/div[@class='Results']"); - this.nbr_page = Math.ceil(this.findTotalPage(pp.innerHTML)/10); - this.insert = $x1("//table[@class='PeopleResults']/tbody"); - if(this.paginator && query) { - url = "http://"+document.location.host+"/search/people/"+query+"&page=@P@"; - xpath = "//table[@class='PeopleResults']/tbody/tr"; - msg = this.localiser.localise('nopeople'); - } - }//for groups search - else if(document.location.pathname == '/search/groups/') { - var reg = /[?&]page=([0-9]+)/g; - - var query; - var search = document.location.search; - - if(matches = reg.exec(search)) { - if(matches[1]) this.next_request= parseInt(matches[1]); - search = search.replace(matches[0],''); - } - query = search.replace(/^[?&]/,'?'); - - - this.paginator = $x1("//div[@class='Pages']/div[@class='Paginator']"); - var pp = $x1("//div[@class='Pages']/div[@class='Results']"); - url = "http://"+document.location.host+"/search/groups/"+query+"&page=@P@"; - - if(query.indexOf('w=') >= 0) { - if(query.indexOf('m=pool') >= 0) { - msg = this.localiser.localise('nophoto'); - this.nbr_page = Math.ceil(this.findTotalPage(pp.innerHTML)/24); - - if(query.indexOf('z=t') >= 0) { - this.insert = $x1("//div[@class='ResultsThumbs']"); - xpath = "//div[@class='ResultsThumbs']/div"; - } else { - this.insert = $x1("//table[@class='DetailResults']/tbody"); - xpath = "//table[@class='DetailResults']/tbody/tr"; - } - } else { - this.nbr_page = Math.ceil(this.findTotalPage(pp.innerHTML)/15); - this.insert = $x1("//table[@class='DiscussionResults']/tbody"); - msg = this.localiser.localise('notopic'); - xpath = "//table[@class='DiscussionResults']/tbody/tr"; - } - } else { - this.nbr_page = Math.ceil(this.findTotalPage(pp.innerHTML)/15); - this.insert = $x1("//table[@class='GroupsResults']/tbody"); - msg = this.localiser.localise('nogroup'); - xpath = "//table[@class='GroupsResults']/tbody/tr"; - } - }//for help topic search - else if(document.location.pathname == '/search/forum/') { - var reg = /[?&]page=([0-9]+)/g; - - var query; - var search = document.location.search; - - if(matches = reg.exec(search)) { - if(matches[1]) this.next_request= parseInt(matches[1]); - search = search.replace(matches[0],''); - } - query = search.replace(/^[?&]/,'?'); - - - this.paginator = $x1("//div[@class='Pages']/div[@class='Paginator']"); - var pp = $x1("//div[@class='Pages']/div[@class='Results']"); - - this.nbr_page = Math.ceil(this.findTotalPage(pp.innerHTML)/15); - this.insert = $x1("//table[@class='DiscussionResults']/tbody"); - msg = this.localiser.localise('notopic'); - url = "http://"+document.location.host+"/search/forum/"+query+"&page=@P@"; - xpath = "//table[@class='DiscussionResults']/tbody/tr"; - } //for photo search - else if(document.location.pathname == '/search/') { - var reg = /[?&]page=([0-9]+)/g; - - var query; - var search = document.location.search; - - if(matches = reg.exec(search)) { - if(matches[1]) this.next_request= parseInt(matches[1]); - search = search.replace(matches[0],''); - } - query = search.replace(/^[?&]/,'?'); - - - this.paginator = $x1("//div[@class='Pages']/div[@class='Paginator']"); - var pp = $x1("//div[@class='Pages']/div[@class='Results']"); - this.nbr_page = Math.ceil(this.findTotalPage(pp.innerHTML)/24); - - - msg = this.localiser.localise('nophoto'); - url = "http://"+document.location.host+"/search/"+query+"&page=@P@"; - - if(query.indexOf('z=t')>=0) { - this.insert = $x1("//div[@class='ResultsThumbs']"); - xpath = "//div[@class='ResultsThumbs']/div"; - } else { - this.insert = $x1("//table[@class='DetailResults']/tbody"); - xpath = "//table[@class='DetailResults']/tbody/tr"; - } - } //for explore calendar - else if(matches = /\/explore\/interesting\/([0-9\/]+)\/?(page([0-9]+))?/.exec(document.location.pathname)) { - this.paginator = $x1("//div[@class='Pages']/div[@class='Paginator']"); - var pp = $x1("//div[@class='Pages']/div[@class='Results']"); - this.nbr_page = Math.ceil(this.findTotalPage(pp.innerHTML)/10); - - if(matches[3]) this.next_request= parseInt(matches[3]); - this.insert = $x1("//table[@class='DayView']/tbody"); - msg = this.localiser.localise('nophoto'); - url = "http://"+document.location.host+"/explore/interesting/"+matches[1]+"/page@P@"; - xpath ="//table[@class='DayView']/tbody/tr"; - } //for the user favorites - else if(matches = /\/photos\/([^\/]+)\/favorites\/?(page([0-9]+))?\/?$/.exec(document.location.pathname)) { - - this.paginator = $x1("//div[@class='Pages']/div[@class='Paginator']"); - var pp = $x1("//div[@class='Pages']/div[@class='Results']"); - - - if(matches[3]) this.next_request= parseInt(matches[3]); - this.insert = document.getElementById('favoriteThumbs'); - var type = 0; - var tot = this.findTotalPage(pp.innerHTML); - this.nbr_page = Math.ceil(tot/36); - url = "http://"+document.location.host+"/photos/"+matches[1]+"/favorites/page@P@"; - xpath = "//div[@id='favoriteThumbs']/a" - msg = this.localiser.localise('nophoto'); - } //for the list of contacts - else if(matches = /\/people\/([^\/]+)\/contacts\/?$/.exec(document.location.pathname)) { - var matches2 = /[\?&]page=([0-9]+)$/.exec(document.location.search); - this.paginator = $x1("//div[@class='Pages']/div[@class='Paginator']"); - var pp = $x1("//div[@class='Pages']/div[@class='Results']"); - - var query = document.location.search; - if(matches2 && matches2[1]) { - this.next_request= parseInt(matches2[1]); - query = query.replace(matches[0],''); - } - if(query) query+='&'; - else query = '?'; - this.insert = $x1("//table[@class='PeopleResults']/tbody"); - var tot = this.findTotalPage(pp.innerHTML); - this.nbr_page = Math.ceil(tot/30); - - - - url = "http://"+document.location.host+"/people/"+matches[1]+"/contacts/"+query+"page=@P@"; - msg = this.localiser.localise('nocontacts'); - xpath = "//table[@class='PeopleResults']/tbody/tr"; - } //for the reverse list of contacts - else if(matches = /\/people\/([^\/]+)\/contacts\/rev\/?$/.exec(document.location.pathname)) { - var matches2 = /\?page=([0-9]+)$/.exec(document.location.search); - this.paginator = $x1("//div[@class='Pages']/div[@class='Paginator']"); - var pp = $x1("//div[@class='Pages']/div[@class='Results']"); - - if(matches2 && matches2[1]) this.next_request= parseInt(matches2[1]); - this.insert = $x1("//table[@class='PeopleResults']/tbody"); - var tot = this.findTotalPage(pp.innerHTML); - this.nbr_page = Math.ceil(tot/40); - - url = "http://"+document.location.host+"/people/"+matches[1]+"/contacts/rev/?page=@P@"; - msg = this.localiser.localise('nocontacts'); - xpath = "//table[@class='PeopleResults']/tbody/tr"; - } //for the creative commons by - else if(matches = /\/creativecommons\/([^\/]+)\/?(page([0-9]+))?\/?$/.exec(document.location.pathname)) { - this.paginator = $x1("//div[@class='Pages']/div[@class='Paginator']"); - var pp = $x1("//div[@class='Pages']/div[@class='Results']"); - - if(matches[2]) this.next_request= parseInt(matches[2]); - this.insert = $x1("//div[@class='RecentPhotos']"); - var tot = this.findTotalPage(pp.innerHTML); - this.nbr_page = Math.ceil(tot/24); - - url = "http://"+document.location.host+"/creativecommons/"+matches[1]+"/page@P@"; - msg = this.localiser.localise('nocontacts'); - xpath = "//div[@class='RecentPhotos']/p"; - } //for the group members - else if(document.location.pathname == '/groups_members_detail.gne') { - var matches2 = /\?page=([0-9]+)$/.exec(document.location.search); - this.paginator = $x1("//div[@class='Pages']/div[@class='Paginator']"); - var pp = $x1("//div[@class='Pages']/div[@class='Results']"); - - if(matches2 && matches2[1]) this.next_request= parseInt(matches2[1]); - var tot = this.findTotalPage(pp.innerHTML); - this.nbr_page = Math.ceil(tot/30); - - url = "http://"+document.location.host+"/groups_members_detail.gne"+document.location.search+"&page=@P@"; - if(matches2) url.replace(matches2[0],'') - msg = this.localiser.localise('nocontacts'); - var insertBefore = $x1("/html/body/div[@id='Main']/br[@clear='all']"); - var self = this; - cb = function() { - var curl = url.replace('@P@',self.next_request); - if(self.received) { - if(self.next_request > self.nbr_page) { - self.msg_div.innerHTML = self.localiser.localise('showing',{'page':(self.next_request-1),'total':self.nbr_page})+' '+msg; - } else { - if(insertBefore) { - self.next_request++; - M8_log('get'+curl); - self.msg_div.innerHTML = self.localiser.localise('loading',{'nbrpage':(self.next_request-1),'total':self.nbr_page})+'
'; - self.received = false; - self.pullMore(curl, - function(body,insert) { - foreach("//div[@class='MembersList']", - function(elt) { - insertBefore.parentNode.insertBefore(elt,insertBefore); - }, - body - ); - } - ,0); - } - } - } - } - - } - - //for FlickrMail - /* else if(document.location.pathname == '/messages.gne') { - matches = /\?page=([0-9]+)$/.exec(document.location.search); - this.paginator = $x1("//div[@class='Pages']/div[@class='Paginator']"); - var pp = $x1("//div[@class='Pages']/div[@class='Results']"); - this.nbr_page = Math.ceil(this.findTotalPage(pp.innerHTML)/20); - - if(matches && matches[1]) this.next_request= parseInt(matches[1]); - this.insert = document.getElementById('InBox'); - if(this.paginator) { - cb = getObjectMethodClosure(this,'messages_cb'); - msg = 'No more messages'; - } - }*/ - - - if(this.paginator) { - if(!this.msg_div) { - var checkboxDiv = this.paginator.appendChild(document.createElement('div')); - checkboxDiv.id = 'enableScrollContainer'; - checkboxDiv.setAttribute('style','font-size:80%;text-align:left;'); - var checkbox = document.createElement('input'); - checkbox.id = 'enableScroll'; - checkbox.checked = true; - checkbox.type = 'checkbox'; - var self = this; - checkbox.addEventListener('CheckboxStateChange',function() { - if(checkbox.checked) { - setTimeout(self.watch_cb,100); - self.stop_watch = false; - } else { - self.stop_watch = true; - } - },true); - checkboxDiv.appendChild(checkbox); - var label = checkboxDiv.appendChild(document.createElement('label')); - label.htmlFor = 'enableScroll'; - label.innerHTML = this.localiser.localise('enable'); - this.msg_div = this.paginator.appendChild(document.createElement('div')); - this.msg_div.setAttribute('style','font-size:80%;text-align:left;margin-top:10px;'); - } - - this.paginator.parentNode.setAttribute('style', - 'position:fixed;'+ - 'top:100px;'+ - 'left:0;'+ - 'width: 8em;' - ); - var link = $x1("//div[@class='Paginator']//span[text()='"+(this.next_request)+"']"); - var i = 0; - if(link) { - var new_link = link.parentNode.insertBefore(document.createElement('a'),link); - link.style.display = 'none'; - new_link.innerHTML = this.next_request; - new_link.href='#infinitepage'+(this.next_request); - new_link.className += 'this-page'; - } - for(i=0;i +// @include http://*flickr.com/groups/*/pool* +// @include http://*flickr.com/groups/*/admin +// @include http://*flickr.com/groups/*/discuss* +// @include http://*flickr.com/photos/*/* +// @include http://*flickr.com/photos/*/*/sets/*/detail* +// @include http://*flickr.com/recent_activity.gne* +// @include http://*flickr.com/photos_comments.gne* +// @include http://*flickr.com/search* +// @include http://*flickr.com/photos/friends* +// @include http://*flickr.com/help/forum* +// @include http://*flickr.com/explore/intersting/* +// @include http://*flickr.com/people/*/contacts* +// @include http://*flickr.com/creativecommons/* +// @include http://*flickr.com/groups_members_detail.gne* +// @exclude http://*flickr.com/*#disableautopage + +// ==/UserScript== + +//TODO javascript oddness +//TODO new photo + +(function () { + + var THRESHOLD = 340; + if(matches = /\/photos\/friends\/?(page([0-9]+))?\/?$/.exec(document.location.pathname)) { + THRESHOLD = 100; + } + + var win = window; + + //update information + var SCRIPT = { + name: "Flickr Auto Page", + namespace: "http://6v8.gamboni.org/Flickr-Auto-Pagination.html", + description: "removes the need to paginate when browsing flickr.", + source: "http://6v8.gamboni.org/Flickr-Auto-Page.html", // script homepage/description URL + identifier: "http://6v8.gamboni.org/IMG/js/flickrautopage.user.js", + version: "0.99", // version + date: (new Date(2007, 07,22)) // update date + .valueOf() + }; + + //====================================================================== + //to do the closure and get the right this. + //adapted from http://persistent.info/greasemonkey/gmail.user.js + + function getObjectMethodClosure3(object, method,args,args1,args2,args3) { + return function() { + return object[method](args,args1,args2,args3); + } + } + function getObjectMethodClosure2(object, method,args,args1,args2) { + return function() { + return object[method](args,args1,args2); + } + } + function getObjectMethodClosure1(object, method,args,args1) { + return function() { + return object[method](args,args1); + } + } + + function getObjectMethodClosure0(object, method,args) { + return function() { + return object[method](args); + } + } + + function getObjectMethodClosure(object, method) { + return function(args) { + return object[method](args); + } + } + + /* + Xpath trickery, from: + http://ecmanaut.blogspot.com/2006/07/expressive-user-scripts-with-xpath-and.html + */ + function $x( xpath, root ) + { + var doc = root ? root.evaluate?root:root.ownerDocument : document; + var got = doc.evaluate( xpath, root||doc, null, 0, null ), next; + var result = []; + while( next = got.iterateNext() ) + result.push( next ); + return result; + } + + + function $x1(xpath) { + return document.evaluate( + xpath, + document, + null, + XPathResult.FIRST_ORDERED_NODE_TYPE, null + ).singleNodeValue; + } + + function foreach( xpath, cb, root ) + { + var nodes = $x( xpath, root ), e = 0; + for( var i=0; i= 0) self.insert.innerHTML += '
'; + + if(self.insert) { + var anchor = self.insert.appendChild(document.createElement('a')); + anchor.name = 'infinitepage'+(self.next_request-1); + } + var b = iframe.contentDocument.body; + + //self.insert.innerHTML = + processReply(b, self.insert); + + self.received = true; + var link; + switch(special) { + case 1: + link = $x1("//div[@id='Pages']//div[@class='Paginator']//a[text()='"+(self.next_request-1)+"']"); + break; + default: + link = $x1("//div[@class='Paginator']//a[text()='"+(self.next_request-1)+"']"); + } + if(!link) { + switch(special) { + case 1: + link = $x1("//div[@id='Pages']//div[@class='Paginator']//span[text()='...']"); + break; + default: + link = $x1("//div[@class='Paginator']//span[text()='...']"); + } + var a = link.parentNode.insertBefore(document.createElement('a'),link); + a.className = 'this-page'; + a.setAttribute('style',"margin: 0pt; display: block; width: 2em;"); + a.href='#infinitepage'+(self.next_request-1); + a.innerHTML = (self.next_request-1); + } else { + link.href='#infinitepage'+(self.next_request-1); + link.className += 'this-page'; + } + self.first = false; + + if(matches = /\/photos\/friends\/?(page([0-9]+))?\/?$/.exec(document.location.pathname)) + document.location.hash = 'infinitepage'+(self.next_request-1); + //get rid of iframe + setTimeout( function() { iframe.parentNode.removeChild(iframe); }, 1500); + }, false); + iframe.src = url+'#disableautopage'; + }, + + cb_shortcut: function(url,msg,processReply,special) { + if(this.received) { + if(this.next_request > this.nbr_page) { + this.msg_div.innerHTML = self.localiser.localise('showing',{'page':(self.next_request-1),'total':self.nbr_page})+' '+msg; + } else if(this.insert) { + this.next_request++; + var self = this; + M8_log('get'+url); + this.msg_div.innerHTML = this.localiser.localise('loading',{ + 'nbrpage':(this.next_request-1), + 'total': this.nbr_page + })+ '
'; + this.received = false; + this.pullMore(url,processReply,special); + } + + } + }, + + generic_cb: function(msg,url,xpath,additionalBits) { + url = url.replace('@P@',this.next_request); + var self = this; + var processReply = function(body,insert) { + //move the elements + var cnt = 0; + + foreach(xpath, + function(elt) { + cnt++; + var node = document.importNode(elt,true); + insert.appendChild(node); + elt.className += ' AutoPageAddition'+self.next_request; + }, + body + ); + + //fix the buddy icons over for the moved element + foreach("//.[contains(@class,'AutoPageAddition"+self.next_request+"')]//img[contains(@src,'buddyicon')]", + function(img) { + img.addEventListener('mouseover',getObjectMethodClosure(unsafeWindow.document.getElementById('person_hover'),'icon_mouseover'),true); + img.addEventListener('mouseout',getObjectMethodClosure(unsafeWindow.document.getElementById("person_hover"),'icon_mouseout'),true); + var nsid = '' + if(img.src.indexOf('buddyicon.jpg') >= 0) { + nsid = img.src.replace(/.*\?/,''); + } else { + nsid = img.src.replace(/.*\/(.*)\.jpg(\?.*)?$/,'$1'); + } + img.nsid = nsid; + var hover; + var hover_insert = document.getElementById("person_hover_link") + if(!document.getElementById('hover_img'+nsid) && (hover = body.ownerDocument.getElementById('hover_img'+nsid))) { + hover_insert.appendChild(hover); + } + },document); + additionalBits("AutoPageAddition"+self.next_request,body); + } + this.cb_shortcut(url,msg,processReply); + }, + + /* messages_cb: function(query) { + var msg = 'No More Messages'; + url = "http://"+document.location.host+"/messages.gne?ok=1&page="+(this.next_request); + + var processReply = function(text,html) { + var start = 0; + var end = 0; + + + start = text.indexOf(''); + start+=47; + end = text.indexOf('
',start); + text = text.slice(start,end); + + html +=text; + return html; + } + this.cb_shortcut(url,msg,processReply); + },*/ + + + init: function() { + var matches; + var cb = undefined; + var msg; + var url; + var xpath; + var special = 0; + var additionalBits = function() {}; + + //for the group pool + if(matches = /\/groups\/(.*)\/pool\/?(page([0-9]+))?\/?$/.exec(document.location.pathname)) { + + this.paginator = $x1("//div[@class='Pages']/div[@class='Paginator']"); + var pp = $x1("//div[@class='Pages']/div[@class='Results']"); + this.nbr_page = Math.ceil(this.findTotalPage(pp.innerHTML)/30); + + if(matches[3]) this.next_request= parseInt(matches[3]); + this.insert = $x1("//div[@class='HoldPhotos']"); + msg = this.localiser.localise('nophoto'); + url = "http://"+document.location.host+"/groups/"+matches[1]+"/pool/page@P@"; + xpath = "//div[@class='HoldPhotos']/p"; + } //for the group discuss + else if(matches = /\/groups\/(.*)\/discuss\/?(page([0-9]+))?\/?$/.exec(document.location.pathname)) { + + this.paginator = $x1("//div[@class='Pages']/div[@class='Paginator']"); + var pp = $x1("//div[@class='Pages']/div[@class='Results']"); + this.nbr_page = Math.ceil(this.findTotalPage(pp.innerHTML)/20); + + if(matches[3]) this.next_request= parseInt(matches[3]); + this.insert = $x1("//table[@class='TopicListing']/tbody"); + + url = "http://"+document.location.host+"/groups/"+matches[1]+"/discuss/page@P@"; + msg = this.localiser.localise('nodiscussion'); + xpath = "//table[@class='TopicListing']/tbody/tr"; + } //for the group topics + else if(matches = /\/groups\/(.*)\/discuss\/([0-9]+)\/?(page([0-9]+))?\/?$/.exec(document.location.pathname)) { + special = 1; + var otherpage = $x1("//div[@id='DiscussTopic']/div[@class='Pages']/div[@class='Paginator']"); + if(otherpage) { + otherpage.className = ''; + otherpage.parentNode.style.display = 'none'; + } + this.paginator = $x1("//div[@id='Pages']/div/div[@class='Paginator']"); + var pp = $x1("//div[@id='Pages']/div/div[@class='Results']"); + this.nbr_page = Math.ceil(this.findTotalPage(pp.innerHTML)/100); + + if(matches[4]) this.next_request= parseInt(matches[4]); + this.insert = $x1("//table[@class='TopicReply']/tbody"); + + msg = this.localiser.localise('noreply'); + url = "http://"+document.location.host+"/groups/"+matches[1]+"/discuss/"+matches[2]+"/page@P@"; + xpath = "//table[@class='TopicReply']/tbody/tr"; + } //for the help topics + else if(matches = /\/help\/forum\/([A-Za-z-]+)\/([0-9]+)\/?(page([0-9]+))?\/?$/.exec(document.location.pathname)) { + special = 2; + var otherpage = $x1("//div[@id='DiscussTopic']/div[@class='Pages']/div[@class='Paginator']"); + if(otherpage) { + otherpage.className = ''; + otherpage.parentNode.style.display = 'none'; + } + this.paginator = $x1("//div[@class='Pages']/div[@class='Paginator']"); + + var pp = $x1("//div[@class='Pages']//div[@class='Results']"); + this.nbr_page = Math.ceil(this.findTotalPage(pp.innerHTML)/100); + + if(matches[4]) this.next_request= parseInt(matches[4]); + this.insert = $x1("//table[@class='TopicReply']/tbody"); + url = "http://"+document.location.host+"/help/forum/"+matches[1]+'/'+matches[2]+"/page@P@"; + xpath = "//table[@class='TopicReply']/tbody/tr"; + msg = this.localiser.localise('nodiscussion'); + } //for the help forum + else if(document.location.pathname.indexOf('/help/forum') >= 0) { + matches = /([?&]page=([0-9]+))?/.exec(document.location.search); + + this.paginator = $x1("//div[@class='Pages']/div[@class='Paginator']"); + var as = this.paginator.getElementsByTagName('a'); + var lang = 'en-us'; + if(as && as.length >0) { + var tmp = /\/help\/forum\/([^\/]+)\//.exec(as[0].href); + if(tmp) lang = tmp[1]; + } + + var pp = $x1("//div[@class='Pages']/div[@class='Results']"); + this.nbr_page = Math.ceil(this.findTotalPage(pp.innerHTML)/20); + + this.insert = $x1("//table[@class='TopicListing'][2]/tbody"); + if(matches[3]) this.next_request= parseInt(matches[2]); + msg = this.localiser.localise('noreply'); + url = "http://"+document.location.host+"/help/forum/"+lang+"/?page=@P@"; + xpath = "//table[@class='TopicListing']/tbody/tr"; + } //for the contacts photo + else if(matches = /\/photos\/friends\/?(page([0-9]+))?\/?$/.exec(document.location.pathname)) { + this.paginator = $x1("//div[@class='Pages']/div[@class='Paginator']"); + var pp = $x1("//div[@class='Pages']/div[@class='Results']"); + this.nbr_page = Math.ceil(this.findTotalPage(pp.innerHTML)/24); + + if(matches[2]) this.next_request= parseInt(matches[2]); + this.insert = $x1("//div[@class='HoldPhotos']"); + url = "http://"+document.location.host+"/photos/friends/page@P@"; + xpath = "//div[@class='HoldPhotos']/p"; + msg = this.localiser.localise('nophoto'); + } //for everyone's tag + else if(matches = /\/photos\/tags\/([^\/]+)\/?(interesting)?\/?$/.exec(document.location.pathname)) { + + var matches2 = /\?page=([0-9]+)$/.exec(document.location.search); + + this.paginator = $x1("//div[@class='Pages']/div[@class='Paginator']"); + var pp = $x1("//div[@class='Pages']/div[@class='Results']"); + this.nbr_page = Math.ceil(this.findTotalPage(pp.innerHTML)/20); + + if(matches2 && matches2[1]) this.next_request= parseInt(matches2[1]); + this.insert = $x1("//td[@id='GoodStuff']/div"); + url = "http://"+document.location.host+"/photos/tags/"+matches[1]; + if(matches[2]) url += "/interesting" + url += "/?page=@P@"; + msg = this.localiser.localise('nophoto'); + xpath = "//td[@id='GoodStuff']/div/p"; + } //for tag cluster + else if(matches = /\/photos\/tags\/([^\/]+)\/clusters\/([^\/]+)\/?(page([0-9]+))?\/?$/.exec(document.location.pathname)) { + + this.paginator = $x1("//div[@class='Pages']/div[@class='Paginator']"); + var pp = $x1("//div[@class='Pages']/div[@class='Results']"); + this.nbr_page = Math.ceil(this.findTotalPage(pp.innerHTML)/20); + + if(matches[3]) this.next_request= parseInt(matches[3]); + this.insert = $x1("//div[@id='tagThumbs']"); + M8_log(this.insert); + url = "http://"+document.location.host+"/photos/tags/"+matches[1]+"/clusters/"+matches[2]+"/page@P@"; + msg = this.localiser.localise('nophoto'); + xpath = "//div[@id='tagThumbs']/p"; + } //for user's tag + else if(matches = /\/photos\/([^\/]+)\/tags\/([^\/]+)\/?(page([0-9]+))?\/?$/.exec(document.location.pathname)) { + + this.paginator = $x1("//div[@class='Pages']/div[@class='Paginator']"); + var pp = $x1("//div[@class='Pages']/div[@class='Results']"); + this.nbr_page = Math.ceil(this.findTotalPage(pp.innerHTML)/20); + + if(matches[4]) this.next_request= parseInt(matches[4]); + this.insert = $x1("//td[@id='GoodStuff']/div"); + url = "http://"+document.location.host+"/photos/"+matches[1]+"/tags/"+matches[2]+"/page@P@"; + msg = this.localiser.localise('nophoto'); + xpath = "//td[@id='GoodStuff']/div/p"; + } //for interesting-popular page + else if(matches = /\/photos\/([^\/]+)\/popular-interesting\/?(page([0-9]+))?\/?$/.exec(document.location.pathname)) { + + this.paginator = $x1("//div[@class='Pages']/div[@class='Paginator']"); + var pp = $x1("//div[@class='Pages']/div[@class='Results']"); + this.nbr_page = Math.ceil(this.findTotalPage(pp.innerHTML)/20); + + if(matches[2]) this.next_request= parseInt(matches[2]); + this.insert = $x1("//table[@class='PopularPic']/tbody"); + url = "http://"+document.location.host+"/photos/"+matches[1]+"/popular-interesting/page@P@"; + + msg = this.localiser.localise('nophoto'); + xpath = "//table[@class='PopularPic']/tbody/tr"; + } //for popular-view page + else if(matches = /\/photos\/([^\/]+)\/popular-views\/?(page([0-9]+))?\/?$/.exec(document.location.pathname)) { + + this.paginator = $x1("//div[@class='Pages']/div[@class='Paginator']"); + var pp = $x1("//div[@class='Pages']/div[@class='Results']"); + this.nbr_page = Math.ceil(this.findTotalPage(pp.innerHTML)/20); + + if(matches[2]) this.next_request= parseInt(matches[2]); + this.insert = $x1("//table[@class='PopularPic']/tbody"); + url = "http://"+document.location.host+"/photos/"+matches[1]+"/popular-views/page@P@"; + msg = this.localiser.localise('nophoto'); + xpath = "//table[@class='PopularPic']/tbody/tr"; + } //for popular-comments page + else if(matches = /\/photos\/([^\/]+)\/popular-comments\/?(page([0-9]+))?\/?$/.exec(document.location.pathname)) { + + this.paginator = $x1("//div[@class='Pages']/div[@class='Paginator']"); + var pp = $x1("//div[@class='Pages']/div[@class='Results']"); + this.nbr_page = Math.ceil(this.findTotalPage(pp.innerHTML)/20); + + if(matches[2]) this.next_request= parseInt(matches[2]); + this.insert = $x1("//table[@class='PopularPic']/tbody"); + url = "http://"+document.location.host+"/photos/"+matches[1]+"/popular-comments/page@P@"; + + msg = this.localiser.localise('nophoto'); + xpath = "//table[@class='PopularPic']/tbody/tr"; + } //for popular-faves page + else if(matches = /\/photos\/([^\/]+)\/popular-faves\/?(page([0-9]+))?\/?$/.exec(document.location.pathname)) { + + this.paginator = $x1("//div[@class='Pages']/div[@class='Paginator']"); + var pp = $x1("//div[@class='Pages']/div[@class='Results']"); + this.nbr_page = Math.ceil(this.findTotalPage(pp.innerHTML)/20); + + if(matches[2]) this.next_request= parseInt(matches[2]); + this.insert = $x1("//table[@class='PopularPic']/tbody"); + url = "http://"+document.location.host+"/photos/"+matches[1]+"/popular-faves/page@P@"; + msg = this.localiser.localise('nophoto'); + xpath = "//table[@class='PopularPic']/tbody/tr"; + } //for comments on a photo + else if(unsafeWindow.page_photo_id) { + + special = 3; + var otherpage = $x1("//div[@id='DiscussPhoto']/div[@class='Pages']/div[@class='Paginator']"); + if(otherpage) { + otherpage.className = ''; + otherpage.parentNode.style.display = 'none'; + } + + + this.paginator = $x1("//div[@class='Pages']/div[@class='Paginator']"); + var pp = $x1("//div[@class='Pages']/div[@class='Results']"); + this.nbr_page = Math.ceil(this.findTotalPage(pp.innerHTML)/100); + + matches = /\/page([0-9]+)/.exec(document.location.pathname); + if(matches && matches[1]) this.next_request= parseInt(matches[1]); + this.insert = $x1("//div[@id='DiscussPhoto']/table/tbody"); + msg = this.localiser.localise('nophoto'); + + xpath = "//div[@id='DiscussPhoto']/table/tbody/tr"; + url = "http://"+document.location.host+unsafeWindow.global_photos[unsafeWindow.page_photo_id].ownersUrl+unsafeWindow.page_photo_id+"/page@P@"; + + } //for the user that faved a shot + else if(matches = /\/photos\/([^\/]+)\/([^\/]+)\/favorites\/?$/.exec(document.location.pathname)) { + var matches2 = /\?page=([0-9]+)$/.exec(document.location.search); + + this.paginator = $x1("//div[@class='Pages']/div[@class='Paginator']"); + var pp = $x1("//div[@class='Pages']/div[@class='Results']"); + this.nbr_page = Math.ceil(this.findTotalPage(pp.innerHTML)/20); + + + if(matches2 && matches2[1]) this.next_request= parseInt(matches[1]); + this.insert = $x1("//table[@id='InBox']/tbody"); + msg = this.localiser.localise('nopeople'); + url = "http://"+document.location.host+matches[0]+"/?page=@P@"; + xpath = "//table[@id='InBox']/tbody/tr"; + } //for the user stream + else if(matches = /\/photos\/([^\/]+)\/?(page([0-9]+))?\/?$/.exec(document.location.pathname)) { + this.paginator = $x1("//div[@class='Pages']/div[@class='Paginator']"); + var pp = $x1("//div[@class='Pages']/div[@class='Results']"); + + if(matches[3]) this.next_request= parseInt(matches[3]); + this.insert = $x1("/html/body/div[3]/table[2]/tbody/tr/td/table"); + var type = 0; + var tot = this.findTotalPage(pp.innerHTML); + if(!this.insert) { + this.insert = $x1("//td[contains(@class,'Big5Column')]"); + type= 1; + if(tot > 5) this.nbr_page = 1+Math.ceil((tot-5)/18); + else this.nbr_page = 1; + } else { + this.nbr_page = Math.ceil(tot/18); + } + msg = this.localiser.localise('nophoto'); + url = "http://"+document.location.host+"/photos/"+matches[1]+"/page@P@"; + xpath = "//tbody/tr/td/table[@width='100%']/tbody/tr"; + if(function() { + for(p in unsafeWindow.global_photos) return true; + return false; + }()) { + additionalBits = function(id,body) { + var photos = new Array(); + foreach("//.[contains(@class,'AutoPageAddition"+self.next_request+"')]//h4[contains(@id,'title_div')]|//.[contains(@class,'AutoPageAddition"+self.next_request+"')]//div[contains(@id,'description_div')]", + function(elt) { + elt.onclick = ''; + elt.onmouseover=''; + elt.onmouseout = ''; + var photo_id = elt.id.replace(/description_div|title_div/,''); + if(photos.indexOf(photo_id) < 0) photos.push(photo_id); + if(!unsafeWindow.global_photos[photo_id]) { + unsafeWindow.global_photos[photo_id] = new Object(); + unsafeWindow.global_photos[photo_id].title = ''; + unsafeWindow.global_photos[photo_id].description = ''; + } + if(elt.id.indexOf('title_div') == 0) { + unsafeWindow.global_photos[photo_id].title = elt.innerHTML.replace('\n',''); + } else { + unsafeWindow.global_photos[photo_id].description = elt.innerHTML.replace('click here to add a description',''); + } + }, + unsafeWindow.document + ); + photos.forEach(function(photo_id,i,a) { + unsafeWindow.insitu_init_page_photos_user_title_div(photo_id,240); + unsafeWindow.insitu_init_page_photos_user_description_div(photo_id,240); + }); + }; + } + }//for set details + else if(matches = /\/photos\/([^\/]+)\/sets\/([^\/]+)\/detail\/?$/.exec(document.location.pathname)) { + + var matches2 = /\?page=([0-9]+)$/.exec(document.location.search); + this.paginator = $x1("//div[@class='Pages']/div[@class='Paginator']"); + var pp = $x1("//div[@class='Pages']/div[@class='Results']"); + var tot = this.findTotalPage(pp.innerHTML); + if(tot > 40) + this.nbr_page = Math.ceil(tot/18); + else + this.nbr_page = Math.ceil(tot/20); + + if(matches2 && matches2[1]) this.next_request= parseInt(matches2[1]); + this.insert = $x1("/html/body/div[3]/table[2]/tbody"); + url = "http://"+document.location.host+"/photos/"+matches[1]+"/sets/"+matches[2]+"/detail/?page=@P@"; + xpath = "//div[@id='Main']/table[@width='100%']/tbody/tr"; + msg = this.localiser.localise('nophoto'); + if(function() { + for(p in unsafeWindow.global_photos) return true; + return false; + }()) { + additionalBits = function(id,body) { + var photos = new Array(); + foreach("//.[contains(@class,'AutoPageAddition"+self.next_request+"')]//h4[contains(@id,'title_div')]|//.[contains(@class,'AutoPageAddition"+self.next_request+"')]//div[contains(@id,'description_div')]", + function(elt) { + elt.onclick = ''; + elt.onmouseover=''; + elt.onmouseout = ''; + var photo_id = elt.id.replace(/description_div|title_div/,''); + if(photos.indexOf(photo_id) < 0) photos.push(photo_id); + if(!unsafeWindow.global_photos[photo_id]) { + unsafeWindow.global_photos[photo_id] = new Object(); + unsafeWindow.global_photos[photo_id].title = ''; + unsafeWindow.global_photos[photo_id].description = ''; + } + if(elt.id.indexOf('title_div') == 0) { + unsafeWindow.global_photos[photo_id].title = elt.innerHTML.replace('\n',''); + } else { + unsafeWindow.global_photos[photo_id].description = elt.innerHTML.replace('click here to add a description',''); + } + }, + unsafeWindow.document + ); + photos.forEach(function(photo_id,i,a) { + unsafeWindow.insitu_init_page_photos_user_title_div(photo_id,240); + unsafeWindow.insitu_init_page_photos_user_description_div(photo_id,240); + }); + }; + } + + } //for set thumbs + else if(matches = /\/photos\/([^\/]+)\/sets\/([^\/]+)\/?$/.exec(document.location.pathname)) { + + var matches2 = /\?page=([0-9]+)$/.exec(document.location.search); + this.paginator = $x1("//div[@class='Pages']/div[@class='Paginator']"); + var pp = $x1("//div[@class='Pages']/div[@class='Results']"); + this.nbr_page = Math.ceil(this.findTotalPage(pp.innerHTML)/60); + + if(matches2 && matches2[1]) this.next_request= parseInt(matches2[1]); + this.insert = document.getElementById('setThumbs'); + url = "http://"+document.location.host+"/photos/"+matches[1]+"/sets/"+matches[2]+"/?page=@P@"; + msg = this.localiser.localise('nophoto'); + xpath = "//div[@id='setThumbs']/a"; + } //for comments on your photos + else if(document.location.pathname == '/recent_activity.gne') { + matches = /(\?days=([0-9]+))?([?&]page=([0-9]+))?$/.exec(document.location.search); + this.paginator = $x1("//div[@class='Pages']/div[@class='Paginator']"); + var pp = $x1("//div[@class='Pages']/div[@class='Results']"); + this.nbr_page = Math.ceil(this.findTotalPage(pp.innerHTML)/10); + + if(matches && matches[4]) this.next_request= parseInt(matches[4]); + this.insert = $x1("//table[@class='RecentActivity']/tbody"); + msg = this.localiser.localise('nocomment'); + url = "http://"+document.location.host+"/recent_activity.gne?page=@P@"; + if(parseInt(matches[2])>0) url += "&days="+matches[2]; + xpath = "//table[@class='RecentActivity']/tbody/tr"; + } //for comments you've made + else if(document.location.pathname == '/photos_comments.gne') { + matches = /\?page=([0-9]+)$/.exec(document.location.search); + this.paginator = $x1("//div[@class='Pages']/div[@class='Paginator']"); + var pp = $x1("//div[@class='Pages']/div[@class='Results']"); + this.nbr_page = Math.ceil(this.findTotalPage(pp.innerHTML)/10); + + if(matches && matches[1]) this.next_request= parseInt(matches[1]); + this.insert = $x1("//table[@class='RecentActivity']/tbody"); + if(this.paginator && this.paginator.parentNode.parentNode.style.display != 'none') { + msg = this.localiser.localise('nocomment'); + url = "http://"+document.location.host+"/photos_comments.gne?page=@P@"; + xpath = "//table[@class='RecentActivity']/tbody/tr"; + } + } //for people search + else if(document.location.pathname == '/search/people/') { + var reg = /[?&]page=([0-9]+)/g; + + var query; + var search = document.location.search; + + if(matches = reg.exec(search)) { + if(matches[1]) this.next_request= parseInt(matches[1]); + search = search.replace(matches[0],''); + } + query = search.replace(/^[?&]/,'?'); + + + this.paginator = $x1("//div[@class='Pages']/div[@class='Paginator']"); + var pp = $x1("//div[@class='Pages']/div[@class='Results']"); + this.nbr_page = Math.ceil(this.findTotalPage(pp.innerHTML)/10); + this.insert = $x1("//table[@class='PeopleResults']/tbody"); + if(this.paginator && query) { + url = "http://"+document.location.host+"/search/people/"+query+"&page=@P@"; + xpath = "//table[@class='PeopleResults']/tbody/tr"; + msg = this.localiser.localise('nopeople'); + } + }//for groups search + else if(document.location.pathname == '/search/groups/') { + var reg = /[?&]page=([0-9]+)/g; + + var query; + var search = document.location.search; + + if(matches = reg.exec(search)) { + if(matches[1]) this.next_request= parseInt(matches[1]); + search = search.replace(matches[0],''); + } + query = search.replace(/^[?&]/,'?'); + + + this.paginator = $x1("//div[@class='Pages']/div[@class='Paginator']"); + var pp = $x1("//div[@class='Pages']/div[@class='Results']"); + url = "http://"+document.location.host+"/search/groups/"+query+"&page=@P@"; + + if(query.indexOf('w=') >= 0) { + if(query.indexOf('m=pool') >= 0) { + msg = this.localiser.localise('nophoto'); + this.nbr_page = Math.ceil(this.findTotalPage(pp.innerHTML)/24); + + if(query.indexOf('z=t') >= 0) { + this.insert = $x1("//div[@class='ResultsThumbs']"); + xpath = "//div[@class='ResultsThumbs']/div"; + } else { + this.insert = $x1("//table[@class='DetailResults']/tbody"); + xpath = "//table[@class='DetailResults']/tbody/tr"; + } + } else { + this.nbr_page = Math.ceil(this.findTotalPage(pp.innerHTML)/15); + this.insert = $x1("//table[@class='DiscussionResults']/tbody"); + msg = this.localiser.localise('notopic'); + xpath = "//table[@class='DiscussionResults']/tbody/tr"; + } + } else { + this.nbr_page = Math.ceil(this.findTotalPage(pp.innerHTML)/15); + this.insert = $x1("//table[@class='GroupsResults']/tbody"); + msg = this.localiser.localise('nogroup'); + xpath = "//table[@class='GroupsResults']/tbody/tr"; + } + }//for help topic search + else if(document.location.pathname == '/search/forum/') { + var reg = /[?&]page=([0-9]+)/g; + + var query; + var search = document.location.search; + + if(matches = reg.exec(search)) { + if(matches[1]) this.next_request= parseInt(matches[1]); + search = search.replace(matches[0],''); + } + query = search.replace(/^[?&]/,'?'); + + + this.paginator = $x1("//div[@class='Pages']/div[@class='Paginator']"); + var pp = $x1("//div[@class='Pages']/div[@class='Results']"); + + this.nbr_page = Math.ceil(this.findTotalPage(pp.innerHTML)/15); + this.insert = $x1("//table[@class='DiscussionResults']/tbody"); + msg = this.localiser.localise('notopic'); + url = "http://"+document.location.host+"/search/forum/"+query+"&page=@P@"; + xpath = "//table[@class='DiscussionResults']/tbody/tr"; + } //for photo search + else if(document.location.pathname == '/search/') { + var reg = /[?&]page=([0-9]+)/g; + + var query; + var search = document.location.search; + + if(matches = reg.exec(search)) { + if(matches[1]) this.next_request= parseInt(matches[1]); + search = search.replace(matches[0],''); + } + query = search.replace(/^[?&]/,'?'); + + + this.paginator = $x1("//div[@class='Pages']/div[@class='Paginator']"); + var pp = $x1("//div[@class='Pages']/div[@class='Results']"); + this.nbr_page = Math.ceil(this.findTotalPage(pp.innerHTML)/24); + + + msg = this.localiser.localise('nophoto'); + url = "http://"+document.location.host+"/search/"+query+"&page=@P@"; + + if(query.indexOf('z=t')>=0) { + this.insert = $x1("//div[@class='ResultsThumbs']"); + xpath = "//div[@class='ResultsThumbs']/div"; + } else { + this.insert = $x1("//table[@class='DetailResults']/tbody"); + xpath = "//table[@class='DetailResults']/tbody/tr"; + } + } //for explore calendar + else if(matches = /\/explore\/interesting\/([0-9\/]+)\/?(page([0-9]+))?/.exec(document.location.pathname)) { + this.paginator = $x1("//div[@class='Pages']/div[@class='Paginator']"); + var pp = $x1("//div[@class='Pages']/div[@class='Results']"); + this.nbr_page = Math.ceil(this.findTotalPage(pp.innerHTML)/10); + + if(matches[3]) this.next_request= parseInt(matches[3]); + this.insert = $x1("//table[@class='DayView']/tbody"); + msg = this.localiser.localise('nophoto'); + url = "http://"+document.location.host+"/explore/interesting/"+matches[1]+"/page@P@"; + xpath ="//table[@class='DayView']/tbody/tr"; + } //for the user favorites + else if(matches = /\/photos\/([^\/]+)\/favorites\/?(page([0-9]+))?\/?$/.exec(document.location.pathname)) { + + this.paginator = $x1("//div[@class='Pages']/div[@class='Paginator']"); + var pp = $x1("//div[@class='Pages']/div[@class='Results']"); + + + if(matches[3]) this.next_request= parseInt(matches[3]); + this.insert = document.getElementById('favoriteThumbs'); + var type = 0; + var tot = this.findTotalPage(pp.innerHTML); + this.nbr_page = Math.ceil(tot/36); + url = "http://"+document.location.host+"/photos/"+matches[1]+"/favorites/page@P@"; + xpath = "//div[@id='favoriteThumbs']/a" + msg = this.localiser.localise('nophoto'); + } //for the list of contacts + else if(matches = /\/people\/([^\/]+)\/contacts\/?$/.exec(document.location.pathname)) { + var matches2 = /[\?&]page=([0-9]+)$/.exec(document.location.search); + this.paginator = $x1("//div[@class='Pages']/div[@class='Paginator']"); + var pp = $x1("//div[@class='Pages']/div[@class='Results']"); + + var query = document.location.search; + if(matches2 && matches2[1]) { + this.next_request= parseInt(matches2[1]); + query = query.replace(matches[0],''); + } + if(query) query+='&'; + else query = '?'; + this.insert = $x1("//table[@class='PeopleResults']/tbody"); + var tot = this.findTotalPage(pp.innerHTML); + this.nbr_page = Math.ceil(tot/30); + + + + url = "http://"+document.location.host+"/people/"+matches[1]+"/contacts/"+query+"page=@P@"; + msg = this.localiser.localise('nocontacts'); + xpath = "//table[@class='PeopleResults']/tbody/tr"; + } //for the reverse list of contacts + else if(matches = /\/people\/([^\/]+)\/contacts\/rev\/?$/.exec(document.location.pathname)) { + var matches2 = /\?page=([0-9]+)$/.exec(document.location.search); + this.paginator = $x1("//div[@class='Pages']/div[@class='Paginator']"); + var pp = $x1("//div[@class='Pages']/div[@class='Results']"); + + if(matches2 && matches2[1]) this.next_request= parseInt(matches2[1]); + this.insert = $x1("//table[@class='PeopleResults']/tbody"); + var tot = this.findTotalPage(pp.innerHTML); + this.nbr_page = Math.ceil(tot/40); + + url = "http://"+document.location.host+"/people/"+matches[1]+"/contacts/rev/?page=@P@"; + msg = this.localiser.localise('nocontacts'); + xpath = "//table[@class='PeopleResults']/tbody/tr"; + } //for the creative commons by + else if(matches = /\/creativecommons\/([^\/]+)\/?(page([0-9]+))?\/?$/.exec(document.location.pathname)) { + this.paginator = $x1("//div[@class='Pages']/div[@class='Paginator']"); + var pp = $x1("//div[@class='Pages']/div[@class='Results']"); + + if(matches[2]) this.next_request= parseInt(matches[2]); + this.insert = $x1("//div[@class='RecentPhotos']"); + var tot = this.findTotalPage(pp.innerHTML); + this.nbr_page = Math.ceil(tot/24); + + url = "http://"+document.location.host+"/creativecommons/"+matches[1]+"/page@P@"; + msg = this.localiser.localise('nocontacts'); + xpath = "//div[@class='RecentPhotos']/p"; + } //for the group members + else if(document.location.pathname == '/groups_members_detail.gne') { + var matches2 = /\?page=([0-9]+)$/.exec(document.location.search); + this.paginator = $x1("//div[@class='Pages']/div[@class='Paginator']"); + var pp = $x1("//div[@class='Pages']/div[@class='Results']"); + + if(matches2 && matches2[1]) this.next_request= parseInt(matches2[1]); + var tot = this.findTotalPage(pp.innerHTML); + this.nbr_page = Math.ceil(tot/30); + + url = "http://"+document.location.host+"/groups_members_detail.gne"+document.location.search+"&page=@P@"; + if(matches2) url.replace(matches2[0],'') + msg = this.localiser.localise('nocontacts'); + var insertBefore = $x1("/html/body/div[@id='Main']/br[@clear='all']"); + var self = this; + cb = function() { + var curl = url.replace('@P@',self.next_request); + if(self.received) { + if(self.next_request > self.nbr_page) { + self.msg_div.innerHTML = self.localiser.localise('showing',{'page':(self.next_request-1),'total':self.nbr_page})+' '+msg; + } else { + if(insertBefore) { + self.next_request++; + M8_log('get'+curl); + self.msg_div.innerHTML = self.localiser.localise('loading',{'nbrpage':(self.next_request-1),'total':self.nbr_page})+'
'; + self.received = false; + self.pullMore(curl, + function(body,insert) { + foreach("//div[@class='MembersList']", + function(elt) { + insertBefore.parentNode.insertBefore(elt,insertBefore); + }, + body + ); + } + ,0); + } + } + } + } + + } + + //for FlickrMail + /* else if(document.location.pathname == '/messages.gne') { + matches = /\?page=([0-9]+)$/.exec(document.location.search); + this.paginator = $x1("//div[@class='Pages']/div[@class='Paginator']"); + var pp = $x1("//div[@class='Pages']/div[@class='Results']"); + this.nbr_page = Math.ceil(this.findTotalPage(pp.innerHTML)/20); + + if(matches && matches[1]) this.next_request= parseInt(matches[1]); + this.insert = document.getElementById('InBox'); + if(this.paginator) { + cb = getObjectMethodClosure(this,'messages_cb'); + msg = 'No more messages'; + } + }*/ + + + if(this.paginator) { + if(!this.msg_div) { + var checkboxDiv = this.paginator.appendChild(document.createElement('div')); + checkboxDiv.id = 'enableScrollContainer'; + checkboxDiv.setAttribute('style','font-size:80%;text-align:left;'); + var checkbox = document.createElement('input'); + checkbox.id = 'enableScroll'; + checkbox.checked = true; + checkbox.type = 'checkbox'; + var self = this; + checkbox.addEventListener('CheckboxStateChange',function() { + if(checkbox.checked) { + setTimeout(self.watch_cb,100); + self.stop_watch = false; + } else { + self.stop_watch = true; + } + },true); + checkboxDiv.appendChild(checkbox); + var label = checkboxDiv.appendChild(document.createElement('label')); + label.htmlFor = 'enableScroll'; + label.innerHTML = this.localiser.localise('enable'); + this.msg_div = this.paginator.appendChild(document.createElement('div')); + this.msg_div.setAttribute('style','font-size:80%;text-align:left;margin-top:10px;'); + } + + this.paginator.parentNode.setAttribute('style', + 'position:absolute;'+ + 'overflow: auto;'+ + 'top:100px;'+ + 'left:0;'+ + 'width: 8em;' + ); + var link = $x1("//div[@class='Paginator']//span[text()='"+(this.next_request)+"']"); + var i = 0; + if(link) { + var new_link = link.parentNode.insertBefore(document.createElement('a'),link); + link.style.display = 'none'; + new_link.innerHTML = this.next_request; + new_link.href='#infinitepage'+(this.next_request); + new_link.className += 'this-page'; + } + for(i=0;i nbr) nbr = x; + } + M8_log(nbr); + return nbr; + } + + }; + + + //====================================================================== + //====================================================================== + // launch + try { + window.addEventListener("load", function () { + try { + + // update automatically (http://userscripts.org/scripts/show/2296) + unsafeWindow.UserScriptUpdates.requestAutomaticUpdates(SCRIPT); + } catch (ex) {} + var flickrgp = new win.FlickrAutoPage(); + + + }, false); + } catch (ex) {} + +})(); diff --git a/flickrbuddyinteresting.user.js b/flickrbuddyinteresting.user.js index fbac68a..203e277 100644 --- a/flickrbuddyinteresting.user.js +++ b/flickrbuddyinteresting.user.js @@ -2,10 +2,11 @@ // @name Flickr Buddy Interesting // @namespace http://6v8.gamboni.org/ // @description Quick access to user's interesting photos from the Buddy Icon Menu -// @version 0.1 +// @version 0.3 // @identifier http://6v8.gamboni.org/IMG/js/flickrbuddyinteresting.user.js -// @date 2007-03-16 +// @date 2007-06-26 // @creator Pierre Andrews (mortimer.pa@free.fr) +// @contributor Stephen Fernandez ( http://steeev.freehostia.com ) // @include http://*flickr.com* // ==/UserScript== @@ -48,11 +49,91 @@ namespace: "http://6v8.gamboni.org/", description: "Quick access to user's interesting photos from the Buddy Icon Menu", identifier: "http://6v8.gamboni.org/IMG/js/flickrbuddyinteresting.user.js", - version: "0.1", // version - date: (new Date("2007-03-16")) // update date + version: "0.3", // version + date: (new Date("2007-06-26")) // update date .valueOf() }; + + function $x1(xpath) { + return document.evaluate( + xpath, + document, + null, + XPathResult.FIRST_ORDERED_NODE_TYPE, null + ).singleNodeValue; + } + + + /*********************************************************************** + * Flickr Localisation + **********************************************************************/ + + var FlickrLocaliser = function(locals) { + this.init(locals); + } + FlickrLocaliser.prototype = { + selectedLang: undefined, + localisations: undefined, + getLanguage: function() { + if(!this.selectedLang) { + var langA = $x1("//p[@class='LanguageSelector']//a[contains(@class,'selected')]"); + if(langA) { + var matches = /\/change_language.gne\?lang=([^&]+)&.*/.exec(langA.href); + if(matches && matches[1]) { + this.selectedLang = matches[1]; + return this.selectedLang; + } + } + return false; + } else return this.selectedLang; + }, + + init: function(locals) { + this.localisations = locals; + }, + + localise: function(string, params) { + if(this.localisations && this.getLanguage()) { + var currentLang = this.localisations[this.selectedLang]; + if(!currentLang) currentLang = this.localisations[this.localisations.defaultLang]; + var local = currentLang[string]; + if(!local) { + local = this.localisations[this.localisations.defaultLang][string]; + } + if(!local) return string; + for(arg in params) { + var rep = new RegExp('@'+arg+'@','g'); + local = local.replace(rep,params[arg]); + } + local =local.replace(/@[^@]+@/g,''); + return local; + } else return undefined; + } + + } + + /*****************************Flickr Localisation**********************/ + + + var localiser = new FlickrLocaliser({ + 'en-us' : { + 'pool_interesting' : 'Pool Interestingness', + 'quick_interesting' : 'Quick Interestingness', + 'close' : 'Close' + }, + 'fr-fr' : { + 'pool_interesting' : 'Interestingness du Groupe', + 'quick_interesting' : 'Interestingness Rapide', + 'close' : 'Fermer' + }, + 'it-it' : { + 'pool_interesting' : 'Interestingness del Gruppo', + 'quick_interesting' : 'Interestingness Rapida', + 'close' : 'Chiudi' + }, + defaultLang: 'en-us' + }); function M8_log() { if(unsafeWindow.console) @@ -64,7 +145,7 @@ /* Xpath trickery, from: http://ecmanaut.blogspot.com/2006/07/expressive-user-scripts-with-xpath-and.html - */ + */ function $x( xpath, root ) { var doc = root ? root.evaluate?root:root.ownerDocument : document; @@ -76,15 +157,6 @@ } - function $x1(xpath) { - return document.evaluate( - xpath, - document, - null, - XPathResult.FIRST_ORDERED_NODE_TYPE, null - ).singleNodeValue; - } - function foreach( xpath, cb, root ) { var nodes = $x( xpath, root ), e = 0; @@ -161,19 +233,31 @@ var flickrbuddyinteresting = function() {this.init();} flickrbuddyinteresting.prototype = { - init: function() { - var menu = document.getElementById('personmenu_contacts_link'); - if(menu) { - var link =document.createElement('a'); - link.setAttribute('class','block'); - link.setAttribute('id','tag_person_link'); - link.setAttribute('href','javascript:;'); - link.addEventListener('click',getObjectMethodClosure(this,'showInteresting'),true); - link.textContent='Quick Interestingness'; + var menu = document.getElementById('personmenu_contacts_link'); + if(menu) { + var link =document.createElement('a'); + link.setAttribute('class','block'); + link.setAttribute('id','tag_person_link'); + link.setAttribute('href','javascript:;'); + link.addEventListener('click',getObjectMethodClosure(this,'showInteresting'),true); + link.textContent=localiser.localise('quick_interesting'); - menu.parentNode.insertBefore(link,menu.nextSibling); - } + menu.parentNode.insertBefore(link,menu.nextSibling); + } + + if(document.location.href.match(/\/groups\//) && unsafeWindow.document.getElementById('SubNav')) { + psi=$x1('//p[@class="Links"]'); + psi.innerHTML+=' '; + var link =document.createElement('a'); + link.setAttribute('class','block');; + link.setAttribute('href','javascript:;'); + link.addEventListener('click',getObjectMethodClosure(this,'showInteresting'),true); + link.textContent=localiser.localise('pool_interesting'); + psi.appendChild(link); + + } + }, showInteresting: function(ev) { @@ -184,8 +268,8 @@ boxEle.className = 'popup'; // create something to act as a close button btnClose = document.createElement('a'); - btnClose.href='#'; - btnClose.innerHTML='Close'; + btnClose.href='javascript:;'; + btnClose.innerHTML=localiser.localise('close'); // add close button to block element boxEle.appendChild(btnClose); // create box with block element @@ -197,12 +281,12 @@ boxEle.style.backgroundColor = '#333'; // attach close event and add your own code btnClose.addEventListener('click',function(){ - // you have to pass box object into event - // because of the js event scoping - lwBox.Close(lwBox); - // false to cancel link - return false; - },true); + // you have to pass box object into event + // because of the js event scoping + lwBox.Close(lwBox); + // false to cancel link + return false; + },true); btnClose.setAttribute('style','background-color:#CCC;'); ul.setAttribute('style','margin:0;padding:0;list-style-type:none;'); @@ -217,13 +301,13 @@ var html = ''; for(i=0;i'; + html += '
  • '; } ul.innerHTML = html; - // render it! - lwBox.Render(); + // render it! + lwBox.Render(); } else - M8_log("Error2 "+responseText); + M8_log("Error2 "+responseText); } catch (e) { M8_log("Error1 "+responseText); M8_log(e); @@ -233,24 +317,32 @@ var block = ev.target.parentNode; var matches = /messages_write\.gne\?to=([^"]*)"/.exec(block.innerHTML); - if(matches) - unsafeWindow.F.API.callMethod('flickr.photos.search', { - user_id: matches[1], sort: 'interestingness-desc', page:1, per_page: 25, - format: 'json' - }, listener); - } - } - //====================================================================== - // launch - try { - window.addEventListener("load", function () { - try { + if(matches) + unsafeWindow.F.API.callMethod('flickr.photos.search', { + user_id: matches[1], sort: 'interestingness-desc', page:1, per_page: 25, + format: 'json', extras: 'owner_name' + }, listener); + + if(ev.target.textContent==localiser.localise('pool_interesting')) { + thegroupid=unsafeWindow.document.getElementById('SubNav').innerHTML.split('\/buddyicons\/')[1].split('\.jpg')[0]; + unsafeWindow.F.API.callMethod('flickr.photos.search', { + group_id: thegroupid , sort: 'interestingness-desc', page:1, per_page: 25, + format: 'json', extras: 'owner_name' + }, listener); + } + } + } + //====================================================================== + // launch + try { + window.addEventListener("load", function () { + try { - // update automatically (http://userscripts.org/scripts/show/2296) - win.UserScriptUpdates.requestAutomaticUpdates(SCRIPT); - } catch (ex) {} + // update automatically (http://userscripts.org/scripts/show/2296) + win.UserScriptUpdates.requestAutomaticUpdates(SCRIPT); + } catch (ex) {} - var flickrgp = new flickrbuddyinteresting(); - }, false); - } catch (ex) {} -})(); + var flickrgp = new flickrbuddyinteresting(); + }, false); + } catch (ex) {} + })(); \ No newline at end of file diff --git a/flickreasynsid.user.js b/flickreasynsid.user.js index 21ea3d3..1d964af 100644 --- a/flickreasynsid.user.js +++ b/flickreasynsid.user.js @@ -1,386 +1,386 @@ -// ==UserScript== -// @name Flickr Easy NSID -// @namespace http://6v8.gamboni.org/ -// @description Easily find your and other users NSID on flickr -// @version 0.2 -// @identifier http://6v8.gamboni.org/IMG/js/flickreasynsid.user.js -// @date 2007-07-12 -// @creator Pierre Andrews (mortimer.pa@free.fr) -// @include http://flickr.com* -// @include http://www.flickr.com* -// ==/UserScript== - -// -------------------------------------------------------------------- -// -// This is a Greasemonkey user script. -// -// To install, you need Greasemonkey: http://greasemonkey.mozdev.org/ -// Then restart Firefox and revisit this script. -// Under Tools, there will be a new menu item to "Install User Script". -// Accept the default configuration and install. -// -// -------------------------------------------------------------------- -// Copyright (C) 2006 Pierre Andrews -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// The GNU General Public License is available by visiting -// http://www.gnu.org/copyleft/gpl.html -// or by writing to -// Free Software Foundation, Inc. -// 51 Franklin Street, Fifth Floor -// Boston, MA 02110-1301 -// USA - - -(function () { - - //update information - var SCRIPT = { - name: "Flickr Easy NSID", - namespace: "http://6v8.gamboni.org/", - description: "Easily find your and other users NSID on flickr", - identifier: "http://6v8.gamboni.org/IMG/js/flickreasynsid.user.js", - version: "0.2", // version - date: (new Date("2007-07-12")) // update date - .valueOf() - }; - - - function M8_log() { - if(unsafeWindow.console) - unsafeWindow.console.log(arguments); - else - GM_log(arguments); - } - - /* - LightWeightBox - Thom Shannon - http://www.ts0.com - V 1.0 2006 - BSD License - */ - - var LightWeightBoxOn=false; - var LightWeightBox = function(ele){ - this.ele = ele; - this.backgroundColor = '#CCC'; - this.opacity = 0.5; - } - with (LightWeightBox){ - prototype.Render = function(){ - if (!LightWeightBoxOn){ - bgDiv = document.createElement('div'); - bgDiv.innerHTML = '' - bgDiv.style.backgroundColor = this.backgroundColor; - bgDiv.style.position='fixed'; - bgDiv.style.height='100%'; - bgDiv.style.width='100%'; - bgDiv.style.top=0; - bgDiv.style.left='0'; - bgDiv.style.opacity=this.opacity; - this.ele.style.position='fixed'; - this.bgDiv=bgDiv; - document.body.appendChild(this.bgDiv); - document.body.appendChild(this.ele); - this.CheckSize(); - LightWeightBoxOn = true; - var oSelf=this; - this.sizeCheck = setInterval(function(){oSelf.CheckSize();},20); - } - } - prototype.CheckSize = function(){ - if (this.ele.offsetHeight!=this.currentHeight) { - this.offsetTop = (self.innerHeight/2)-(this.ele.offsetHeight/2); - this.ele.style.top = this.offsetTop+'px'; - this.currentHeight=this.ele.offsetHeight; - } - if (this.ele.offsetWidth!=this.currentWidth) { - this.offsetLeft = (self.innerWidth/2)-(this.ele.offsetWidth/2); - this.ele.style.left = this.offsetLeft+'px'; - this.currentWidth=this.ele.offsetWidth; - } - } - - prototype.Close=function(oSelf){ - document.body.removeChild(oSelf.bgDiv); - document.body.removeChild(oSelf.ele); - LightWeightBoxOn = false; - } - } - - - - /* - Xpath trickery, from: - http://ecmanaut.blogspot.com/2006/07/expressive-user-scripts-with-xpath-and.html - */ - function $x( xpath, root ) - { - var doc = root ? root.evaluate?root:root.ownerDocument : document; - var got = doc.evaluate( xpath, root||doc, null, 0, null ), next; - var result = []; - while( next = got.iterateNext() ) - result.push( next ); - return result; - } - - - function $x1(xpath) { - return document.evaluate( - xpath, - document, - null, - XPathResult.FIRST_ORDERED_NODE_TYPE, null - ).singleNodeValue; - } - - function foreach( xpath, cb, root ) - { - var nodes = $x( xpath, root ), e = 0; - for( var i=0; i= 0) { - var links = $x1("//table[@id='SubNav']/tbody/tr/td[@class='Section']/p"); - if(links) { - var a = links.getElementsByTagName('a'); - var id; - for(var i=0;i= 0) { + var links = $x1("//table[@id='SubNav']/tbody/tr/td[@class='Section']/p"); + if(links) { + var a = links.getElementsByTagName('a'); + var id; + for(var i=0;i'; - form.innerHTML += ''; - form.innerHTML += ''; - form.innerHTML += ''; - form.id= "imgpost_form"; - var ul = div.appendChild(document.createElement('ul')); - ul.setAttribute("style","margin:0;list-style-type:none;"); - var i=0; - var cnt = 0; - for(i=0;i[?]'+ -"\n"+''+GM_getValue(index+/g,'')+'"/>'; - for (var i = 0; i < allTextAreas.length; i++) { - thisTextArea = allTextAreas[i]; - try{ - thisTextArea.value = thisTextArea.value.substr(0,thisTextArea.selectionStart) - + mesg - + thisTextArea.value.substr(thisTextArea.selectionStart); - } catch(e) { - /* var iframe = $x1('//form//iframe',unsafeWindow.document); - M8_log(iframe.contentDocument.getSelection().focusOffset);*/ - thisTextArea.value += mesg; - } - - } - - },true); - } - } - var hide = div.appendChild(document.createElement('a')); - hide.innerHTML = localiser.localise('hide'); - hide.addEventListener('click',function(evt) { - show.style.display = ''; - div.style.display = 'none'; - },true); - hide.href="javascript:;"; - - if(cnt > 0) - return outerdiv; - else - return null; - }, - - getOwnerName: function() { - var uploadedBy = $x1("/html/body/div[@id='Main']/table[@id='Photo']/tbody/tr/td[2]/div[1]/a[1]/img[1]", - document.body); - if(uploadedBy) - return uploadedBy.parentNode.parentNode.getElementsByTagName('a').item(2).innerHTML; - return ''; - }, - - init: function() { - if(unsafeWindow.page_photo_id) { - var current_index = GM_getValue("current_index"); - if(!current_index) current_index = 0; - var photo = unsafeWindow.global_photos[unsafeWindow.page_photo_id]; - var i = 0; - var exist = false; - for(i=0;i= 0) { - var arse = this.createCommenter(); - if(arse != null) { - thisLink = $x1('//td[@id=\'GoodStuff\']/h3', - document); - - if(thisLink) - thisLink.parentNode.insertBefore(arse, thisLink.nextSibling); - } - } else if(document.location.pathname.indexOf('discuss/') >= 0) { - var arse = this.createCommenter(); - if(arse != null) { - if(document.location.pathname.indexOf('edit') >= 0) { - thisLink = $x1('//td[@id=\'GoodStuff\']/form/p[1]/textarea', - document); - if(thisLink) - thisLink.parentNode.insertBefore(arse, thisLink); - } else { - thisLink = $x1('//div[@id=\'DiscussTopic\']//td/h3', - document); - if(thisLink) - thisLink.parentNode.insertBefore(arse, thisLink.nextSibling); - } - } - } else if(document.location.pathname == "/groups_newtopic.gne") { - var arse = this.createCommenter(); - if(arse != null) { - var arse = this.createCommenter(); - thisLink = $x1('//td[@id=\'GoodStuff\']/form/table/tbody/tr[2]/td[2]/textarea', - document); - if(thisLink) - thisLink.parentNode.insertBefore(arse, thisLink); - } - } - } - - } - - var clear_history = function() { - for(var i=0;i'; + form.innerHTML += ''; + form.innerHTML += ''; + form.innerHTML += ''; + form.id= "imgpost_form"; + var ul = div.appendChild(document.createElement('ul')); + ul.setAttribute("style","margin:0;list-style-type:none;"); + var i=0; + var cnt = 0; + for(i=0;i[?]'+ +"\n"+''+GM_getValue(index+/g,'')+'"/>'; + for (var i = 0; i < allTextAreas.length; i++) { + thisTextArea = allTextAreas[i]; + try{ + thisTextArea.value = thisTextArea.value.substr(0,thisTextArea.selectionStart) + + mesg + + thisTextArea.value.substr(thisTextArea.selectionStart); + } catch(e) { + /* var iframe = $x1('//form//iframe',unsafeWindow.document); + M8_log(iframe.contentDocument.getSelection().focusOffset);*/ + thisTextArea.value += mesg; + } + + } + + },true); + } + } + var hide = div.appendChild(document.createElement('a')); + hide.innerHTML = localiser.localise('hide'); + hide.addEventListener('click',function(evt) { + show.style.display = ''; + div.style.display = 'none'; + },true); + hide.href="javascript:;"; + + if(cnt > 0) + return outerdiv; + else + return null; + }, + + getOwnerName: function() { + var uploadedBy = $x1("/html/body/div[@id='Main']/table[@id='Photo']/tbody/tr/td[2]/div[1]/a[1]/img[1]", + document.body); + if(uploadedBy) + return uploadedBy.parentNode.parentNode.getElementsByTagName('a').item(2).innerHTML; + return ''; + }, + + init: function() { + if(unsafeWindow.page_photo_id) { + var current_index = GM_getValue("current_index"); + if(!current_index) current_index = 0; + var photo = unsafeWindow.global_photos[unsafeWindow.page_photo_id]; + var i = 0; + var exist = false; + for(i=0;i= 0) { + var arse = this.createCommenter(); + if(arse != null) { + thisLink = $x1('//td[@id=\'GoodStuff\']/h3', + document); + + if(thisLink) + thisLink.parentNode.insertBefore(arse, thisLink.nextSibling); + } + } else if(document.location.pathname.indexOf('discuss/') >= 0) { + var arse = this.createCommenter(); + if(arse != null) { + if(document.location.pathname.indexOf('edit') >= 0) { + thisLink = $x1('//td[@id=\'GoodStuff\']/form/p[1]/textarea', + document); + if(thisLink) + thisLink.parentNode.insertBefore(arse, thisLink); + } else { + thisLink = $x1('//div[@id=\'DiscussTopic\']//td/h3', + document); + if(thisLink) + thisLink.parentNode.insertBefore(arse, thisLink.nextSibling); + } + } + } else if(document.location.pathname == "/groups_newtopic.gne") { + var arse = this.createCommenter(); + if(arse != null) { + var arse = this.createCommenter(); + thisLink = $x1('//td[@id=\'GoodStuff\']/form/table/tbody/tr[2]/td[2]/textarea', + document); + if(thisLink) + thisLink.parentNode.insertBefore(arse, thisLink); + } + } + } + + } + + var clear_history = function() { + for(var i=0;i 1) { - TJPzoomoffset='dumb'; - TJPzoomoffsetx=TJPzoomoffsetx/TJPzoomwidth; - TJPzoomoffsety=TJPzoomoffsety/TJPzoomheight; - } - if(!obj.style.width) { - if(obj.width > 0) { - //educated guess - obj.style.width=obj.width+'px'; - obj.style.height=obj.height+'px'; - } - } - if(typeof(highres) != typeof('')) {highres=obj.src} - var TJPstage=document.createElement("div"); - TJPstage.style.width=obj.style.width; - TJPstage.style.height=obj.style.height; - TJPstage.style.overflow='hidden'; - TJPstage.style.position='absolute'; - if(typeof(TJPstage.style.filter) != typeof(nosuchthing)) { - //hi IE - if(navigator.appVersion.indexOf('Mac') == -1) { //hi Mac IE - TJPstage.style.filter='alpha(opacity=0)'; - TJPstage.style.backgroundColor='#ffffff'; - } - } else { - //hi decent gentlemen - TJPstage.style.backgroundImage='transparent'; - } - TJPstage.addEventListener('mousemove',function(event) {TJPhandlemouse(event,this);},true); - TJPstage.addEventListener('mousedown',function(event) {TJPhandlemouse(event,this);},true); - TJPstage.addEventListener('mouseup',function(event) {TJPhandlemouse(event,this);},true); - TJPstage.addEventListener('mouseout',function(event) {TJPhandlemouse(event,this);},true); - - if(navigator.userAgent.indexOf('MSIE')>-1) { - TJPstage.onmousemove = function() {TJPhandlemouse(event,this);} - TJPstage.onmousedown = function() {TJPhandlemouse(event,this);} - TJPstage.onmouseup = function() {TJPhandlemouse(event,this);} - TJPstage.onmouseout = function() {TJPhandlemouse(event,this);} - } - obj.parentNode.insertBefore(TJPstage,obj); - - TJPwin=document.createElement("div"); - TJPwin.style.width='0px'; - TJPwin.style.height='0px'; - TJPwin.style.overflow='hidden'; - TJPwin.style.position='absolute'; - TJPwin.style.display='none'; - tw1='
    ' + - tw1+(TJPshadowthick+TJPborderthick)+'px 0 0 '+(TJPshadowthick+TJPborderthick)+'px; width:'+(TJPzoomwidth-TJPshadowthick*2-TJPborderthick*2)+'px;height:'+(TJPzoomheight-TJPshadowthick*2-TJPborderthick*2)+'px;">'; - if(highres != obj.src) { - TJPwin.innerHTML+='
    '+TJPloading+'
    '; - } - if(TJPshadowthick>0) { - st1=''; - TJPwin.innerHTML+= - st1+'0 0 0 0 ; width:'+TJPshadowthick*2+'px; height:'+TJPshadowthick*2+'px;'+st2+'\''+shadowNW+'.png\')"> parseFloat(obj.style.width)) {sbl=1;} - if(TJPzoomheight > parseFloat(obj.style.height)) {sbl=1} - - if(sbr==1 && sbl == 1) { - TJPzoomwidth=parseFloat(obj.style.width)/2; - TJPzoomheight=parseFloat(obj.style.height)/2; - TJPzoomratio=TJPzoomheight/TJPzoomwidth; - } - - if(sbr==1) { - if(TJPzoomwidth TJPzoomwidth/TJPzoomheight) { - TJPzoomheight=parseFloat(obj.style.height); - TJPzoomwidth=TJPzoomheight/TJPzoomratio; - } else { - TJPzoomwidth=parseFloat(obj.style.width); - TJPzoomheight=TJPzoomratio*TJPzoomwidth; - } - } - - TJPzoomwidth=Math.floor(TJPzoomwidth/2)*2; - TJPzoomheight=Math.floor(TJPzoomheight/2)*2; - - ww=obj.parentNode.getElementsByTagName('div')[0]; - ww.style.width=TJPzoomwidth+'px'; - ww.style.height=TJPzoomheight+'px'; - w=ww.getElementsByTagName('div')[0]; - w.style.width=TJPzoomwidth-TJPshadowthick*2+'px'; - w.style.height=TJPzoomheight-TJPshadowthick*2+'px'; - w=ww.getElementsByTagName('div')[1]; - w.style.width=TJPzoomwidth-TJPshadowthick*2-TJPborderthick*2+'px'; - w.style.height=TJPzoomheight-TJPshadowthick*2-TJPborderthick*2+'px'; - if(TJPshadowthick > 0) { - w=ww.getElementsByTagName('span')[1]; w.style.margin='0 0 0 '+(TJPzoomwidth-TJPshadowthick*2)+'px'; - w=ww.getElementsByTagName('span')[2]; w.style.margin=(TJPzoomheight-TJPshadowthick*2)+'px 0 0 0px'; - w=ww.getElementsByTagName('span')[3]; w.style.margin=(TJPzoomheight-TJPshadowthick*2)+'px 0 0 '+(TJPzoomwidth-TJPshadowthick*2)+'px'; - - w=ww.getElementsByTagName('span')[6]; w.style.margin=(TJPshadowthick*2)+'px 0 0 '+(TJPzoomwidth-TJPshadowthick*2)+'px'; - w=ww.getElementsByTagName('span')[7]; w.style.margin=(TJPzoomheight-TJPshadowthick*2)+'px 0 0 '+(TJPshadowthick*2)+'px'; - - www=(TJPzoomwidth-TJPshadowthick*4)+'px'; - w=ww.getElementsByTagName('span')[4]; w.style.width=www; - w=w.getElementsByTagName('img')[0]; w.style.width=www; - w=ww.getElementsByTagName('span')[7]; w.style.width=www; - w=w.getElementsByTagName('img')[0]; w.style.width=www; - - www=(TJPzoomheight-TJPshadowthick*4)+'px'; - w=ww.getElementsByTagName('span')[5]; w.style.height=www; - w=w.getElementsByTagName('img')[0]; w.style.height=www; - w=ww.getElementsByTagName('span')[6]; w.style.height=www; - w=w.getElementsByTagName('img')[0]; w.style.height=www; - } -} - -function TJPfindposy(obj) { - var curtop = 0; - if(!obj) {return 0;} - if (obj.offsetParent) { - while (obj.offsetParent) { - curtop += obj.offsetTop - obj = obj.offsetParent; - } - } else if (obj.y) { - curtop += obj.y; - } - return curtop; -} - -function TJPfindposx(obj) { - var curleft = 0; - if(!obj) {return 0;} - if (obj && obj.offsetParent) { - while (obj.offsetParent) { - curleft += obj.offsetLeft - obj = obj.offsetParent; - } - } else if (obj.x) { - curleft += obj.x; - } - return curleft; -} - - -function TJPhandlemouse(evt,obj) { - var evt = evt?evt:window.event?window.event:null; if(!evt) { return false; } - if(evt.pageX) { - nowx=evt.pageX-TJPfindposx(obj)-TJPadjustx; - nowy=evt.pageY-TJPfindposy(obj)-TJPadjusty; - } else { - if(document.documentElement && document.documentElement.scrollTop) { - nowx=evt.clientX+document.documentElement.scrollLeft-TJPfindposx(obj)-TJPadjustx; - nowy=evt.clientY+document.documentElement.scrollTop-TJPfindposy(obj)-TJPadjusty; - } else { - nowx=evt.x+document.body.scrollLeft-TJPfindposx(obj)-TJPadjustx; - nowy=evt.y+document.body.scrollTop-TJPfindposy(obj)-TJPadjusty; - } - } - if(evt.type == 'mousemove') { - TJPsetwin(obj,nowx,nowy); - } else if(evt.type == 'mousedown') { - TJPmouse=1; //left: 1, middle: 2, right: 3 - TJPmousey=nowy; - TJPmousex=nowx; - } else if(evt.type =='mouseup') { - TJPmouse=0; - } else if(evt.type =='mouseout') { - TJPmouse=0; - if(navigator.appVersion.indexOf('Mac') == -1 || navigator.appVersion.indexOf('MSIE') == -1) { //hi Mac IE - x=obj.parentNode; - x.removeChild(x.getElementsByTagName('div')[0]); - x.removeChild(x.getElementsByTagName('div')[0]); - //x.removeChild(x.getElementsByTagName('div')[0]); //AAAAAAAAAAAAAAAAAAAAAAAAAA - } - } -} - - -// TJPzoom 3 * János Pál Tóth -// Docs @ http://valid.tjp.hu/tjpzoom/ -// News @ http://tjpzoom.blogspot.com/ - - -function TJPsetwin(obj,nowx,nowy) { - obj.parentNode.getElementsByTagName('div')[0].style.display='block'; - if(TJPzoomoffset=='smart') { - TJPzoomoffsetx=nowx/parseFloat(obj.style.width); - TJPzoomoffsety=nowy/parseFloat(obj.style.height); - } - - stage=obj.parentNode.getElementsByTagName('div')[0]; - if(TJPmouse == 1) { - if(Math.abs(nowy-TJPmousey) >= 1) { - TJPzoomamount*=((nowy>TJPmousey)?(0.909):(1.1)); - TJPmousey=nowy; - if(TJPzoomamount < TJPzoomamountmin) {TJPzoomamount=TJPzoomamountmin;} - if(TJPzoomamount > TJPzoomamountmax) {TJPzoomamount=TJPzoomamountmax;} - stage.getElementsByTagName('div')[1].getElementsByTagName('img')[0].style.width= parseInt(obj.style.width)*TJPzoomamount+'px'; - stage.getElementsByTagName('div')[1].getElementsByTagName('img')[0].style.height= parseInt(obj.style.height)*TJPzoomamount+'px'; - } - if(Math.abs(nowx-TJPmousex) >= 12 && TJPzoomwindowlock==0) { - TJPzoomwidth*=((nowx>TJPmousex)?(1.1):(0.909)); - TJPzoomheight=TJPzoomwidth*TJPzoomratio; - TJPresize(obj); - TJPmousex=nowx; - } - } - stage.style.marginLeft=nowx-(TJPzoomwidth -2*TJPborderthick-2*TJPshadowthick)*TJPzoomoffsetx-TJPborderthick-TJPshadowthick+'px'; - stage.style.marginTop= nowy-(TJPzoomheight-2*TJPborderthick-2*TJPshadowthick)*TJPzoomoffsety-TJPborderthick-TJPshadowthick+'px'; - clip1=0; clip2=TJPzoomwidth; clip3=TJPzoomheight; clip4=0; - nwidth=TJPzoomwidth; nheight=TJPzoomheight; - /*tmp=(1-2*TJPzoomoffsetx)*(TJPborderthick+TJPshadowthick); - - if(nowx-TJPzoomwidth*TJPzoomoffsetx < tmp) { - clip4=TJPzoomwidth*TJPzoomoffsetx-nowx + tmp; - } else if(parseFloat(nowx-TJPzoomwidth*TJPzoomoffsetx+TJPzoomwidth) > parseFloat(obj.style.width)+tmp) { - clip2= TJPzoomwidth*TJPzoomoffsetx - nowx + parseFloat(obj.style.width)+tmp; - nwidth=TJPzoomwidth*TJPzoomoffsetx-nowx+parseInt(obj.style.width)+TJPborderthick+TJPshadowthick; - } - - tmp=(1-2*TJPzoomoffsety)*(TJPborderthick+TJPshadowthick); - - if(nowy-TJPzoomheight*TJPzoomoffsety < tmp) { - clip1=TJPzoomheight*TJPzoomoffsety-nowy+tmp; - } else if(parseFloat(nowy-TJPzoomheight*TJPzoomoffsety+TJPzoomheight) > parseFloat(obj.style.height)+tmp) { - clip3= TJPzoomheight*TJPzoomoffsety - nowy + parseFloat(obj.style.height)+tmp; - nheight=TJPzoomheight*TJPzoomoffsety - nowy + parseFloat(obj.style.height)+TJPborderthick+TJPshadowthick; - }*/ - stage.style.width=nwidth+'px'; - stage.style.height=nheight+'px'; - - // stage.style.clip='rect('+clip1+'px,'+clip2+'px,'+clip3+'px,'+clip4+'px)'; - - if(nowy-TJPzoomoffsety*(TJPzoomheight-2*TJPborderthick-2*TJPshadowthick) < 0) { t=-(nowy-TJPzoomoffsety*(TJPzoomheight-2*TJPborderthick-2*TJPshadowthick))} - else if(nowy-TJPzoomoffsety*(TJPzoomheight-2*TJPborderthick-2*TJPshadowthick) > parseFloat(obj.style.height)-TJPzoomheight+TJPborderthick*2+TJPshadowthick*2) { t=-TJPzoomamount*parseFloat(obj.style.height)+TJPzoomheight-TJPborderthick*2-TJPshadowthick*2-((nowy-TJPzoomoffsety*(TJPzoomheight-2*TJPborderthick-2*TJPshadowthick))-(parseFloat(obj.style.height)-TJPzoomheight+TJPborderthick*2+TJPshadowthick*2)); } - else { t=(-TJPzoomamount*parseFloat(obj.style.height)+TJPzoomheight-TJPborderthick*2-TJPshadowthick*2)/(parseFloat(obj.style.height)-TJPzoomheight+TJPborderthick*2+TJPshadowthick*2)*(nowy-TJPzoomoffsety*(TJPzoomheight-2*TJPborderthick-2*TJPshadowthick)) } - stage.getElementsByTagName('div')[1].getElementsByTagName('img')[0].style.marginTop=t+'px'; - - if(nowx-TJPzoomoffsetx*(TJPzoomwidth-2*TJPborderthick-2*TJPshadowthick) < 0) { t=-(nowx-TJPzoomoffsetx*(TJPzoomwidth-2*TJPborderthick-2*TJPshadowthick))} - else if(nowx-TJPzoomoffsetx*(TJPzoomwidth-2*TJPborderthick-2*TJPshadowthick) > parseFloat(obj.style.width)-TJPzoomwidth+TJPborderthick*2+TJPshadowthick*2) { t=-TJPzoomamount*parseFloat(obj.style.width)+TJPzoomwidth-TJPborderthick*2-TJPshadowthick*2-((nowx-TJPzoomoffsetx*(TJPzoomwidth-2*TJPborderthick-2*TJPshadowthick))-(parseFloat(obj.style.width)-TJPzoomwidth+TJPborderthick*2+TJPshadowthick*2)); } - else { t=(-TJPzoomamount*parseFloat(obj.style.width)+TJPzoomwidth-TJPborderthick*2-TJPshadowthick*2)/(parseFloat(obj.style.width)-TJPzoomwidth+TJPborderthick*2+TJPshadowthick*2)*(nowx-TJPzoomoffsetx*(TJPzoomwidth-2*TJPborderthick-2*TJPshadowthick)) } - stage.getElementsByTagName('div')[1].getElementsByTagName('img')[0].style.marginLeft=t+'px'; - - - //document.getElementsByTagName('h1')[0].innerHTML=; -} - -function TJPinit() { - TJPadjustx=0; TJPadjusty=0; - if(navigator.userAgent.indexOf('MSIE')>-1) {TJPadjustx=2;TJPadjusty=2;} - if(navigator.userAgent.indexOf('Opera')>-1) {TJPadjustx=0; TJPadjusty=0;} - if(navigator.userAgent.indexOf('Safari')>-1) {TJPadjustx=1; TJPadjusty=2;} -} - -// configuration - do not modify the following, instead read the behaviors.html file in the tutorial! -var TJPon=new Array(); -var TJPadjustx,TJPadjusty; -var TJPmouse=0; var TJPmousey; -var TJPloading='
    '+localiser.localise('loading')+'
    '; - -var TJPzoomwidth= 160; -var TJPzoomheight= 120; -var TJPzoomratio; -var TJPzoomwindowlock=0; - -var TJPzoomoffsetx=TJPzoomwidth/2; -var TJPzoomoffsety=TJPzoomheight/2; -var TJPzoomoffset; - -var TJPzoomamount=4; -var TJPzoomamountmax=12; -var TJPzoomamountmin=1; - -var TJPborderthick=1; -var TJPbordercolor='#000000'; - -var TJPshadowthick=8; - -var shadowN = "data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%10%00%00%00%10%08%06%00%00%00%1F%F3%FFa%00%00%00%07tIME%07%D7%04%1A%16%1E9%9A%24%FF%19%00%00%00%09pHYs%00%00.%23%00%00.%23%01x%A5%3Fv%00%00%00%04gAMA%00%00%B1%8F%0B%FCa%05%00%00%00%15IDATx%DAc%60%18%05%C3%000B%F1(%18%05%14%01%00%08%9E%00%03%83%17%0BH%00%00%00%00IEND%AEB%60%82"; -var shadowNE = "data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%10%00%00%00%10%08%06%00%00%00%1F%F3%FFa%00%00%00%07tIME%07%D7%04%1A%16%1C1%A6%C9%15%A9%00%00%00%09pHYs%00%00.%23%00%00.%23%01x%A5%3Fv%00%00%00%04gAMA%00%00%B1%8F%0B%FCa%05%00%00%00%88IDATx%DA%ED%90%CB%0A%830%10E%13M%AA(t%D7%AD%82%FF%FFk%BA%F0I%F1%11o%E0%06B7%8E%DB%E2%C0a%20d%CE%3C%94z%E2%0FB%93%3B%E1~%05W%F1b%3E%A2%EC%82(%15%08%DE%C0%02%03%92%A8%A9XP%81%1Cd%D1%FF%B0%863%02A%0DV%B0%80%01%F4%D1*%87D%D0%80%2F%18A%CB7%2F%DC%C0.%9D%C0w%EF8%FAL%99%CFZ%22%F8%80%89%C5%13%EFa%C3A%25%82%92%C5%05%0FiyL%2FP'%B6%E5%1E%5D%DCX%24%10%00%00%00%00IEND%AEB%60%82"; -var shadowE = "data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%10%00%00%00%10%08%06%00%00%00%1F%F3%FFa%00%00%00%07tIME%07%D7%04%1A%16%1D%0F~%B39C%00%00%00%09pHYs%00%00.%23%00%00.%23%01x%A5%3Fv%00%00%00%04gAMA%00%00%B1%8F%0B%FCa%05%00%00%00%2BIDATx%DAcd%20%0C%D6%02%F1%17%20~%05%C4%0F%80%F8%0E%94~%0D%12g%22%C2%00%BC%60%D4%80Q%03F%0D%18%2C%06%00%00l%95%07%26%D9%C2%1F%9D%00%00%00%00IEND%AEB%60%82"; -var shadowSE = "data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%10%00%00%00%10%08%06%00%00%00%1F%F3%FFa%00%00%00%07tIME%07%D7%04%1A%16%1D(%DB%B9%8C(%00%00%00%09pHYs%00%00.%23%00%00.%23%01x%A5%3Fv%00%00%00%04gAMA%00%00%B1%8F%0B%FCa%05%00%00%00%9EIDATx%DA%ED%92A%0E%83%20%10E%B11%3D%40%EF%7F%85%DE%C8%85k%9B%D8%C4%9AR%A32~%F0O3%2B%60%D5U'y%40L%E6%F1A%1AW%AE%3B%98%C1%00z%D0q~%C4%EF%97%0AA%B6%FE%82%1F%09%02%11%83%D3u%EB%CE%FF%9Ck%5E%C9%06v%23K%15%05sA%10%1B%DFd%A1LEI0d%04B%81%07O%F0%02%1FJ%82%1E%A1%2F%DC%C1%C6%9Dc%D2%91%92%C5%0A%BAB%02%E1%8E%9E%CD%93IQ%95%40xfM%E2m%82%06%C3%ADB%20lP%D1N%92%E0%EA%EA*%98%F9%FB%1E%0E%F1sO6%10%CB%E6%9B%00%00%00%00IEND%AEB%60%82"; -var shadowS = "data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%10%00%00%00%10%08%06%00%00%00%1F%F3%FFa%00%00%00%07tIME%07%D7%04%1A%16%1D8%C6%0E%9CL%00%00%00%09pHYs%00%00.%23%00%00.%23%01x%A5%3Fv%00%00%00%04gAMA%00%00%B1%8F%0B%FCa%05%00%00%000IDATx%DAc%60%18%05%A3%80%81%81%11%88%D7Rb%00%0B%10%7F%A1%D4%80W%94%1A%F0%80R%03%EE%0C%A8%0B%40%B1%20D%A9%01l%94%18%00%002V%05W%11%99%89%DE%00%00%00%00IEND%AEB%60%82"; -var shadowSW = "data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%10%00%00%00%10%08%06%00%00%00%1F%F3%FFa%00%00%00%07tIME%07%D7%04%1A%16%1E%13A%9F6%CF%00%00%00%09pHYs%00%00.%23%00%00.%23%01x%A5%3Fv%00%00%00%04gAMA%00%00%B1%8F%0B%FCa%05%00%00%00%89IDATx%DA%ED%92K%0A%800%0CD%5B%AB%A2%E0R%B7%BA%F0%FE%97%13%2B%FEu%22%11%A5%0B%1B%10%5C9%F0%08%FDM%9A%B4J%3DK%7B%D6U%E0%DB%F0%1B%7C%60%F0Z%DEw%86%22%90%81%02%94%A0%06%15%C8i%3E%14%26Z%C1%02%260%80%8E%D1F%D8'J%14%83%14%24%3C%26%8D%12%03*%D38%D0%8Dz%D0J%0D%EEq%E6%C3%164%92%1El%9Cq%B8%19X.%C3H%5E%C1-%23%E4H%BD%D1R%83%D3D%AB%EB%F3%1Dq%07%2C%D4%13%98%99%83%B5%22%00%00%00%00IEND%AEB%60%82"; -var shadowW = "data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%10%00%00%00%10%08%06%00%00%00%1F%F3%FFa%00%00%00%07tIME%07%D7%04%1A%16%1E%20%FEOW%D9%00%00%00%09pHYs%00%00.%23%00%00.%23%01x%A5%3Fv%00%00%00%04gAMA%00%00%B1%8F%0B%FCa%05%00%00%00%1CIDATx%DAc%60%C0%0F%18%09%C830%11R0j%C0%A8%01%A3%06%0C%15%03%00D%F0%00%20zzK%0C%00%00%00%00IEND%AEB%60%82"; -var shadowNW = "data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%10%00%00%00%10%08%06%00%00%00%1F%F3%FFa%00%00%00%07tIME%07%D7%04%1A%16%1E%2Fn%F0JH%00%00%00%09pHYs%00%00.%23%00%00.%23%01x%A5%3Fv%00%00%00%04gAMA%00%00%B1%8F%0B%FCa%05%00%00%00%15IDATx%DAc%60%18%05%C3%000%D2I%CF(%18%E6%00%00%08n%00%03%9BHo7%00%00%00%00IEND%AEB%60%82"; - -if(GM_getValue('zoomwidth')) { - TJPzoomwidth = GM_getValue('zoomwidth'); - TJPzoomoffsetx=TJPzoomwidth/2 -} -if(GM_getValue('zoomheight')) { - TJPzoomheight = GM_getValue('zoomheight'); - TJPzoomoffsety=TJPzoomheight/2; -} - - -TJPinit(); - - - -// TJPzoom 3 * J�nos P�l T�th -// Docs @ http://valid.tjp.hu/tjpzoom/ -// News @ http://tjpzoom.blogspot.com/ - - -//********************************************************************** - - //====================================================================== - //to do the closure and get the right this. - //adapted from http://persistent.info/greasemonkey/gmail.user.js - - function getObjectMethodClosure2(object, method,args,args1,args2) { - return function() { - return object[method](args,args1,args2); - } - } - function getObjectMethodClosure1(object, method,args,args1) { - return function() { - return object[method](args,args1); - } - } - - function getObjectMethodClosure0(object, method,args) { - return function() { - return object[method](args); - } - } - - function getObjectMethodClosure(object, method) { - return function(args) { - return object[method](args); - } - } - - /* - Xpath trickery, from: - http://ecmanaut.blogspot.com/2006/07/expressive-user-scripts-with-xpath-and.html - */ - function $x( xpath, root ) - { - var doc = root ? root.evaluate?root:root.ownerDocument : document; - var got = doc.evaluate( xpath, root||doc, null, 0, null ), next; - var result = []; - while( next = got.iterateNext() ) - result.push( next ); - return result; - } - - - function $x1(xpath) { - return document.evaluate( - xpath, - document, - null, - XPathResult.FIRST_ORDERED_NODE_TYPE, null - ).singleNodeValue; - } - - function foreach( xpath, cb, root ) - { - var nodes = $x( xpath, root ), e = 0; - for( var i=0; i'; - modal.style.top = document.body.scrollTop+(document.body.clientHeight/2)+'px'; - - var dialog = modal.appendChild(document.createElement('div')); - dialog.setAttribute('style',"padding: 18px 16px;clear:both; width:70%;overflow:auto;margin-left:15%;"); - var content = dialog.appendChild(document.createElement('div')); - - var pAbout = content.appendChild(document.createElement("p")); - pAbout.setAttribute('style',"padding: 18px 16px;clear:both; width:100%;overflow:auto;"); - pAbout.innerHTML = localiser.localise('about',{ - 'jpl' : 'János Pál Tóth', - 'paypal' : '

    ', - 'pa' : 'Pierre Andrews' - }); - - var spanForm = content.appendChild(document.createElement("div")); - spanForm.setAttribute('style',"padding: 18px 16px;clear:both; width:100%;overflow:auto;"); - spanForm.innerHTML = '


    (*)'+localiser.localise('quality_note')+'.

    ' - - var buttons = dialog.appendChild(document.createElement('div')); - var ok = buttons.appendChild(document.createElement('button')); - ok.type ='button'; - ok.className='Butt'; - ok.innerHTML = localiser.localise('save'); - var cancel = buttons.appendChild(document.createElement('button')); - cancel.type ='button'; - cancel.className = 'Butt'; - cancel.innerHTML = localiser.localise('cancel'); - - cancel.addEventListener('click',function() { - document.body.removeChild(back); - document.body.removeChild(modal); - },true); - - - ok.addEventListener('click',function() { - var inp = document.getElementById("gm_mag_shoulduselarge"); - if(inp) { - GM_setValue('useLarge',inp.checked); - useLarge = inp.checked; - } - inp = document.getElementById("gm_mag_zoomheight"); - if(inp) { - GM_setValue('zoomheight',inp.value); - TJPzoomheight = inp.value; - TJPzoomoffsety=TJPzoomheight/2; - } - inp = document.getElementById("gm_mag_zoomwidth"); - if(inp) { - GM_setValue('zoomwidth',inp.value); - TJPzoomwidth = inp.value; - TJPzoomoffsetx=TJPzoomwidth/2; - } - - - document.body.removeChild(back); - document.body.removeChild(modal); - },true); - - modal.style.top = document.body.scrollTop+((document.body.clientHeight-modal.scrollHeight)/2)+'px'; - }; - GM_registerMenuCommand( localiser.localise("menu_item"), prompt_conf); - - - //====================================================================== - - - try { - window.addEventListener("load", function () { - - init(); - }, false); - } catch (ex) {} - - -})(); +// Flickr Photo Magnifier +// Copyright (c) 2007, Pierre Andrews. +// Released under the GPL license +// http://www.gnu.org/copyleft/gpl.html +// +// ==UserScript== +// @name Flickr Photo Magnifier +// @namespace http://6v8.gamboni.org/Flickr-Photo-Magnifier.html +// @description Add a magnifier to the photo pages. Click+mouse drag will zoom in and out. You can configure the quality of the image through the greasemonkey user script menu. (magnifier code by Janos Pal Toth). +// @version 1.2 +// @date 2007-06-26 +// @creator Pierre Andrews (mortimer.pa@free.fr) +// @include http://*flickr.com/photos/*/* +// @exclude http://*flickr.com/photos/*/organize* +// @exclude http://*flickr.com/photos/*/tags* +// ==/UserScript== + + + +(function () { + + + function M8_log() { + if(unsafeWindow.console) + unsafeWindow.console.log(arguments); + else + GM_log(arguments); + } + + function $x1(xpath) { + return document.evaluate( + xpath, + document, + null, + XPathResult.FIRST_ORDERED_NODE_TYPE, null + ).singleNodeValue; + } + + + /*********************************************************************** + * Flickr Localisation + **********************************************************************/ + + var FlickrLocaliser = function(locals) { + this.init(locals); + } + FlickrLocaliser.prototype = { + selectedLang: undefined, + localisations: undefined, + getLanguage: function() { + if(!this.selectedLang) { + var langA = $x1("//p[@class='LanguageSelector']//a[contains(@class,'selected')]"); + if(langA) { + var matches = /\/change_language.gne\?lang=([^&]+)&.*/.exec(langA.href); + if(matches && matches[1]) { + this.selectedLang = matches[1]; + return this.selectedLang; + } + } + return false; + } else return this.selectedLang; + }, + + init: function(locals) { + this.localisations = locals; + }, + + localise: function(string, params) { + if(this.localisations && this.getLanguage()) { + var currentLang = this.localisations[this.selectedLang]; + if(!currentLang) currentLang = this.localisations[this.localisations.defaultLang]; + var local = currentLang[string]; + if(!local) { + local = this.localisations[this.localisations.defaultLang][string]; + } + if(!local) return string; + for(arg in params) { + var rep = new RegExp('@'+arg+'@','g'); + local = local.replace(rep,params[arg]); + } + local =local.replace(/@[^@]+@/g,''); + return local; + } else return undefined; + } + + } + + /*****************************Flickr Localisation**********************/ + + + var localiser = new FlickrLocaliser({ + 'en-us' : { + 'loading' : 'loading ...', + 'switch' : 'switch on/off magnifier', + 'about' : 'The Flickr Magnifier is a little tool to add in place magnifier on flickr images. The original magnifier code has been provided by @jpl@, you can make him a donation at:@paypal@ The adaptation to Flickr photos has been made by @pa@.', + 'lower_quality' : 'Use lower quality zoom', + 'magnifier_width' : 'Magnifier width', + 'magnifier_height' : 'Magnifier height', + 'quality_note' : 'If you choose to use a lower quality zoom, the loading time for the magnifier will be faster, but the definition of the magnified area will be less', + 'menu_item' : 'Configure Flickr Photo Magnifier', + 'save' : 'Save', + 'cancel' : 'Cancel', + }, + 'fr-fr': { + // A + 'about' : 'La Loupe Flickr (Flickr Magnifier) est un petit outil qui offre une loupe pour les images Flickr. Le code original de la loupe à été écrit par @jp@, vous pouvez lui faire un don à: @paypal@.L\'adaptation aux photos Flickr à été codée par @pa@.', + // C + 'cancel' : 'Annuler', + // L + 'loading' : 'Chargement ...', + 'lower_quality' : 'Utiliser une image de petite qualité', + // M + 'magnifier_height' : 'Hauteur de la loupe', + 'magnifier_width' : 'Largeur de la loupe', + 'menu_item' : 'Configurer la Loupe Flickr', + // Q + 'quality_note' : 'Si vous utilisez une qualité d\'image plus petite, le temps de chargement sera plus rapide, mais la qualité de la loupe sera moindre', + // S + 'save' : 'Sauver', + 'switch' : 'Activer/Désactiver la loupe' + }, + defaultLang: 'en-us' + }); + + //********************************************************************** + +// TJPzoom 3 * János Pál Tóth +// 2007.05.18 +// Docs @ http://valid.tjp.hu/tjpzoom/ +// News @ http://tjpzoom.blogspot.com/ + +function TJPzoomswitch(obj) { + TJPon[obj]=((TJPon[obj])?(0):(1)); + return TJPon[obj]; +} + +function TJPzoomif(obj,highres) { + if(TJPon[obj]) {TJPzoom(obj,highres);} +} +function TJPzoom(obj,highres) { + TJPzoomratio=TJPzoomheight/TJPzoomwidth; + if(TJPzoomoffsetx > 1) { + TJPzoomoffset='dumb'; + TJPzoomoffsetx=TJPzoomoffsetx/TJPzoomwidth; + TJPzoomoffsety=TJPzoomoffsety/TJPzoomheight; + } + if(!obj.style.width) { + if(obj.width > 0) { + //educated guess + obj.style.width=obj.width+'px'; + obj.style.height=obj.height+'px'; + } + } + if(typeof(highres) != typeof('')) {highres=obj.src} + var TJPstage=document.createElement("div"); + TJPstage.style.width=obj.style.width; + TJPstage.style.height=obj.style.height; + TJPstage.style.overflow='hidden'; + TJPstage.style.position='absolute'; + if(typeof(TJPstage.style.filter) != typeof(nosuchthing)) { + //hi IE + if(navigator.appVersion.indexOf('Mac') == -1) { //hi Mac IE + TJPstage.style.filter='alpha(opacity=0)'; + TJPstage.style.backgroundColor='#ffffff'; + } + } else { + //hi decent gentlemen + TJPstage.style.backgroundImage='transparent'; + } + TJPstage.addEventListener('mousemove',function(event) {TJPhandlemouse(event,this);},true); + TJPstage.addEventListener('mousedown',function(event) {TJPhandlemouse(event,this);},true); + TJPstage.addEventListener('mouseup',function(event) {TJPhandlemouse(event,this);},true); + TJPstage.addEventListener('mouseout',function(event) {TJPhandlemouse(event,this);},true); + + if(navigator.userAgent.indexOf('MSIE')>-1) { + TJPstage.onmousemove = function() {TJPhandlemouse(event,this);} + TJPstage.onmousedown = function() {TJPhandlemouse(event,this);} + TJPstage.onmouseup = function() {TJPhandlemouse(event,this);} + TJPstage.onmouseout = function() {TJPhandlemouse(event,this);} + } + obj.parentNode.insertBefore(TJPstage,obj); + + TJPwin=document.createElement("div"); + TJPwin.style.width='0px'; + TJPwin.style.height='0px'; + TJPwin.style.overflow='hidden'; + TJPwin.style.position='absolute'; + TJPwin.style.display='none'; + tw1='
    ' + + tw1+(TJPshadowthick+TJPborderthick)+'px 0 0 '+(TJPshadowthick+TJPborderthick)+'px; width:'+(TJPzoomwidth-TJPshadowthick*2-TJPborderthick*2)+'px;height:'+(TJPzoomheight-TJPshadowthick*2-TJPborderthick*2)+'px;">'; + if(highres != obj.src) { + TJPwin.innerHTML+='
    '+TJPloading+'
    '; + } + if(TJPshadowthick>0) { + st1=''; + TJPwin.innerHTML+= + st1+'0 0 0 0 ; width:'+TJPshadowthick*2+'px; height:'+TJPshadowthick*2+'px;'+st2+'\''+shadowNW+'.png\')"> parseFloat(obj.style.width)) {sbl=1;} + if(TJPzoomheight > parseFloat(obj.style.height)) {sbl=1} + + if(sbr==1 && sbl == 1) { + TJPzoomwidth=parseFloat(obj.style.width)/2; + TJPzoomheight=parseFloat(obj.style.height)/2; + TJPzoomratio=TJPzoomheight/TJPzoomwidth; + } + + if(sbr==1) { + if(TJPzoomwidth TJPzoomwidth/TJPzoomheight) { + TJPzoomheight=parseFloat(obj.style.height); + TJPzoomwidth=TJPzoomheight/TJPzoomratio; + } else { + TJPzoomwidth=parseFloat(obj.style.width); + TJPzoomheight=TJPzoomratio*TJPzoomwidth; + } + } + + TJPzoomwidth=Math.floor(TJPzoomwidth/2)*2; + TJPzoomheight=Math.floor(TJPzoomheight/2)*2; + + ww=obj.parentNode.getElementsByTagName('div')[0]; + ww.style.width=TJPzoomwidth+'px'; + ww.style.height=TJPzoomheight+'px'; + w=ww.getElementsByTagName('div')[0]; + w.style.width=TJPzoomwidth-TJPshadowthick*2+'px'; + w.style.height=TJPzoomheight-TJPshadowthick*2+'px'; + w=ww.getElementsByTagName('div')[1]; + w.style.width=TJPzoomwidth-TJPshadowthick*2-TJPborderthick*2+'px'; + w.style.height=TJPzoomheight-TJPshadowthick*2-TJPborderthick*2+'px'; + if(TJPshadowthick > 0) { + w=ww.getElementsByTagName('span')[1]; w.style.margin='0 0 0 '+(TJPzoomwidth-TJPshadowthick*2)+'px'; + w=ww.getElementsByTagName('span')[2]; w.style.margin=(TJPzoomheight-TJPshadowthick*2)+'px 0 0 0px'; + w=ww.getElementsByTagName('span')[3]; w.style.margin=(TJPzoomheight-TJPshadowthick*2)+'px 0 0 '+(TJPzoomwidth-TJPshadowthick*2)+'px'; + + w=ww.getElementsByTagName('span')[6]; w.style.margin=(TJPshadowthick*2)+'px 0 0 '+(TJPzoomwidth-TJPshadowthick*2)+'px'; + w=ww.getElementsByTagName('span')[7]; w.style.margin=(TJPzoomheight-TJPshadowthick*2)+'px 0 0 '+(TJPshadowthick*2)+'px'; + + www=(TJPzoomwidth-TJPshadowthick*4)+'px'; + w=ww.getElementsByTagName('span')[4]; w.style.width=www; + w=w.getElementsByTagName('img')[0]; w.style.width=www; + w=ww.getElementsByTagName('span')[7]; w.style.width=www; + w=w.getElementsByTagName('img')[0]; w.style.width=www; + + www=(TJPzoomheight-TJPshadowthick*4)+'px'; + w=ww.getElementsByTagName('span')[5]; w.style.height=www; + w=w.getElementsByTagName('img')[0]; w.style.height=www; + w=ww.getElementsByTagName('span')[6]; w.style.height=www; + w=w.getElementsByTagName('img')[0]; w.style.height=www; + } +} + +function TJPfindposy(obj) { + var curtop = 0; + if(!obj) {return 0;} + if (obj.offsetParent) { + while (obj.offsetParent) { + curtop += obj.offsetTop + obj = obj.offsetParent; + } + } else if (obj.y) { + curtop += obj.y; + } + return curtop; +} + +function TJPfindposx(obj) { + var curleft = 0; + if(!obj) {return 0;} + if (obj && obj.offsetParent) { + while (obj.offsetParent) { + curleft += obj.offsetLeft + obj = obj.offsetParent; + } + } else if (obj.x) { + curleft += obj.x; + } + return curleft; +} + + +function TJPhandlemouse(evt,obj) { + var evt = evt?evt:window.event?window.event:null; if(!evt) { return false; } + if(evt.pageX) { + nowx=evt.pageX-TJPfindposx(obj)-TJPadjustx; + nowy=evt.pageY-TJPfindposy(obj)-TJPadjusty; + } else { + if(document.documentElement && document.documentElement.scrollTop) { + nowx=evt.clientX+document.documentElement.scrollLeft-TJPfindposx(obj)-TJPadjustx; + nowy=evt.clientY+document.documentElement.scrollTop-TJPfindposy(obj)-TJPadjusty; + } else { + nowx=evt.x+document.body.scrollLeft-TJPfindposx(obj)-TJPadjustx; + nowy=evt.y+document.body.scrollTop-TJPfindposy(obj)-TJPadjusty; + } + } + if(evt.type == 'mousemove') { + TJPsetwin(obj,nowx,nowy); + } else if(evt.type == 'mousedown') { + TJPmouse=1; //left: 1, middle: 2, right: 3 + TJPmousey=nowy; + TJPmousex=nowx; + } else if(evt.type =='mouseup') { + TJPmouse=0; + } else if(evt.type =='mouseout') { + TJPmouse=0; + if(navigator.appVersion.indexOf('Mac') == -1 || navigator.appVersion.indexOf('MSIE') == -1) { //hi Mac IE + x=obj.parentNode; + x.removeChild(x.getElementsByTagName('div')[0]); + x.removeChild(x.getElementsByTagName('div')[0]); + //x.removeChild(x.getElementsByTagName('div')[0]); //AAAAAAAAAAAAAAAAAAAAAAAAAA + } + } +} + + +// TJPzoom 3 * János Pál Tóth +// Docs @ http://valid.tjp.hu/tjpzoom/ +// News @ http://tjpzoom.blogspot.com/ + + +function TJPsetwin(obj,nowx,nowy) { + obj.parentNode.getElementsByTagName('div')[0].style.display='block'; + if(TJPzoomoffset=='smart') { + TJPzoomoffsetx=nowx/parseFloat(obj.style.width); + TJPzoomoffsety=nowy/parseFloat(obj.style.height); + } + + stage=obj.parentNode.getElementsByTagName('div')[0]; + if(TJPmouse == 1) { + if(Math.abs(nowy-TJPmousey) >= 1) { + TJPzoomamount*=((nowy>TJPmousey)?(0.909):(1.1)); + TJPmousey=nowy; + if(TJPzoomamount < TJPzoomamountmin) {TJPzoomamount=TJPzoomamountmin;} + if(TJPzoomamount > TJPzoomamountmax) {TJPzoomamount=TJPzoomamountmax;} + stage.getElementsByTagName('div')[1].getElementsByTagName('img')[0].style.width= parseInt(obj.style.width)*TJPzoomamount+'px'; + stage.getElementsByTagName('div')[1].getElementsByTagName('img')[0].style.height= parseInt(obj.style.height)*TJPzoomamount+'px'; + } + if(Math.abs(nowx-TJPmousex) >= 12 && TJPzoomwindowlock==0) { + TJPzoomwidth*=((nowx>TJPmousex)?(1.1):(0.909)); + TJPzoomheight=TJPzoomwidth*TJPzoomratio; + TJPresize(obj); + TJPmousex=nowx; + } + } + stage.style.marginLeft=nowx-(TJPzoomwidth -2*TJPborderthick-2*TJPshadowthick)*TJPzoomoffsetx-TJPborderthick-TJPshadowthick+'px'; + stage.style.marginTop= nowy-(TJPzoomheight-2*TJPborderthick-2*TJPshadowthick)*TJPzoomoffsety-TJPborderthick-TJPshadowthick+'px'; + clip1=0; clip2=TJPzoomwidth; clip3=TJPzoomheight; clip4=0; + nwidth=TJPzoomwidth; nheight=TJPzoomheight; + /*tmp=(1-2*TJPzoomoffsetx)*(TJPborderthick+TJPshadowthick); + + if(nowx-TJPzoomwidth*TJPzoomoffsetx < tmp) { + clip4=TJPzoomwidth*TJPzoomoffsetx-nowx + tmp; + } else if(parseFloat(nowx-TJPzoomwidth*TJPzoomoffsetx+TJPzoomwidth) > parseFloat(obj.style.width)+tmp) { + clip2= TJPzoomwidth*TJPzoomoffsetx - nowx + parseFloat(obj.style.width)+tmp; + nwidth=TJPzoomwidth*TJPzoomoffsetx-nowx+parseInt(obj.style.width)+TJPborderthick+TJPshadowthick; + } + + tmp=(1-2*TJPzoomoffsety)*(TJPborderthick+TJPshadowthick); + + if(nowy-TJPzoomheight*TJPzoomoffsety < tmp) { + clip1=TJPzoomheight*TJPzoomoffsety-nowy+tmp; + } else if(parseFloat(nowy-TJPzoomheight*TJPzoomoffsety+TJPzoomheight) > parseFloat(obj.style.height)+tmp) { + clip3= TJPzoomheight*TJPzoomoffsety - nowy + parseFloat(obj.style.height)+tmp; + nheight=TJPzoomheight*TJPzoomoffsety - nowy + parseFloat(obj.style.height)+TJPborderthick+TJPshadowthick; + }*/ + stage.style.width=nwidth+'px'; + stage.style.height=nheight+'px'; + + // stage.style.clip='rect('+clip1+'px,'+clip2+'px,'+clip3+'px,'+clip4+'px)'; + + if(nowy-TJPzoomoffsety*(TJPzoomheight-2*TJPborderthick-2*TJPshadowthick) < 0) { t=-(nowy-TJPzoomoffsety*(TJPzoomheight-2*TJPborderthick-2*TJPshadowthick))} + else if(nowy-TJPzoomoffsety*(TJPzoomheight-2*TJPborderthick-2*TJPshadowthick) > parseFloat(obj.style.height)-TJPzoomheight+TJPborderthick*2+TJPshadowthick*2) { t=-TJPzoomamount*parseFloat(obj.style.height)+TJPzoomheight-TJPborderthick*2-TJPshadowthick*2-((nowy-TJPzoomoffsety*(TJPzoomheight-2*TJPborderthick-2*TJPshadowthick))-(parseFloat(obj.style.height)-TJPzoomheight+TJPborderthick*2+TJPshadowthick*2)); } + else { t=(-TJPzoomamount*parseFloat(obj.style.height)+TJPzoomheight-TJPborderthick*2-TJPshadowthick*2)/(parseFloat(obj.style.height)-TJPzoomheight+TJPborderthick*2+TJPshadowthick*2)*(nowy-TJPzoomoffsety*(TJPzoomheight-2*TJPborderthick-2*TJPshadowthick)) } + stage.getElementsByTagName('div')[1].getElementsByTagName('img')[0].style.marginTop=t+'px'; + + if(nowx-TJPzoomoffsetx*(TJPzoomwidth-2*TJPborderthick-2*TJPshadowthick) < 0) { t=-(nowx-TJPzoomoffsetx*(TJPzoomwidth-2*TJPborderthick-2*TJPshadowthick))} + else if(nowx-TJPzoomoffsetx*(TJPzoomwidth-2*TJPborderthick-2*TJPshadowthick) > parseFloat(obj.style.width)-TJPzoomwidth+TJPborderthick*2+TJPshadowthick*2) { t=-TJPzoomamount*parseFloat(obj.style.width)+TJPzoomwidth-TJPborderthick*2-TJPshadowthick*2-((nowx-TJPzoomoffsetx*(TJPzoomwidth-2*TJPborderthick-2*TJPshadowthick))-(parseFloat(obj.style.width)-TJPzoomwidth+TJPborderthick*2+TJPshadowthick*2)); } + else { t=(-TJPzoomamount*parseFloat(obj.style.width)+TJPzoomwidth-TJPborderthick*2-TJPshadowthick*2)/(parseFloat(obj.style.width)-TJPzoomwidth+TJPborderthick*2+TJPshadowthick*2)*(nowx-TJPzoomoffsetx*(TJPzoomwidth-2*TJPborderthick-2*TJPshadowthick)) } + stage.getElementsByTagName('div')[1].getElementsByTagName('img')[0].style.marginLeft=t+'px'; + + + //document.getElementsByTagName('h1')[0].innerHTML=; +} + +function TJPinit() { + TJPadjustx=0; TJPadjusty=0; + if(navigator.userAgent.indexOf('MSIE')>-1) {TJPadjustx=2;TJPadjusty=2;} + if(navigator.userAgent.indexOf('Opera')>-1) {TJPadjustx=0; TJPadjusty=0;} + if(navigator.userAgent.indexOf('Safari')>-1) {TJPadjustx=1; TJPadjusty=2;} +} + +// configuration - do not modify the following, instead read the behaviors.html file in the tutorial! +var TJPon=new Array(); +var TJPadjustx,TJPadjusty; +var TJPmouse=0; var TJPmousey; +var TJPloading='
    '+localiser.localise('loading')+'
    '; + +var TJPzoomwidth= 160; +var TJPzoomheight= 120; +var TJPzoomratio; +var TJPzoomwindowlock=0; + +var TJPzoomoffsetx=TJPzoomwidth/2; +var TJPzoomoffsety=TJPzoomheight/2; +var TJPzoomoffset; + +var TJPzoomamount=4; +var TJPzoomamountmax=12; +var TJPzoomamountmin=1; + +var TJPborderthick=1; +var TJPbordercolor='#000000'; + +var TJPshadowthick=8; + +var shadowN = "data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%10%00%00%00%10%08%06%00%00%00%1F%F3%FFa%00%00%00%07tIME%07%D7%04%1A%16%1E9%9A%24%FF%19%00%00%00%09pHYs%00%00.%23%00%00.%23%01x%A5%3Fv%00%00%00%04gAMA%00%00%B1%8F%0B%FCa%05%00%00%00%15IDATx%DAc%60%18%05%C3%000B%F1(%18%05%14%01%00%08%9E%00%03%83%17%0BH%00%00%00%00IEND%AEB%60%82"; +var shadowNE = "data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%10%00%00%00%10%08%06%00%00%00%1F%F3%FFa%00%00%00%07tIME%07%D7%04%1A%16%1C1%A6%C9%15%A9%00%00%00%09pHYs%00%00.%23%00%00.%23%01x%A5%3Fv%00%00%00%04gAMA%00%00%B1%8F%0B%FCa%05%00%00%00%88IDATx%DA%ED%90%CB%0A%830%10E%13M%AA(t%D7%AD%82%FF%FFk%BA%F0I%F1%11o%E0%06B7%8E%DB%E2%C0a%20d%CE%3C%94z%E2%0FB%93%3B%E1~%05W%F1b%3E%A2%EC%82(%15%08%DE%C0%02%03%92%A8%A9XP%81%1Cd%D1%FF%B0%863%02A%0DV%B0%80%01%F4%D1*%87D%D0%80%2F%18A%CB7%2F%DC%C0.%9D%C0w%EF8%FAL%99%CFZ%22%F8%80%89%C5%13%EFa%C3A%25%82%92%C5%05%0FiyL%2FP'%B6%E5%1E%5D%DCX%24%10%00%00%00%00IEND%AEB%60%82"; +var shadowE = "data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%10%00%00%00%10%08%06%00%00%00%1F%F3%FFa%00%00%00%07tIME%07%D7%04%1A%16%1D%0F~%B39C%00%00%00%09pHYs%00%00.%23%00%00.%23%01x%A5%3Fv%00%00%00%04gAMA%00%00%B1%8F%0B%FCa%05%00%00%00%2BIDATx%DAcd%20%0C%D6%02%F1%17%20~%05%C4%0F%80%F8%0E%94~%0D%12g%22%C2%00%BC%60%D4%80Q%03F%0D%18%2C%06%00%00l%95%07%26%D9%C2%1F%9D%00%00%00%00IEND%AEB%60%82"; +var shadowSE = "data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%10%00%00%00%10%08%06%00%00%00%1F%F3%FFa%00%00%00%07tIME%07%D7%04%1A%16%1D(%DB%B9%8C(%00%00%00%09pHYs%00%00.%23%00%00.%23%01x%A5%3Fv%00%00%00%04gAMA%00%00%B1%8F%0B%FCa%05%00%00%00%9EIDATx%DA%ED%92A%0E%83%20%10E%B11%3D%40%EF%7F%85%DE%C8%85k%9B%D8%C4%9AR%A32~%F0O3%2B%60%D5U'y%40L%E6%F1A%1AW%AE%3B%98%C1%00z%D0q~%C4%EF%97%0AA%B6%FE%82%1F%09%02%11%83%D3u%EB%CE%FF%9Ck%5E%C9%06v%23K%15%05sA%10%1B%DFd%A1LEI0d%04B%81%07O%F0%02%1FJ%82%1E%A1%2F%DC%C1%C6%9Dc%D2%91%92%C5%0A%BAB%02%E1%8E%9E%CD%93IQ%95%40xfM%E2m%82%06%C3%ADB%20lP%D1N%92%E0%EA%EA*%98%F9%FB%1E%0E%F1sO6%10%CB%E6%9B%00%00%00%00IEND%AEB%60%82"; +var shadowS = "data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%10%00%00%00%10%08%06%00%00%00%1F%F3%FFa%00%00%00%07tIME%07%D7%04%1A%16%1D8%C6%0E%9CL%00%00%00%09pHYs%00%00.%23%00%00.%23%01x%A5%3Fv%00%00%00%04gAMA%00%00%B1%8F%0B%FCa%05%00%00%000IDATx%DAc%60%18%05%A3%80%81%81%11%88%D7Rb%00%0B%10%7F%A1%D4%80W%94%1A%F0%80R%03%EE%0C%A8%0B%40%B1%20D%A9%01l%94%18%00%002V%05W%11%99%89%DE%00%00%00%00IEND%AEB%60%82"; +var shadowSW = "data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%10%00%00%00%10%08%06%00%00%00%1F%F3%FFa%00%00%00%07tIME%07%D7%04%1A%16%1E%13A%9F6%CF%00%00%00%09pHYs%00%00.%23%00%00.%23%01x%A5%3Fv%00%00%00%04gAMA%00%00%B1%8F%0B%FCa%05%00%00%00%89IDATx%DA%ED%92K%0A%800%0CD%5B%AB%A2%E0R%B7%BA%F0%FE%97%13%2B%FEu%22%11%A5%0B%1B%10%5C9%F0%08%FDM%9A%B4J%3DK%7B%D6U%E0%DB%F0%1B%7C%60%F0Z%DEw%86%22%90%81%02%94%A0%06%15%C8i%3E%14%26Z%C1%02%260%80%8E%D1F%D8'J%14%83%14%24%3C%26%8D%12%03*%D38%D0%8Dz%D0J%0D%EEq%E6%C3%164%92%1El%9Cq%B8%19X.%C3H%5E%C1-%23%E4H%BD%D1R%83%D3D%AB%EB%F3%1Dq%07%2C%D4%13%98%99%83%B5%22%00%00%00%00IEND%AEB%60%82"; +var shadowW = "data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%10%00%00%00%10%08%06%00%00%00%1F%F3%FFa%00%00%00%07tIME%07%D7%04%1A%16%1E%20%FEOW%D9%00%00%00%09pHYs%00%00.%23%00%00.%23%01x%A5%3Fv%00%00%00%04gAMA%00%00%B1%8F%0B%FCa%05%00%00%00%1CIDATx%DAc%60%C0%0F%18%09%C830%11R0j%C0%A8%01%A3%06%0C%15%03%00D%F0%00%20zzK%0C%00%00%00%00IEND%AEB%60%82"; +var shadowNW = "data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%10%00%00%00%10%08%06%00%00%00%1F%F3%FFa%00%00%00%07tIME%07%D7%04%1A%16%1E%2Fn%F0JH%00%00%00%09pHYs%00%00.%23%00%00.%23%01x%A5%3Fv%00%00%00%04gAMA%00%00%B1%8F%0B%FCa%05%00%00%00%15IDATx%DAc%60%18%05%C3%000%D2I%CF(%18%E6%00%00%08n%00%03%9BHo7%00%00%00%00IEND%AEB%60%82"; + +if(GM_getValue('zoomwidth')) { + TJPzoomwidth = GM_getValue('zoomwidth'); + TJPzoomoffsetx=TJPzoomwidth/2 +} +if(GM_getValue('zoomheight')) { + TJPzoomheight = GM_getValue('zoomheight'); + TJPzoomoffsety=TJPzoomheight/2; +} + + +TJPinit(); + + + +// TJPzoom 3 * J�nos P�l T�th +// Docs @ http://valid.tjp.hu/tjpzoom/ +// News @ http://tjpzoom.blogspot.com/ + + +//********************************************************************** + + //====================================================================== + //to do the closure and get the right this. + //adapted from http://persistent.info/greasemonkey/gmail.user.js + + function getObjectMethodClosure2(object, method,args,args1,args2) { + return function() { + return object[method](args,args1,args2); + } + } + function getObjectMethodClosure1(object, method,args,args1) { + return function() { + return object[method](args,args1); + } + } + + function getObjectMethodClosure0(object, method,args) { + return function() { + return object[method](args); + } + } + + function getObjectMethodClosure(object, method) { + return function(args) { + return object[method](args); + } + } + + /* + Xpath trickery, from: + http://ecmanaut.blogspot.com/2006/07/expressive-user-scripts-with-xpath-and.html + */ + function $x( xpath, root ) + { + var doc = root ? root.evaluate?root:root.ownerDocument : document; + var got = doc.evaluate( xpath, root||doc, null, 0, null ), next; + var result = []; + while( next = got.iterateNext() ) + result.push( next ); + return result; + } + + + function $x1(xpath) { + return document.evaluate( + xpath, + document, + null, + XPathResult.FIRST_ORDERED_NODE_TYPE, null + ).singleNodeValue; + } + + function foreach( xpath, cb, root ) + { + var nodes = $x( xpath, root ), e = 0; + for( var i=0; i'; + modal.style.top = document.body.scrollTop+(document.body.clientHeight/2)+'px'; + + var dialog = modal.appendChild(document.createElement('div')); + dialog.setAttribute('style',"padding: 18px 16px;clear:both; width:70%;overflow:auto;margin-left:15%;"); + var content = dialog.appendChild(document.createElement('div')); + + var pAbout = content.appendChild(document.createElement("p")); + pAbout.setAttribute('style',"padding: 18px 16px;clear:both; width:100%;overflow:auto;"); + pAbout.innerHTML = localiser.localise('about',{ + 'jpl' : 'János Pál Tóth', + 'paypal' : '

    ', + 'pa' : 'Pierre Andrews' + }); + + var spanForm = content.appendChild(document.createElement("div")); + spanForm.setAttribute('style',"padding: 18px 16px;clear:both; width:100%;overflow:auto;"); + spanForm.innerHTML = '


    (*)'+localiser.localise('quality_note')+'.

    ' + + var buttons = dialog.appendChild(document.createElement('div')); + var ok = buttons.appendChild(document.createElement('button')); + ok.type ='button'; + ok.className='Butt'; + ok.innerHTML = localiser.localise('save'); + var cancel = buttons.appendChild(document.createElement('button')); + cancel.type ='button'; + cancel.className = 'Butt'; + cancel.innerHTML = localiser.localise('cancel'); + + cancel.addEventListener('click',function() { + document.body.removeChild(back); + document.body.removeChild(modal); + },true); + + + ok.addEventListener('click',function() { + var inp = document.getElementById("gm_mag_shoulduselarge"); + if(inp) { + GM_setValue('useLarge',inp.checked); + useLarge = inp.checked; + } + inp = document.getElementById("gm_mag_zoomheight"); + if(inp) { + GM_setValue('zoomheight',inp.value); + TJPzoomheight = inp.value; + TJPzoomoffsety=TJPzoomheight/2; + } + inp = document.getElementById("gm_mag_zoomwidth"); + if(inp) { + GM_setValue('zoomwidth',inp.value); + TJPzoomwidth = inp.value; + TJPzoomoffsetx=TJPzoomwidth/2; + } + + + document.body.removeChild(back); + document.body.removeChild(modal); + },true); + + modal.style.top = document.body.scrollTop+((document.body.clientHeight-modal.scrollHeight)/2)+'px'; + }; + GM_registerMenuCommand( localiser.localise("menu_item"), prompt_conf); + + + //====================================================================== + + + try { + window.addEventListener("load", function () { + + init(); + }, false); + } catch (ex) {} + + +})(); diff --git a/flickrrefercomment.user.js b/flickrrefercomment.user.js index cf59756..2924619 100644 --- a/flickrrefercomment.user.js +++ b/flickrrefercomment.user.js @@ -137,7 +137,10 @@ } else if(referrer.indexOf('/interesting') >= 0 && referrer.indexOf('/explore') >= 0) { //we come from one of the interesting calendar this.insertComment("Seen in the interestingness archives.",referrer); - } else if(referrer.indexOf('/explore') >= 0) { + } else if(referrer.indexOf('http://www.raum-fuer-notizen.de/explore/index.php?username=') >= 0) { + //we come from the individual explore page + this.insertComment("Seen on my individual explore page.",referrer); + } else if(referrer.indexOf('/explore') >= 0) { //we come from the explore page this.insertComment("Seen on the explore page.",referrer); } else if(referrer.indexOf('/search') >= 0) { diff --git a/flickrsnap.user.js b/flickrsnap.user.js index 7b197e1..8a324af 100644 --- a/flickrsnap.user.js +++ b/flickrsnap.user.js @@ -17,6 +17,7 @@ // @include * // @exclude http://flickr.com* // @exclude http://www.flickr.com* +// @exclude http:/del.icio.us* // ==/UserScript== (function () { @@ -99,269 +100,6 @@ } - //====================================================================== - - - /* - * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message - * Digest Algorithm, as defined in RFC 1321. - * Version 2.1 Copyright (C) Paul Johnston 1999 - 2002. - * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet - * Distributed under the BSD License - * See http://pajhome.org.uk/crypt/md5 for more info. - */ - - /* - * Configurable variables. You may need to tweak these to be compatible with - * the server-side, but the defaults work in most cases. - */ - var hexcase = 0; /* hex output format. 0 - lowercase; 1 - uppercase */ - var b64pad = ""; /* base-64 pad character. "=" for strict RFC compliance */ - var chrsz = 8; /* bits per input character. 8 - ASCII; 16 - Unicode */ - - /* - * These are the functions you'll usually want to call - * They take string arguments and return either hex or base-64 encoded strings - */ - function hex_md5(s){ return binl2hex(core_md5(str2binl(s), s.length * chrsz));} - function b64_md5(s){ return binl2b64(core_md5(str2binl(s), s.length * chrsz));} - function str_md5(s){ return binl2str(core_md5(str2binl(s), s.length * chrsz));} - function hex_hmac_md5(key, data) { return binl2hex(core_hmac_md5(key, data)); } - function b64_hmac_md5(key, data) { return binl2b64(core_hmac_md5(key, data)); } - function str_hmac_md5(key, data) { return binl2str(core_hmac_md5(key, data)); } - - /* - * Perform a simple self-test to see if the VM is working - */ - function md5_vm_test() - { - return hex_md5("abc") == "900150983cd24fb0d6963f7d28e17f72"; - } - - /* - * Calculate the MD5 of an array of little-endian words, and a bit length - */ - function core_md5(x, len) - { - /* append padding */ - x[len >> 5] |= 0x80 << ((len) % 32); - x[(((len + 64) >>> 9) << 4) + 14] = len; - - var a = 1732584193; - var b = -271733879; - var c = -1732584194; - var d = 271733878; - - for(var i = 0; i < x.length; i += 16) - { - var olda = a; - var oldb = b; - var oldc = c; - var oldd = d; - - a = md5_ff(a, b, c, d, x[i+ 0], 7 , -680876936); - d = md5_ff(d, a, b, c, x[i+ 1], 12, -389564586); - c = md5_ff(c, d, a, b, x[i+ 2], 17, 606105819); - b = md5_ff(b, c, d, a, x[i+ 3], 22, -1044525330); - a = md5_ff(a, b, c, d, x[i+ 4], 7 , -176418897); - d = md5_ff(d, a, b, c, x[i+ 5], 12, 1200080426); - c = md5_ff(c, d, a, b, x[i+ 6], 17, -1473231341); - b = md5_ff(b, c, d, a, x[i+ 7], 22, -45705983); - a = md5_ff(a, b, c, d, x[i+ 8], 7 , 1770035416); - d = md5_ff(d, a, b, c, x[i+ 9], 12, -1958414417); - c = md5_ff(c, d, a, b, x[i+10], 17, -42063); - b = md5_ff(b, c, d, a, x[i+11], 22, -1990404162); - a = md5_ff(a, b, c, d, x[i+12], 7 , 1804603682); - d = md5_ff(d, a, b, c, x[i+13], 12, -40341101); - c = md5_ff(c, d, a, b, x[i+14], 17, -1502002290); - b = md5_ff(b, c, d, a, x[i+15], 22, 1236535329); - - a = md5_gg(a, b, c, d, x[i+ 1], 5 , -165796510); - d = md5_gg(d, a, b, c, x[i+ 6], 9 , -1069501632); - c = md5_gg(c, d, a, b, x[i+11], 14, 643717713); - b = md5_gg(b, c, d, a, x[i+ 0], 20, -373897302); - a = md5_gg(a, b, c, d, x[i+ 5], 5 , -701558691); - d = md5_gg(d, a, b, c, x[i+10], 9 , 38016083); - c = md5_gg(c, d, a, b, x[i+15], 14, -660478335); - b = md5_gg(b, c, d, a, x[i+ 4], 20, -405537848); - a = md5_gg(a, b, c, d, x[i+ 9], 5 , 568446438); - d = md5_gg(d, a, b, c, x[i+14], 9 , -1019803690); - c = md5_gg(c, d, a, b, x[i+ 3], 14, -187363961); - b = md5_gg(b, c, d, a, x[i+ 8], 20, 1163531501); - a = md5_gg(a, b, c, d, x[i+13], 5 , -1444681467); - d = md5_gg(d, a, b, c, x[i+ 2], 9 , -51403784); - c = md5_gg(c, d, a, b, x[i+ 7], 14, 1735328473); - b = md5_gg(b, c, d, a, x[i+12], 20, -1926607734); - - a = md5_hh(a, b, c, d, x[i+ 5], 4 , -378558); - d = md5_hh(d, a, b, c, x[i+ 8], 11, -2022574463); - c = md5_hh(c, d, a, b, x[i+11], 16, 1839030562); - b = md5_hh(b, c, d, a, x[i+14], 23, -35309556); - a = md5_hh(a, b, c, d, x[i+ 1], 4 , -1530992060); - d = md5_hh(d, a, b, c, x[i+ 4], 11, 1272893353); - c = md5_hh(c, d, a, b, x[i+ 7], 16, -155497632); - b = md5_hh(b, c, d, a, x[i+10], 23, -1094730640); - a = md5_hh(a, b, c, d, x[i+13], 4 , 681279174); - d = md5_hh(d, a, b, c, x[i+ 0], 11, -358537222); - c = md5_hh(c, d, a, b, x[i+ 3], 16, -722521979); - b = md5_hh(b, c, d, a, x[i+ 6], 23, 76029189); - a = md5_hh(a, b, c, d, x[i+ 9], 4 , -640364487); - d = md5_hh(d, a, b, c, x[i+12], 11, -421815835); - c = md5_hh(c, d, a, b, x[i+15], 16, 530742520); - b = md5_hh(b, c, d, a, x[i+ 2], 23, -995338651); - - a = md5_ii(a, b, c, d, x[i+ 0], 6 , -198630844); - d = md5_ii(d, a, b, c, x[i+ 7], 10, 1126891415); - c = md5_ii(c, d, a, b, x[i+14], 15, -1416354905); - b = md5_ii(b, c, d, a, x[i+ 5], 21, -57434055); - a = md5_ii(a, b, c, d, x[i+12], 6 , 1700485571); - d = md5_ii(d, a, b, c, x[i+ 3], 10, -1894986606); - c = md5_ii(c, d, a, b, x[i+10], 15, -1051523); - b = md5_ii(b, c, d, a, x[i+ 1], 21, -2054922799); - a = md5_ii(a, b, c, d, x[i+ 8], 6 , 1873313359); - d = md5_ii(d, a, b, c, x[i+15], 10, -30611744); - c = md5_ii(c, d, a, b, x[i+ 6], 15, -1560198380); - b = md5_ii(b, c, d, a, x[i+13], 21, 1309151649); - a = md5_ii(a, b, c, d, x[i+ 4], 6 , -145523070); - d = md5_ii(d, a, b, c, x[i+11], 10, -1120210379); - c = md5_ii(c, d, a, b, x[i+ 2], 15, 718787259); - b = md5_ii(b, c, d, a, x[i+ 9], 21, -343485551); - - a = safe_add(a, olda); - b = safe_add(b, oldb); - c = safe_add(c, oldc); - d = safe_add(d, oldd); - } - return Array(a, b, c, d); - - } - - /* - * These functions implement the four basic operations the algorithm uses. - */ - function md5_cmn(q, a, b, x, s, t) - { - return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s),b); - } - function md5_ff(a, b, c, d, x, s, t) - { - return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t); - } - function md5_gg(a, b, c, d, x, s, t) - { - return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t); - } - function md5_hh(a, b, c, d, x, s, t) - { - return md5_cmn(b ^ c ^ d, a, b, x, s, t); - } - function md5_ii(a, b, c, d, x, s, t) - { - return md5_cmn(c ^ (b | (~d)), a, b, x, s, t); - } - - /* - * Calculate the HMAC-MD5, of a key and some data - */ - function core_hmac_md5(key, data) - { - var bkey = str2binl(key); - if(bkey.length > 16) bkey = core_md5(bkey, key.length * chrsz); - - var ipad = Array(16), opad = Array(16); - for(var i = 0; i < 16; i++) - { - ipad[i] = bkey[i] ^ 0x36363636; - opad[i] = bkey[i] ^ 0x5C5C5C5C; - } - - var hash = core_md5(ipad.concat(str2binl(data)), 512 + data.length * chrsz); - return core_md5(opad.concat(hash), 512 + 128); - } - - /* - * Add integers, wrapping at 2^32. This uses 16-bit operations internally - * to work around bugs in some JS interpreters. - */ - function safe_add(x, y) - { - var lsw = (x & 0xFFFF) + (y & 0xFFFF); - var msw = (x >> 16) + (y >> 16) + (lsw >> 16); - return (msw << 16) | (lsw & 0xFFFF); - } - - /* - * Bitwise rotate a 32-bit number to the left. - */ - function bit_rol(num, cnt) - { - return (num << cnt) | (num >>> (32 - cnt)); - } - - /* - * Convert a string to an array of little-endian words - * If chrsz is ASCII, characters >255 have their hi-byte silently ignored. - */ - function str2binl(str) - { - var bin = Array(); - var mask = (1 << chrsz) - 1; - for(var i = 0; i < str.length * chrsz; i += chrsz) - bin[i>>5] |= (str.charCodeAt(i / chrsz) & mask) << (i%32); - return bin; - } - - /* - * Convert an array of little-endian words to a string - */ - function binl2str(bin) - { - var str = ""; - var mask = (1 << chrsz) - 1; - for(var i = 0; i < bin.length * 32; i += chrsz) - str += String.fromCharCode((bin[i>>5] >>> (i % 32)) & mask); - return str; - } - - /* - * Convert an array of little-endian words to a hex string. - */ - function binl2hex(binarray) - { - var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef"; - var str = ""; - for(var i = 0; i < binarray.length * 4; i++) - { - str += hex_tab.charAt((binarray[i>>2] >> ((i%4)*8+4)) & 0xF) + - hex_tab.charAt((binarray[i>>2] >> ((i%4)*8 )) & 0xF); - } - return str; - } - - /* - * Convert an array of little-endian words to a base-64 string - */ - function binl2b64(binarray) - { - var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - var str = ""; - for(var i = 0; i < binarray.length * 4; i += 3) - { - var triplet = (((binarray[i >> 2] >> 8 * ( i %4)) & 0xFF) << 16) - | (((binarray[i+1 >> 2] >> 8 * ((i+1)%4)) & 0xFF) << 8 ) - | ((binarray[i+2 >> 2] >> 8 * ((i+2)%4)) & 0xFF); - for(var j = 0; j < 4; j++) - { - if(i * 8 + j * 6 > binarray.length * 32) str += b64pad; - else str += tab.charAt((triplet >> 6*(3-j)) & 0x3F); - } - } - return str; - } - - - - //====================================================================== //====================================================================== @@ -650,10 +388,8 @@ }, getSetPhotos_done: function(req,rsp,link) { var primary = rsp..photo.(@isprimary == '1'); - this.api.flickr_api_call('flickr.photos.getSizes', - { photo_id: primary.@id, http_method: 'POST' }, - getObjectMethodClosure21(this,'getSizes_done', link), - getObjectMethodClosure1(this,'request_failed')); + img = link.appendChild(document.createElement('IMG')); + img.src = "http://static.flickr.com/"+primary.@server+"/"+primary.@id+'_'+primary.@secret+'_s.jpg'; } } diff --git a/flickrstylecontacts.user.js b/flickrstylecontacts.user.js index d559118..cc8c25c 100644 --- a/flickrstylecontacts.user.js +++ b/flickrstylecontacts.user.js @@ -29,6 +29,7 @@ // @include http://*flickr.com/photos_comments.gne* // @include http://*flickr.com/people/* // @include http://*flickr.com/photos/*/sets/*/comments/ +// @exclude http://*flickr.com/photos/organize* // ==/UserScript== (function () { diff --git a/flickrupcomingevent.user.js b/flickrupcomingevent.user.js index 3bde6a3..2e7f462 100644 --- a/flickrupcomingevent.user.js +++ b/flickrupcomingevent.user.js @@ -1,659 +1,696 @@ -// ==UserScript== -// @name Flickr Upcoming Event -// @namespace http://6v8.gamboni.org/ -// @description This is a greasemonkey script to enhance flickr pages and be able to easilly associate photos with an upcoming event. When a shot is associated to an event, it can then be tagged and located from the data provided by the event. -// @version 0.6 -// @identifier http://6v8.gamboni.org/IMG/js/flickrupcomingevent.user.js -// @date 2007-26-06 -// @creator Pierre Andrews (mortimer.pa@free.fr) -// @include http://*flickr.com/photos/*/* -// @exclude http://*flickr.com/photos/organize* -// ==/UserScript== - -// -------------------------------------------------------------------- -// -// This is a Greasemonkey user script. -// -// To install, you need Greasemonkey: http://greasemonkey.mozdev.org/ -// Then restart Firefox and revisit this script. -// Under Tools, there will be a new menu item to "Install User Script". -// Accept the default configuration and install. -// -// -------------------------------------------------------------------- -// Copyright (C) 2006 Pierre Andrews -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// The GNU General Public License is available by visiting -// http://www.gnu.org/copyleft/gpl.html -// or by writing to -// Free Software Foundation, Inc. -// 51 Franklin Street, Fifth Floor -// Boston, MA 02110-1301 -// USA - -var DEBUG = false; -var UPCOMING_API_URL = 'http://upcoming.yahooapis.com/services/rest/'; - -(function () { - - - //update information - var SCRIPT = { - name: "Flickr Upcoming Event", - namespace: "http://6v8.gamboni.org/", - description: "This is a greasemonkey script to enhance flickr pages and be able to easilly associate photos with an upcoming event. When a shot is associated to an event, it can then be tagged and located from the data provided by the event.", - identifier: "http://6v8.gamboni.org/IMG/js/flickrupcomingevent.user.js", - version: "0.6", // version - date: (new Date("2007-26-06")) // update date - .valueOf() - }; - - /* - Path to wrap descriptions by Johan Sundstr�m - http://www.lysator.liu.se/~jhs/ - */ - function wbr( html ) { - return (''+html).replace( /[-\/_.]|\w{20}/g, - function( c ){ return c+''; } ); - } - - function M8_log() { - if(unsafeWindow.console) - unsafeWindow.console.log(arguments); - else - GM_log(arguments); - } - - function getObjectMethodClosure01(object, method,arg1) { - return function(arg) { - return object[method](arg1); - } - } - - - function getObjectMethodClosure03(object, method,arg1,arg2,arg3) { - return function(arg) { - return object[method](arg1,arg2,arg3); - } - } - - function getObjectMethodClosure11(object, method,arg1) { - return function(arg) { - return object[method](arg,arg1); - } - } - function getObjectMethodClosure12(object, method,arg1,arg2) { - return function(arg) { - return object[method](arg,arg1,arg2); - } - } - function getObjectMethodClosure13(object, method,arg1,arg2,arg3) { - return function(arg) { - return object[method](arg,arg1,arg2,arg3); - } - } - - function $x1(xpath) { - return document.evaluate( - xpath, - document, - null, - XPathResult.FIRST_ORDERED_NODE_TYPE, null - ).singleNodeValue; - } - - - /*********************************************************************** - * Flickr Localisation - **********************************************************************/ - - var FlickrLocaliser = function(locals) { - this.init(locals); - } - FlickrLocaliser.prototype = { - selectedLang: undefined, - localisations: undefined, - getLanguage: function() { - if(!this.selectedLang) { - var langA = $x1("//p[@class='LanguageSelector']//a[contains(@class,'selected')]"); - if(langA) { - var matches = /\/change_language.gne\?lang=([^&]+)&.*/.exec(langA.href); - if(matches && matches[1]) { - this.selectedLang = matches[1]; - return this.selectedLang; - } - } - return false; - } else return this.selectedLang; - }, - - init: function(locals) { - this.localisations = locals; - }, - - localise: function(string, params) { - if(this.localisations && this.getLanguage()) { - var currentLang = this.localisations[this.selectedLang]; - if(!currentLang) currentLang = this.localisations[this.localisations.defaultLang]; - var local = currentLang[string]; - if(!local) return string; - for(arg in params) { - var rep = new RegExp('@'+arg+'@','g'); - local = local.replace(rep,params[arg]); - } - local =local.replace(/@[^@]+@/g,''); - return local; - } else return undefined; - } - - } - - /*****************************Flickr Localisation**********************/ - - - var flickrupcomingevent = function() {this.init();} - - flickrupcomingevent.prototype = { - UPCOMING_API_KEY: '684909d568', - tagged: false, - canTag: false, - upcoming_token: GM_getValue('upcoming_token'), - upcoming_user_name: GM_getValue('upcoming_user_name'), - upcoming_user_username: GM_getValue('upcoming_user_username'), - upcoming_user_id: GM_getValue('upcoming_user_id'), - - event_id: '', - events: {}, - localiser: new FlickrLocaliser({ - 'en-us': { - 'script_title' : 'Upcoming.org event tool', - 'auth_1' : 'You first have to authorize the connection with upcoming. First go ', - 'auth_2' : 'When you are done, come back to this page and', - 'auth_3' : 'Enter the frob given by upcoming here', - 'finish_auth' : 'Finish authorization', - 'loading_details' : 'Getting event details', - 'fetch_events' : 'Fetching events', - 'event' : 'Event', - 'metro' : 'Metro', - 'searching' : 'searching', - 'venue' : 'Venue', - 'description' : 'Description', - 'see_other' : 'See other photos from this event by: @this_user@, @everyone@', - 'this_user' : 'This User', - 'everyone' : 'Everyone', - 'geotag' : 'geotag this photo', - 'Tag' : 'Tag', - 'select_event' : 'Select the event this photo was taken at', - 'error' : 'There was an error, please see the console for details.' - }, - 'fr-fr': { - // T - 'Tag' : 'Tagger', - // A - 'auth_1' : 'Vous devez d\'abord autoriser la connection avec upcoming.org. Commencez par', - 'auth_2' : 'Quand vous avez fini, revenez sur cette page et', - 'auth_3' : 'Entrez le frob donné par upcoming.org ici', - // D - 'description' : 'Description', - // E - 'error' : 'Il y a eu une erreur, veillez consulter les logs pour plus de détails.', - 'event' : 'Évènement', - 'everyone' : 'Tous le monde', - // F - 'fetch_events' : 'Récupération des évènements', - 'finish_auth' : 'Finir l\'autorisation', - // G - 'geotag' : 'Geotagger cette photo', - // L - 'loading_details' : 'Récupération des détails de l\'évènement', - // M - 'metro' : 'Metro', - // S - 'script_title' : 'Outil des évènements Upcoming.org', - 'searching' : 'En Recherche', - 'see_other' : 'Voir les autres photos de cet évènement par: @this_user@, @everyone@', - 'select_event' : 'Sélectionner l\'évènement auquel la photo a été prise', - // T - 'this_user' : 'Cet Utilisateur', - // V - 'venue' : 'Lieu' - }, - defaultLang: 'en-us' - }), - - init: function() { - - if(unsafeWindow.page_photo_id) { - var privacy_and_upcoming = document.evaluate( - "//p[@class='Privacy']", - document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null - ).singleNodeValue; - - var div; - var links = privacy_and_upcoming.getElementsByTagName('a'); - if(links.length > 0) { - for(var i = 0; i < links.length; i++) { - link = links[i]; - var matches; - if(matches = /http:\/\/upcoming.org\/event\/([0-9]+)/.exec(link.href)) { - this.tagged = true; - this.event_id = matches[1]; - break; - } - } - link.parentNode.appendChild(document.createElement('br')); - div = link.parentNode.appendChild(document.createElement('div')); - } else { - privacy_and_upcoming.appendChild(document.createElement('br')); - div = privacy_and_upcoming.appendChild(document.createElement('div')); - } - if(!this.upcoming_token) { - var img = div.appendChild(document.createElement('img')); - img.align="left"; - img.alt=this.localiser.localiser("script_title"); - img.src="/images/icon_upcoming_over.gif"; - div.appendChild(document.createTextNode(this.localiser.localise('auth_1'))); - var a = div.appendChild(document.createElement('a')); - a.innerHTML = 'here'; - a.target = 'blank'; - a.href= 'http://upcoming.org/services/auth/?api_key='+this.UPCOMING_API_KEY; - div.appendChild(document.createTextNode('. '+this.localiser.localise('auth_2')+':')); - div.appendChild(document.createElement('br')); - var label = div.appendChild(document.createElement('label')); - label.htmlFor = 'upcoming_frob'; - label.innerHTML = this.localiser.localise('auth_3'); - var input = div.appendChild(document.createElement('input')); - input.id = 'upcoming_frob'; - var button = document.createElement('button'); - button.type = 'button'; - button.innerHTML = this.localiser.localise('finish_auth'); - button.addEventListener('click',getObjectMethodClosure01(this,'finishAuth',input),true); - button.className = 'SmallButt'; - div.appendChild(button); - } else { - this.upcomingAuthenticated(div); - } - } - }, - - finishAuth: function(input) { - this.makeUpcomingCall('auth.getToken',{frob: input.value},getObjectMethodClosure11(this,'authDone',input.parentNode),getObjectMethodClosure11(this,'authError',input.parentNode)); - }, - - authDone: function(rsp,div) { - this.upcoming_token = ''+rsp.token.@token; - this.upcoming_user_username = ''+rsp.token.@user_username; - this.upcoming_user_name = ''+rsp.token.@user_name; - this.upcoming_user_id = ''+rsp.token.@user_id; - - GM_setValue('upcoming_token',this.upcoming_token); - GM_setValue('upcoming_user_username',this.upcoming_user_username); - GM_setValue('upcoming_user_name',this.upcoming_user_name); - GM_setValue('upcoming_user_id',this.upcoming_user_id); - - this.upcomingAuthenticated(div); - }, - - authError: function(msg,div) { - GM_setValue('upcoming_token',''); - }, - - upcomingAuthenticated: function(div) { - if(!this.tagged) { - for each(tag in unsafeWindow.global_photos[unsafeWindow.page_photo_id].tags_rawA) { - if(tag.indexOf('upcoming:') >= 0) { - this.tagged = true; - this.event_id = tag.replace('upcoming:',''); - } - } - } - var tagger = document.getElementById('tagadder'); - if(tagger) { - this.canTag = true; - } - if(this.tagged) { - div.innerHTML = ' '+this.localiser.localise('loading_details')+'.'; - this.makeUpcomingCall('event.getInfo',{event_id:this.event_id},getObjectMethodClosure11(this,'eventInfoReceived',div),getObjectMethodClosure11(this,'standard_error',div)); - } else { - if(this.canTag) { - div.innerHTML = ' '+this.localiser.localise('fetch_events')+'.'; - this.makeUpcomingCall('user.getWatchlist',{user_id:this.upcoming_user_id,show:'past'},getObjectMethodClosure11(this,'eventListDetailedReceived',div),getObjectMethodClosure11(this,'standard_error',div)); - } - } - }, - - eventInfoReceived: function(rsp,div) { - var event = rsp.event; - this.events[event.@id] = {id:event.@id, - username:event.@username, - status:event.@status, - name: event.@name, - tags: event.@tags, - description: event.@description, - start_date: event.@start_date, - end_date: event.@end_date, - start_time: event.@start_time, - end_time: event.@end_time, - personal: event.@personal, - metro_id: event.@metro_id, - venue_id: event.@venue_id, - user_id: event.@user_id, - category_id: event.@category_id, - latitude: event.@latitude, - longitude: event.@longitude, - geocoding_precision: event.@geocoding_precision, - geocoding_ambiguous: event.@geocoding_ambiguous - }; - this.displayEventInfo(div); - }, - - - autoTag: function(tags) { - unsafeWindow.tagrs_addTag(unsafeWindow.page_photo_id,tags); - }, - - displayEventInfo: function(div) { - div.innerHTML = ''; - div.setAttribute('style','position:relative;left:-18px;'); - event = this.events[this.event_id]; - var ul = div.appendChild(document.createElement('ul')); - ul.setAttribute('style',"margin: 0 24px;list-style-image:url(/images/icon_upcoming_over.gif);"); - - var li = ul.appendChild(document.createElement('li')); - li.className="Stats"; - li.innerHTML = ''+this.localiser.localise('event')+': '+event.name+' '; - if(this.canTag) { - var a = li.appendChild(document.createElement('a')); - a.setAttribute('style',"text-decoration: none; color: rgb(201, 201, 201);"); - a.href="javascript:;"; - a.innerHTML = '[+]'; - a.addEventListener('click',getObjectMethodClosure01(this,'autoTag','"'+event.name+'"'),true); - } - - var li = ul.appendChild(document.createElement('li')); - li.className="Stats"; - li.innerHTML = ''+this.localiser.localise('metro')+': '+this.localiser.localise('searching')+'...'; - this.makeUpcomingCall('metro.getInfo',{metro_id:event.metro_id},getObjectMethodClosure11(this,'metroInfoReceived',li),getObjectMethodClosure11(this,'standard_error',li)); - - - var li = ul.appendChild(document.createElement('li')); - li.className="Stats"; - li.innerHTML = ''+this.localiser.localise('venue')+': '+this.localiser.localise('searching')+'...'; - this.makeUpcomingCall('venue.getInfo',{venue_id:event.venue_id},getObjectMethodClosure11(this,'venueInfoReceived',li),getObjectMethodClosure11(this,'standard_error',li)); - - - if(event.description+"") { - var li = ul.appendChild(document.createElement('li')); - li.className="Stats"; - li.innerHTML = ''+this.localiser.localise('description')+': '+wbr(event.description); - } - - var li = ul.appendChild(document.createElement('li')); - li.className="Stats"; - li.innerHTML = this.localiser.localise('see_other',{ - 'this_user':''+this.localiser.localise('this_user')+'', 'everyone':''+this.localiser.localise('everyone')+''}); - }, - - metroInfoReceived: function(rsp,li) { - var metro = rsp.metro[0]; - - this.makeUpcomingCall('state.getInfo',{state_id:metro.@state_id},getObjectMethodClosure12(this,'stateInfoReceived',li,metro),getObjectMethodClosure11(this,'standard_error',li)); - }, - - stateInfoReceived: function(rsp,li,metro) { - var state = rsp.state[0]; - - this.makeUpcomingCall('country.getInfo',{country_id:state.@country_id},getObjectMethodClosure13(this,'countryInfoReceived',li,metro,state),getObjectMethodClosure11(this,'standard_error',li)); - }, - - countryInfoReceived: function(rsp,li,metro,state) { - var country = rsp.country[0]; - li.innerHTML = ''+this.localiser.localise('metro')+': '+country.@name+' > '+state.@name+' > '+metro.@name+' '; - if(this.canTag) { - var a = li.appendChild(document.createElement('a')); - a.setAttribute('style',"text-decoration: none; color: rgb(201, 201, 201);"); - a.href="javascript:;"; - a.innerHTML = '[+]'; - a.addEventListener('click',getObjectMethodClosure01(this,'autoTag','"'+country.@name+'" "'+state.@name+'" "'+metro.@name+'" "'+country.@name+'>'+state.@name+'>'+metro.@name+'"'),true); - } - }, - - venueInfoReceived: function(rsp,li) { - var venue = rsp.venue[0]; - /**/ - - li.innerHTML = ''; - var b = li.appendChild(document.createElement('b')); - b.innerHTML = this.localiser.localise('venue')+': '; - - var venue_link = li.appendChild(document.createElement('a')); - venue_link.href= venue.@url; - venue_link.innerHTML = venue.@name+' '; - if(this.canTag) { - var a = li.appendChild(document.createElement('a')); - a.setAttribute('style',"text-decoration: none; color: rgb(201, 201, 201);"); - a.href="javascript:;"; - a.innerHTML = '[+]'; - a.addEventListener('click',getObjectMethodClosure01(this,'autoTag','"'+venue.@name+'"'),true); - } - - var ul = li.appendChild(document.createElement('ul')); - // ul.setAttribute('style','list-style-type:none;'); - - if(venue.@address+"") { - var li2 = ul.appendChild(document.createElement('li')); - li2.className = 'Stats'; - li2.setAttribute('style','list-style-type:none; list-style-image:none;'); - li2.innerHTML = venue.@address+' '; - if(this.canTag) { - var a = li2.appendChild(document.createElement('a')); - a.setAttribute('style',"text-decoration: none; color: rgb(201, 201, 201);"); - a.href="javascript:;"; - a.innerHTML = '[+]'; - a.addEventListener('click',getObjectMethodClosure01(this,'autoTag','"'+venue.@address+'"'),true); - } - } - - if(venue.@city+"") { - var li2 = ul.appendChild(document.createElement('li')); - li2.className = 'Stats'; - li2.setAttribute('style','list-style-type:none; list-style-image:none;'); - li2.innerHTML = venue.@city+' '; - if(this.canTag) { - var a = li2.appendChild(document.createElement('a')); - a.setAttribute('style',"text-decoration: none; color: rgb(201, 201, 201);"); - a.href="javascript:;"; - a.innerHTML = '[+]'; - a.addEventListener('click',getObjectMethodClosure01(this,'autoTag','"'+venue.@city+'"'),true); - } - } - - if(venue.@zip+"") { - var li2 = ul.appendChild(document.createElement('li')); - li2.className = 'Stats'; - li2.setAttribute('style','list-style-type:none; list-style-image:none;'); - li2.innerHTML = venue.@zip+' '; - if(this.canTag) { - var a = li2.appendChild(document.createElement('a')); - a.setAttribute('style',"text-decoration: none; color: rgb(201, 201, 201);"); - a.href="javascript:;"; - a.innerHTML = '[+]'; - a.addEventListener('click',getObjectMethodClosure01(this,'autoTag','"'+venue.@zip+'"'),true); - } - } - - if(unsafeWindow.global_photos[unsafeWindow.page_photo_id].isOwner && venue.@longitude+"" && venue.@latitude+"" && venue.@geocoding_ambiguous*1 == 0) { - var li2 = ul.appendChild(document.createElement('li')); - li2.setAttribute('style','list-style-type:none; list-style-image:none;'); - li2.className = 'Stats'; - var a = li2.appendChild(document.createElement('a')); - a.setAttribute('style',"text-decoration: none; color: rgb(201, 201, 201);"); - a.innerHTML = this.localiser.localise('geotag'); - a.href="javascript:;"; - a.addEventListener('click',getObjectMethodClosure03(this,'setLatLon',venue.@latitude,venue.@longitude,venue.@geocoding_precision),true); - } - - }, - - setLatLon: function(lat,lon,precision) { - var accuracy = 6; //default accuracy is ~region accuracy - switch(precision) { - case 'zip': - accuracy = 11; - break; - case 'address': - accuracy = 16; - break; - } - var listener = { - flickr_photos_geo_setLocation_onLoad: function(success, responseXML, responseText, params){ - if(DEBUG) M8_log(responseText); - } - }; - - unsafeWindow.F.API.callMethod('flickr.photos.geo.setLocation', {photo_id:unsafeWindow.page_photo_id,lat:lat,lon:lon,accuracy:accuracy}, listener); - }, - - /* eventListReceived: function(rsp,div) { - var event_ids = ''; - for each(w in rsp..watchlist) { - event_ids += ','+w.@event_id; - } - event_ids = event_ids.substr(1); - this.makeUpcomingCall('event.getInfo',{event_id:event_ids},getObjectMethodClosure11(this,'eventListDetailedReceived',div),getObjectMethodClosure11(this,'standard_error',div)); - - },*/ - - eventListDetailedReceived: function(rsp, div) { - var select = document.createElement("select"); - select.id = 'upcoming_event_select'; - select.setAttribute("style","display:block;"); - for each(event in rsp..event) { - var name=""+event.@name; - if(name.length > 50) { - name = name.substring(0,47)+"..."; - } - - var option = select.appendChild(document.createElement("option")); - option.value = event.@id; - option.innerHTML = name+' ('+event.@start_date+')'; - this.events[event.@id] = {id:event.@id, - username:event.@username, - status:event.@status, - name: event.@name, - tags: event.@tags, - description: event.@description, - start_date: event.@start_date, - end_date: event.@end_date, - start_time: event.@start_time, - end_time: event.@end_time, - personal: event.@personal, - metro_id: event.@metro_id, - venue_id: event.@venue_id, - user_id: event.@user_id, - category_id: event.@category_id, - latitude: event.@latitude, - longitude: event.@longitude, - geocoding_precision: event.@geocoding_precision, - geocoding_ambiguous: event.@geocoding_ambiguous - }; - } - var button = document.createElement('button'); - button.type = 'button'; - button.innerHTML = this.localiser.localise('Tag'); - button.addEventListener('click',getObjectMethodClosure01(this,'tagPhoto',select),true); - button.className = 'SmallButt'; - var label = div.appendChild(document.createElement('label')); - label.htmlFor = 'upcoming_event_select'; - label.innerHTML = this.localiser.localise('select_event')+':'; - label.setAttribute("style","display:block;"); - div.innerHTML = ''; - var img = div.appendChild(document.createElement('img')); - img.align="left"; - img.alt= this.localiser.localise('script_title'); - img.src="/images/icon_upcoming_over.gif"; - div.appendChild(label); - div.appendChild(select); - div.appendChild(button); - }, - - tagPhoto: function(select) { - unsafeWindow.tagrs_addTag(unsafeWindow.page_photo_id,'"upcoming:event='+select.value+'" upcoming'); - this.event_id = select.value; - this.displayEventInfo(select.parentNode); - }, - - makeUpcomingCall: function(method,params,callback,error) { - var url_params = ''; - for (p in params) { - url_params += '&'+encodeURIComponent(p)+'='+encodeURIComponent(params[p]); - } - if(this.upcoming_token) url_params += '&token='+this.upcoming_token; - if(DEBUG) M8_log(url_params); - GM_xmlhttpRequest({method: "GET", - url: UPCOMING_API_URL+"/?api_key="+this.UPCOMING_API_KEY+'&method='+encodeURIComponent(method)+url_params, - headers: { - "User-agent": "Mozilla/4.0 (compatible) Greasemonkey", - "Accept": "application/atom+xml,application/xml,text/xml", - }, - onload: function(req) { - if(DEBUG) M8_log(req.responseText); - var rsp = req.responseText.replace(/<\?xml.*\?>/,''); - var rsp = new XML(rsp); - - if (rsp == null) { - error( "Could not understand Upcoming's response. "+req.responseText); - } - - var stat = rsp.@stat; - if (stat == null) { - error( "Could not find status of Upcoming request. "+req.responseText); - } - - if (stat != 'ok') { - if (stat == 'fail') { - error("Upcoming error: "+rsp..error.@msg); - } else { - error("Uknown Upcoming error. "+req.responseText); - } - } - callback(rsp); - } - }); - }, - - standard_error: function(msg,div) { - div.innerHTML = this.localiser.localise('error'); - } - } - - //====================================================================== - // launch - try { - window.addEventListener("load", function () { - try { - // update automatically (http://userscripts.org/scripts/show/2296) - win.UserScriptUpdates.requestAutomaticUpdates(SCRIPT); - } catch (ex) {} - - var flickrgp = new flickrupcomingevent(); - }, false); - } catch (ex) {} +// ==UserScript== +// @name Flickr Upcoming Event +// @namespace http://6v8.gamboni.org/ +// @description This is a greasemonkey script to enhance flickr pages and be able to easilly associate photos with an upcoming event. When a shot is associated to an event, it can then be tagged and located from the data provided by the event. +// @version 0.7 +// @identifier http://6v8.gamboni.org/IMG/js/flickrupcomingevent.user.js +// @date 2007-06-26 +// @creator Pierre Andrews (mortimer.pa@free.fr) , pt translation by Perla* +// @include http://*flickr.com/photos/*/* +// @exclude http://*flickr.com/photos/organize* +// ==/UserScript== + +// -------------------------------------------------------------------- +// +// This is a Greasemonkey user script. +// +// To install, you need Greasemonkey: http://greasemonkey.mozdev.org/ +// Then restart Firefox and revisit this script. +// Under Tools, there will be a new menu item to "Install User Script". +// Accept the default configuration and install. +// +// -------------------------------------------------------------------- +// Copyright (C) 2006 Pierre Andrews +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// The GNU General Public License is available by visiting +// http://www.gnu.org/copyleft/gpl.html +// or by writing to +// Free Software Foundation, Inc. +// 51 Franklin Street, Fifth Floor +// Boston, MA 02110-1301 +// USA + +var DEBUG = false; +var UPCOMING_API_URL = 'http://upcoming.yahooapis.com/services/rest/'; + +(function () { + + + //update information + var SCRIPT = { + name: "Flickr Upcoming Event", + namespace: "http://6v8.gamboni.org/", + description: "This is a greasemonkey script to enhance flickr pages and be able to easilly associate photos with an upcoming event. When a shot is associated to an event, it can then be tagged and located from the data provided by the event.", + identifier: "http://6v8.gamboni.org/IMG/js/flickrupcomingevent.user.js", + version: "0.7", // version + date: (new Date("2007-06-28")) // update date + .valueOf() + }; + + /* + Path to wrap descriptions by Johan Sundstr�m + http://www.lysator.liu.se/~jhs/ + */ + function wbr( html ) { + return (''+html).replace( /[-\/_.]|\w{20}/g, + function( c ){ return c+''; } ); + } + + function M8_log() { + if(unsafeWindow.console) + unsafeWindow.console.log(arguments); + else + GM_log(arguments); + } + + function getObjectMethodClosure01(object, method,arg1) { + return function(arg) { + return object[method](arg1); + } + } + + + function getObjectMethodClosure03(object, method,arg1,arg2,arg3) { + return function(arg) { + return object[method](arg1,arg2,arg3); + } + } + + function getObjectMethodClosure11(object, method,arg1) { + return function(arg) { + return object[method](arg,arg1); + } + } + function getObjectMethodClosure12(object, method,arg1,arg2) { + return function(arg) { + return object[method](arg,arg1,arg2); + } + } + function getObjectMethodClosure13(object, method,arg1,arg2,arg3) { + return function(arg) { + return object[method](arg,arg1,arg2,arg3); + } + } + + function $x1(xpath) { + return document.evaluate( + xpath, + document, + null, + XPathResult.FIRST_ORDERED_NODE_TYPE, null + ).singleNodeValue; + } + + + /*********************************************************************** + * Flickr Localisation + **********************************************************************/ + + var FlickrLocaliser = function(locals) { + this.init(locals); + } + FlickrLocaliser.prototype = { + selectedLang: undefined, + localisations: undefined, + getLanguage: function() { + if(!this.selectedLang) { + var langA = $x1("//p[@class='LanguageSelector']//a[contains(@class,'selected')]"); + if(langA) { + var matches = /\/change_language.gne\?lang=([^&]+)&.*/.exec(langA.href); + if(matches && matches[1]) { + this.selectedLang = matches[1]; + return this.selectedLang; + } + } + return false; + } else return this.selectedLang; + }, + + init: function(locals) { + this.localisations = locals; + }, + + localise: function(string, params) { + if(this.localisations && this.getLanguage()) { + var currentLang = this.localisations[this.selectedLang]; + if(!currentLang) currentLang = this.localisations[this.localisations.defaultLang]; + var local = currentLang[string]; + if(!local) { + local = this.localisations[this.localisations.defaultLang][string]; + } + if(!local) return string; + for(arg in params) { + var rep = new RegExp('@'+arg+'@','g'); + local = local.replace(rep,params[arg]); + } + local =local.replace(/@[^@]+@/g,''); + return local; + } else return undefined; + } + + } + + /*****************************Flickr Localisation**********************/ + + + var flickrupcomingevent = function() {this.init();} + + flickrupcomingevent.prototype = { + UPCOMING_API_KEY: '684909d568', + tagged: false, + canTag: false, + upcoming_token: GM_getValue('upcoming_token'), + upcoming_user_name: GM_getValue('upcoming_user_name'), + upcoming_user_username: GM_getValue('upcoming_user_username'), + upcoming_user_id: GM_getValue('upcoming_user_id'), + + event_id: '', + events: {}, + localiser: new FlickrLocaliser({ + 'en-us': { + 'script_title' : 'Upcoming.org event tool', + 'auth_1' : 'You first have to authorize the connection with upcoming. First go ', + 'auth_2' : 'When you are done, come back to this page and', + 'auth_3' : 'Enter the frob given by upcoming here', + 'finish_auth' : 'Finish authorization', + 'loading_details' : 'Getting event details', + 'fetch_events' : 'Fetching events', + 'event' : 'Event', + 'metro' : 'Metro', + 'searching' : 'searching', + 'venue' : 'Venue', + 'description' : 'Description', + 'see_other' : 'See other photos from this event by: @this_user@, @everyone@', + 'this_user' : 'This User', + 'everyone' : 'Everyone', + 'geotag' : 'geotag this photo', + 'Tag' : 'Tag', + 'select_event' : 'Select the event this photo was taken at', + 'error' : 'There was an error, please see the console for details.' + }, + 'fr-fr': { + // T + 'Tag' : 'Tagger', + // A + 'auth_1' : 'Vous devez d\'abord autoriser la connection avec upcoming.org. Commencez par', + 'auth_2' : 'Quand vous avez fini, revenez sur cette page et', + 'auth_3' : 'Entrez le frob donné par upcoming.org ici', + // D + 'description' : 'Description', + // E + 'error' : 'Il y a eu une erreur, veillez consulter les logs pour plus de détails.', + 'event' : 'Évènement', + 'everyone' : 'Tous le monde', + // F + 'fetch_events' : 'Récupération des évènements', + 'finish_auth' : 'Finir l\'autorisation', + // G + 'geotag' : 'Geotagger cette photo', + // L + 'loading_details' : 'Récupération des détails de l\'évènement', + // M + 'metro' : 'Metro', + // S + 'script_title' : 'Outil des évènements Upcoming.org', + 'searching' : 'En Recherche', + 'see_other' : 'Voir les autres photos de cet évènement par: @this_user@, @everyone@', + 'select_event' : 'Sélectionner l\'évènement auquel la photo a été prise', + // T + 'this_user' : 'Cet Utilisateur', + // V + 'venue' : 'Lieu' + }, + 'pt-br': {// T + 'Tag' : 'Rótulo', + // A + 'auth_1' : 'Primeiro você tem que autorizar a conexão com o "upcoming". Primeiro vá', + 'auth_2' : 'Quando terminar, volte para esta página e', + 'auth_3' : 'Digite aqui o "frob" dado pelo "upcoming"', + // D + 'description' : 'Descrição', + // E + 'error' : 'Houve um erro, por favor veja o console para detalhes', + 'event' : 'Evento', + 'everyone' : 'Todas as pessoas', + // F + 'fetch_events' : 'Procurando eventos', + 'finish_auth' : 'Fim da Autorização', + // G + 'geotag' : '"geotag" esta foto', + // L + 'loading_details' : 'Pegando detalhes do evento', + // M + 'metro' : 'Metro', + // S + 'script_title' : 'Ferramenta do evento "Upcoming.org"', + 'searching' : 'Buscando', + 'see_other' : 'Veja outras fotos deste evento feitas por: @this_user@, @everyone@', + 'select_event' : 'Selecione o evento onde esta foto foi tirada', + // T + 'this_user' : 'Este usuário', + // V + 'venue' : 'Local' + }, + + defaultLang: 'en-us' + }), + + init: function() { + + if(unsafeWindow.page_photo_id) { + var privacy_and_upcoming = document.evaluate( + "//p[@class='Privacy']", + document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null + ).singleNodeValue; + + var div; + var links = privacy_and_upcoming.getElementsByTagName('a'); + if(links.length > 0) { + for(var i = 0; i < links.length; i++) { + link = links[i]; + var matches; + if(matches = /http:\/\/upcoming.org\/event\/([0-9]+)/.exec(link.href)) { + this.tagged = true; + this.event_id = matches[1]; + break; + } + } + link.parentNode.appendChild(document.createElement('br')); + div = link.parentNode.appendChild(document.createElement('div')); + } else { + privacy_and_upcoming.appendChild(document.createElement('br')); + div = privacy_and_upcoming.appendChild(document.createElement('div')); + } + if(!this.upcoming_token) { + var img = div.appendChild(document.createElement('img')); + img.align="left"; + img.alt=this.localiser.localiser("script_title"); + img.src="/images/icon_upcoming_over.gif"; + div.appendChild(document.createTextNode(this.localiser.localise('auth_1'))); + var a = div.appendChild(document.createElement('a')); + a.innerHTML = 'here'; + a.target = 'blank'; + a.href= 'http://upcoming.org/services/auth/?api_key='+this.UPCOMING_API_KEY; + div.appendChild(document.createTextNode('. '+this.localiser.localise('auth_2')+':')); + div.appendChild(document.createElement('br')); + var label = div.appendChild(document.createElement('label')); + label.htmlFor = 'upcoming_frob'; + label.innerHTML = this.localiser.localise('auth_3'); + var input = div.appendChild(document.createElement('input')); + input.id = 'upcoming_frob'; + var button = document.createElement('button'); + button.type = 'button'; + button.innerHTML = this.localiser.localise('finish_auth'); + button.addEventListener('click',getObjectMethodClosure01(this,'finishAuth',input),true); + button.className = 'SmallButt'; + div.appendChild(button); + } else { + this.upcomingAuthenticated(div); + } + } + }, + + finishAuth: function(input) { + this.makeUpcomingCall('auth.getToken',{frob: input.value},getObjectMethodClosure11(this,'authDone',input.parentNode),getObjectMethodClosure11(this,'authError',input.parentNode)); + }, + + authDone: function(rsp,div) { + this.upcoming_token = ''+rsp.token.@token; + this.upcoming_user_username = ''+rsp.token.@user_username; + this.upcoming_user_name = ''+rsp.token.@user_name; + this.upcoming_user_id = ''+rsp.token.@user_id; + + GM_setValue('upcoming_token',this.upcoming_token); + GM_setValue('upcoming_user_username',this.upcoming_user_username); + GM_setValue('upcoming_user_name',this.upcoming_user_name); + GM_setValue('upcoming_user_id',this.upcoming_user_id); + + this.upcomingAuthenticated(div); + }, + + authError: function(msg,div) { + GM_setValue('upcoming_token',''); + }, + + upcomingAuthenticated: function(div) { + if(!this.tagged) { + for each(tag in unsafeWindow.global_photos[unsafeWindow.page_photo_id].tags_rawA) { + if(tag.indexOf('upcoming:') >= 0) { + this.tagged = true; + this.event_id = tag.replace('upcoming:','').replace(':','='); + } + } + } + var tagger = document.getElementById('tagadder'); + if(tagger) { + this.canTag = true; + } + if(this.tagged) { + div.innerHTML = ' '+this.localiser.localise('loading_details')+'.'; + this.makeUpcomingCall('event.getInfo',{event_id:this.event_id},getObjectMethodClosure11(this,'eventInfoReceived',div),getObjectMethodClosure11(this,'standard_error',div)); + } else { + if(this.canTag) { + div.innerHTML = ' '+this.localiser.localise('fetch_events')+'.'; + this.makeUpcomingCall('user.getWatchlist',{user_id:this.upcoming_user_id,show:'past'},getObjectMethodClosure11(this,'eventListDetailedReceived',div),getObjectMethodClosure11(this,'standard_error',div)); + } + } + }, + + eventInfoReceived: function(rsp,div) { + var event = rsp.event; + if(event != undefined) { + this.events[event.@id] = {id:event.@id, + username:event.@username, + status:event.@status, + name: event.@name, + tags: event.@tags, + description: event.@description, + start_date: event.@start_date, + end_date: event.@end_date, + start_time: event.@start_time, + end_time: event.@end_time, + personal: event.@personal, + metro_id: event.@metro_id, + venue_id: event.@venue_id, + user_id: event.@user_id, + category_id: event.@category_id, + latitude: event.@latitude, + longitude: event.@longitude, + geocoding_precision: event.@geocoding_precision, + geocoding_ambiguous: event.@geocoding_ambiguous + }; + this.displayEventInfo(div); + } else M8_log(event); + }, + + + autoTag: function(tags) { + unsafeWindow.tagrs_addTag(unsafeWindow.page_photo_id,tags); + }, + + displayEventInfo: function(div) { + div.innerHTML = ''; + div.setAttribute('style','position:relative;left:-18px;'); + event = this.events[this.event_id]; + var ul = div.appendChild(document.createElement('ul')); + ul.setAttribute('style',"margin: 0 24px;list-style-image:url(/images/icon_upcoming_over.gif);"); + + var li = ul.appendChild(document.createElement('li')); + li.className="Stats"; + li.innerHTML = ''+this.localiser.localise('event')+': '+event.name+' '; + if(this.canTag) { + var a = li.appendChild(document.createElement('a')); + a.setAttribute('style',"text-decoration: none; color: rgb(201, 201, 201);"); + a.href="javascript:;"; + a.innerHTML = '[+]'; + a.addEventListener('click',getObjectMethodClosure01(this,'autoTag','"'+event.name+'"'),true); + } + + var li = ul.appendChild(document.createElement('li')); + li.className="Stats"; + li.innerHTML = ''+this.localiser.localise('metro')+': '+this.localiser.localise('searching')+'...'; + this.makeUpcomingCall('metro.getInfo',{metro_id:event.metro_id},getObjectMethodClosure11(this,'metroInfoReceived',li),getObjectMethodClosure11(this,'standard_error',li)); + + + var li = ul.appendChild(document.createElement('li')); + li.className="Stats"; + li.innerHTML = ''+this.localiser.localise('venue')+': '+this.localiser.localise('searching')+'...'; + this.makeUpcomingCall('venue.getInfo',{venue_id:event.venue_id},getObjectMethodClosure11(this,'venueInfoReceived',li),getObjectMethodClosure11(this,'standard_error',li)); + + + if(event.description+"") { + var li = ul.appendChild(document.createElement('li')); + li.className="Stats"; + li.innerHTML = ''+this.localiser.localise('description')+': '+wbr(event.description); + } + + var li = ul.appendChild(document.createElement('li')); + li.className="Stats"; + li.innerHTML = this.localiser.localise('see_other',{ + 'this_user':''+this.localiser.localise('this_user')+'', 'everyone':''+this.localiser.localise('everyone')+''}); + }, + + metroInfoReceived: function(rsp,li) { + var metro = rsp.metro[0]; + + this.makeUpcomingCall('state.getInfo',{state_id:metro.@state_id},getObjectMethodClosure12(this,'stateInfoReceived',li,metro),getObjectMethodClosure11(this,'standard_error',li)); + }, + + stateInfoReceived: function(rsp,li,metro) { + var state = rsp.state[0]; + + this.makeUpcomingCall('country.getInfo',{country_id:state.@country_id},getObjectMethodClosure13(this,'countryInfoReceived',li,metro,state),getObjectMethodClosure11(this,'standard_error',li)); + }, + + countryInfoReceived: function(rsp,li,metro,state) { + var country = rsp.country[0]; + li.innerHTML = ''+this.localiser.localise('metro')+': '+country.@name+' > '+state.@name+' > '+metro.@name+' '; + if(this.canTag) { + var a = li.appendChild(document.createElement('a')); + a.setAttribute('style',"text-decoration: none; color: rgb(201, 201, 201);"); + a.href="javascript:;"; + a.innerHTML = '[+]'; + a.addEventListener('click',getObjectMethodClosure01(this,'autoTag','"'+country.@name+'" "'+state.@name+'" "'+metro.@name+'" "'+country.@name+'>'+state.@name+'>'+metro.@name+'"'),true); + } + }, + + venueInfoReceived: function(rsp,li) { + var venue = rsp.venue[0]; + /**/ + + li.innerHTML = ''; + var b = li.appendChild(document.createElement('b')); + b.innerHTML = this.localiser.localise('venue')+': '; + + var venue_link = li.appendChild(document.createElement('a')); + venue_link.href= venue.@url; + venue_link.innerHTML = venue.@name+' '; + if(this.canTag) { + var a = li.appendChild(document.createElement('a')); + a.setAttribute('style',"text-decoration: none; color: rgb(201, 201, 201);"); + a.href="javascript:;"; + a.innerHTML = '[+]'; + a.addEventListener('click',getObjectMethodClosure01(this,'autoTag','"'+venue.@name+'"'),true); + } + + var ul = li.appendChild(document.createElement('ul')); + // ul.setAttribute('style','list-style-type:none;'); + + if(venue.@address+"") { + var li2 = ul.appendChild(document.createElement('li')); + li2.className = 'Stats'; + li2.setAttribute('style','list-style-type:none; list-style-image:none;'); + li2.innerHTML = venue.@address+' '; + if(this.canTag) { + var a = li2.appendChild(document.createElement('a')); + a.setAttribute('style',"text-decoration: none; color: rgb(201, 201, 201);"); + a.href="javascript:;"; + a.innerHTML = '[+]'; + a.addEventListener('click',getObjectMethodClosure01(this,'autoTag','"'+venue.@address+'"'),true); + } + } + + if(venue.@city+"") { + var li2 = ul.appendChild(document.createElement('li')); + li2.className = 'Stats'; + li2.setAttribute('style','list-style-type:none; list-style-image:none;'); + li2.innerHTML = venue.@city+' '; + if(this.canTag) { + var a = li2.appendChild(document.createElement('a')); + a.setAttribute('style',"text-decoration: none; color: rgb(201, 201, 201);"); + a.href="javascript:;"; + a.innerHTML = '[+]'; + a.addEventListener('click',getObjectMethodClosure01(this,'autoTag','"'+venue.@city+'"'),true); + } + } + + if(venue.@zip+"") { + var li2 = ul.appendChild(document.createElement('li')); + li2.className = 'Stats'; + li2.setAttribute('style','list-style-type:none; list-style-image:none;'); + li2.innerHTML = venue.@zip+' '; + if(this.canTag) { + var a = li2.appendChild(document.createElement('a')); + a.setAttribute('style',"text-decoration: none; color: rgb(201, 201, 201);"); + a.href="javascript:;"; + a.innerHTML = '[+]'; + a.addEventListener('click',getObjectMethodClosure01(this,'autoTag','"'+venue.@zip+'"'),true); + } + } + + if(unsafeWindow.global_photos[unsafeWindow.page_photo_id].isOwner && venue.@longitude+"" && venue.@latitude+"" && venue.@geocoding_ambiguous*1 == 0) { + var li2 = ul.appendChild(document.createElement('li')); + li2.setAttribute('style','list-style-type:none; list-style-image:none;'); + li2.className = 'Stats'; + var a = li2.appendChild(document.createElement('a')); + a.setAttribute('style',"text-decoration: none; color: rgb(201, 201, 201);"); + a.innerHTML = this.localiser.localise('geotag'); + a.href="javascript:;"; + a.addEventListener('click',getObjectMethodClosure03(this,'setLatLon',venue.@latitude,venue.@longitude,venue.@geocoding_precision),true); + } + + }, + + setLatLon: function(lat,lon,precision) { + var accuracy = 6; //default accuracy is ~region accuracy + switch(precision) { + case 'zip': + accuracy = 11; + break; + case 'address': + accuracy = 16; + break; + } + var listener = { + flickr_photos_geo_setLocation_onLoad: function(success, responseXML, responseText, params){ + if(DEBUG) M8_log(responseText); + } + }; + + unsafeWindow.F.API.callMethod('flickr.photos.geo.setLocation', {photo_id:unsafeWindow.page_photo_id,lat:lat,lon:lon,accuracy:accuracy}, listener); + }, + + /* eventListReceived: function(rsp,div) { + var event_ids = ''; + for each(w in rsp..watchlist) { + event_ids += ','+w.@event_id; + } + event_ids = event_ids.substr(1); + this.makeUpcomingCall('event.getInfo',{event_id:event_ids},getObjectMethodClosure11(this,'eventListDetailedReceived',div),getObjectMethodClosure11(this,'standard_error',div)); + + },*/ + + eventListDetailedReceived: function(rsp, div) { + var select = document.createElement("select"); + select.id = 'upcoming_event_select'; + select.setAttribute("style","display:block;"); + for each(event in rsp..event) { + var name=""+event.@name; + if(name.length > 50) { + name = name.substring(0,47)+"..."; + } + + var option = select.appendChild(document.createElement("option")); + option.value = event.@id; + option.innerHTML = name+' ('+event.@start_date+')'; + this.events[event.@id] = {id:event.@id, + username:event.@username, + status:event.@status, + name: event.@name, + tags: event.@tags, + description: event.@description, + start_date: event.@start_date, + end_date: event.@end_date, + start_time: event.@start_time, + end_time: event.@end_time, + personal: event.@personal, + metro_id: event.@metro_id, + venue_id: event.@venue_id, + user_id: event.@user_id, + category_id: event.@category_id, + latitude: event.@latitude, + longitude: event.@longitude, + geocoding_precision: event.@geocoding_precision, + geocoding_ambiguous: event.@geocoding_ambiguous + }; + } + var button = document.createElement('button'); + button.type = 'button'; + button.innerHTML = this.localiser.localise('Tag'); + button.addEventListener('click',getObjectMethodClosure01(this,'tagPhoto',select),true); + button.className = 'SmallButt'; + var label = div.appendChild(document.createElement('label')); + label.htmlFor = 'upcoming_event_select'; + label.innerHTML = this.localiser.localise('select_event')+':'; + label.setAttribute("style","display:block;"); + div.innerHTML = ''; + var img = div.appendChild(document.createElement('img')); + img.align="left"; + img.alt= this.localiser.localise('script_title'); + img.src="/images/icon_upcoming_over.gif"; + div.appendChild(label); + div.appendChild(select); + div.appendChild(button); + }, + + tagPhoto: function(select) { + unsafeWindow.tagrs_addTag(unsafeWindow.page_photo_id,'"upcoming:event='+select.value+'" upcoming'); + this.event_id = select.value; + this.displayEventInfo(select.parentNode); + }, + + makeUpcomingCall: function(method,params,callback,error) { + var url_params = ''; + for (p in params) { + url_params += '&'+encodeURIComponent(p)+'='+encodeURIComponent(params[p]); + } + if(this.upcoming_token) url_params += '&token='+this.upcoming_token; + if(DEBUG) M8_log(url_params); + GM_xmlhttpRequest({method: "GET", + url: UPCOMING_API_URL+"/?api_key="+this.UPCOMING_API_KEY+'&method='+encodeURIComponent(method)+url_params, + headers: { + "User-agent": "Mozilla/4.0 (compatible) Greasemonkey", + "Accept": "application/atom+xml,application/xml,text/xml", + }, + onload: function(req) { + if(DEBUG) M8_log(req.responseText); + var rsp = req.responseText.replace(/<\?xml.*\?>/,''); + var rsp = new XML(rsp); + + if (rsp == null) { + error( "Could not understand Upcoming's response. "+req.responseText); + } + + var stat = rsp.@stat; + if (stat == null) { + error( "Could not find status of Upcoming request. "+req.responseText); + } + + if (stat != 'ok') { + if (stat == 'fail') { + error("Upcoming error: "+rsp..error.@msg); + } else { + error("Uknown Upcoming error. "+req.responseText); + } + } + callback(rsp); + } + }); + }, + + standard_error: function(msg,div) { + div.innerHTML = this.localiser.localise('error'); + } + } + + //====================================================================== + // launch + try { + window.addEventListener("load", function () { + try { + // update automatically (http://userscripts.org/scripts/show/2296) + win.UserScriptUpdates.requestAutomaticUpdates(SCRIPT); + } catch (ex) {} + + var flickrgp = new flickrupcomingevent(); + }, false); + } catch (ex) {} })(); \ No newline at end of file -- 2.11.4.GIT