Recent posts by Junk Blocker

Subscribe to Recent posts by Junk Blocker 23 posts found

Jul 27, 2007
Junk Blocker 23 posts

Topic: Script development / Updater for your scripts

See - http://userscripts.org/forums/1/topics/48#posts...

 
Jul 8, 2007
Junk Blocker 23 posts

Topic: Userscripts.org discussion / Possible script theft

http://userscripts.org/scripts/review/10542 vs. http://userscripts.org/scripts/review/10318 .

 
Jul 6, 2007
Junk Blocker 23 posts

Topic: Ideas and script requests / Fetch a list of my del.icio.us tags?

But del.icio.us's default post to delicious bookmarklet already does that by default. It lives on their bookmarklets page.

 
Jul 2, 2007
Junk Blocker 23 posts

Topic: Userscripts.org discussion / RSS feed for script comments

Matthew, This is precisely the sort of situation I had create this script for RSS+Atom Feed Subscribe Button Generator. :)

 
Jun 29, 2007
Junk Blocker 23 posts

Topic: Ideas and script requests / Automatic search and replace in URL

Here's, in my humble opinion, a much more universal solution - Try This Search On.

 
Jun 27, 2007
Junk Blocker 23 posts

Topic: Userscripts.org discussion / Cheating with Tags with del.icio.us

/me applauds! This tickled me :)

 
Jun 27, 2007
Junk Blocker 23 posts

Topic: Userscripts.org discussion / Sister service / Data feed

Can I have the pointer too please? Thanks - junkblocker

 
Apr 20, 2007
Junk Blocker 23 posts

Topic: Ideas and script requests / Amazon link to my library?

You library seems to be using the same software as my library with slightly different versions or customizations. Take my Peninsula Library System script from

http://userscripts.org/scripts/show/1072

and replace two lines. Replace

var libraryUrlPattern = 'http://catalog.plsinfo.org/search/i?SEARCH=';

with

  var libraryUrlPattern = 'http://dalva.fcgov.com/search/i?SEARCH=';

and

var notFound = /No matches found; nearby STANDARD NOS are/

with

var notFound = /No matches found/

and you'll be good to go.

EDIT: You'll want to delete these lines too otherwise it will overwrite your program with mine when it checks for updates.

  autoUpdateFromUserscriptsDotOrg({
    name: 'Peninsula Library System - Amazon.com & other sources Lookup',
    url: 'http://userscripts.org/scripts/source/1072.user.js',
    version: '2.8'
  });

This is the minimal change. I'm sure you can manage the cosmetic changes like replacing script name text etc.

 
Apr 13, 2007
Junk Blocker 23 posts

Topic: Script development / Standard Function Library

No, it won't. See this post by Henrik Nyh

      url: SCRIPT.url + '?source', // don't increase the 'installed' count just for update checks

i.e. appending '?source' to the source url is an alternate way of avoiding increasing the count. :)

 
Apr 12, 2007
Junk Blocker 23 posts

Topic: Script development / Standard Function Library

How about the autoupdate code? Here's a pretty minimal version assembled from various sources on here:

// Script Header
//
// @version   1.2
...
...
  // code
function autoUpdateFromUserscriptsDotOrg(SCRIPT) {
  try {
    if (!GM_getValue) return; // Older version of Greasemonkey. Can't run.

    // avoid a flood of dialogs e.g. when opening a browser with multiple tabs set to homepage
    // and a script with * includes or opening a tabgrop
    var DoS_PREVENTION_TIME = 2 * 60 * 1000;
    var isSomeoneChecking = GM_getValue('CHECKING', null);
    var now = new Date().getTime();
    GM_setValue('CHECKING', now.toString());
    if (isSomeoneChecking && (now - isSomeoneChecking) < DoS_PREVENTION_TIME) return;

    // check daily
    var ONE_DAY = 24 * 60 * 60 * 1000;
    var lastChecked = GM_getValue('LAST_CHECKED', null);
    if (lastChecked && (now - lastChecked) < ONE_DAY) return;

    GM_xmlhttpRequest({
      method: 'GET',
      url: SCRIPT.url + '?source', // don't increase the 'installed' count just for update checks
      onload: function(result) {
        if (!result.responseText.match(/@version\s+([\d.]+)/)) return;     // did not find a suitable version header

        var theOtherVersion = parseFloat(RegExp.$1);
        if (theOtherVersion <= parseFloat(SCRIPT.version)) return;      // no updates or older version on userscripts.orge site

        if (window.confirm('A new version ' + theOtherVersion + ' of greasemonkey script "' + SCRIPT.name + '" is available.\nYour installed version is ' + SCRIPT.version + ' .\n\nUpdate now?\n')) {
          GM_openInTab(SCRIPT.url);   // better than location.replace as doing so might lose unsaved data
        }
      }
    });
    GM_setValue('LAST_CHECKED', now.toString());
  } catch (ex) {
  }
}

// usage example
autoUpdateFromUserscriptsDotOrg({
  name: 'RSS+Atom Feed Subscribe Button Generator',
  url: 'http://userscripts.org/scripts/source/688.user.js',
  version: "1.2",
});

 
Apr 4, 2007
Junk Blocker 23 posts

Topic: Userscripts.org discussion / what happened to book burrow?

Jesse Andrews the author (and the one of the people running this site) claims to be focusing more on the extension at http://bookburro.org in this thread

 
Mar 30, 2007
Junk Blocker 23 posts

Topic: Script development / Having trouble updating my Amazon/library lookup script

I too hopefully pasted all the code between two pre tags. So line 135 (<dts) in this code got messed up upto line 283 (</b>) .

So some wiki like tag for quoting code would be great e.g. <codefragment> ....this all gets html quoted automatically.... </codefragment>

 
Mar 30, 2007
Junk Blocker 23 posts

Topic: Script development / Having trouble updating my Amazon/library lookup script

Actually I see what happened. The code got quoted incorrectly (site bug or whatever) and a huge chunk of code is missing from the middle of the code :( Let me see if full html works here.
?001 //?==UserScript==
?002 //?@name????????Timerbland?Regional?Library?Catalog?-?Amazon.com?&?other?sources?Lookup
?003 //?@description?Display?the?availability?of?a?book?in?the?Timberland?Regional?Library?Catalog?(WA,?USA)?on?amazon.com,?other?bookstores?and?wikipedia?book?pages
?004 //?@namespace???http://loonyone.livejournal.com
?005 //?@include?????*abebooks.com/*
?006 //?@include?????*alibris.com/*
?007 //?@include?????*amazon.*/*
?008 //?@include?????*barnesandnoble.com/*
?009 //?@include?????*bookfinder.com/*
?010 //?@include?????*books.google.com/*
?011 //?@include?????*booksamillion.com/*
?012 //?@include?????*bookshelved.org/*
?013 //?@include?????*bookmooch.com/*
?014 //?@include?????*bordersstores.com/*
?015 //?@include?????*buy.com/*
?016 //?@include?????*c2.com/*
?017 //?@include?????*half.ebay.com/*
?018 //?@include?????*librarything.com/work/*
?019 //?@include?????*mitpress.mit.edu/*
?020 //?@include?????*penguin.*/*
?021 //?@include?????*penguingroup.*/*
?022 //?@include?????*penguinbooksindia.*/*
?023 //?@include?????*penguincatalogue.*/*
?024 //?@include?????*powells.com/*
?025 //?@include?????*wikipedia.org/*isbn=*
?026 //?@include?????*worldcat.org/*
?027 //?@include?????*worldcatlibraries.org/*
?028 //?@creator?????Manpreet?Singh?|junkblocker<at>yahoo<dot>com|
?029 //?@source??????http://userscripts.org/scripts/show/1072
?030 //?@identifier??http://userscripts.org/scripts/source/1072.user.js
?031 //?@version?????0.1
?032 //?@date????????2007-03-11
?033 //?==/UserScript==
?034
?035 //?Initially?based?on?Peninsula?Library?System?lookup?script
?036 //?Work?on?most?sites.?More?specifically?at?least?on?*abebooks.com/*,
?037 //?*alibris.com/*,?*amazon.*/*,?*barnesandnoble.com/*,?*bookfinder.com/*,
?038 //?*books.google.com/*,?*booksamillion.com/*,?*bookmooch.com/*,
?039 //?*bordersstores.com/*,?*buy.com/*,?*c2.com/*,?*half.ebay.com/*,
?040 //?*librarything.com/work/*,?*penguin.*/*,?*penguingroup.*/*,
?041 //?*penguinbooksindia.*/*,?*penguincatalogue.*/*,?*powells.com/*,
?042 //?*wikipedia.org/*isbn=*,?*worldcat.org/*?&?*worldcatlibraries.org/*
?043 //
?044 //?Version?0.1?-?First?release?based?on?Peninsula?Library?System?-?Amazon.com?&?other?sources?lookup?script
?045
?046
?047 (function()?{
?048 ??//?check?for?updates?every?day
?049 ??/*
?050 ??if?((unsafeWindow?||?window.wrappedJSObject?||?window).UserScriptUpdates)?{
?051 ????var?lastChecked?=?GM_getValue('LAST_UPDATE_CHECKED',?null);
?052 ????var?now?=?new?Date().getTime();
?053 ????if?(!lastChecked?||?(now?-?lastChecked)?>?24?*?60?*?60?*?1000)?{
?054 ??????GM_setValue('LAST_UPDATE_CHECKED',?now.toString());
?055 ??????var?SCRIPT?=?{
?056 ????????name:?'?Timerbland?Regional?Library?Catalog?-?Amazon.com?&?other?sources?Lookup',
?057 ????????namespace:?'http://loonyone.livejournal.com',
?058 ????????description:??'Display?the?availability?of?a?book?in?the?Timberland?Regional?Library?Catalog?(WA,?USA)?on?amazon.com,?other?bookstores?and?wikipedia?book?pages'
?059 ????????source:?'http://userscripts.org/scripts/show/1072',
?060 ????????identifier:?'http://userscripts.org/scripts/source/1072.user.js',
?061 ????????version:?"0.1",???????????????//?version
?062 ????????date:?(new?Date(2007,?3?-?1,?11))????//?update?date
?063 ????????????.valueOf()
?064 ??????};
?065 ??????try?{
?066 ????????(unsafeWindow?||?window.wrappedJSObject?||?window).UserScriptUpdates.requestAutomaticUpdates(SCRIPT);
?067 ??????}?catch?(ex)?{}
?068 ????}
?069 ??}
?070 ??*/
?071 ??Array.prototype.addUnique?=?function?(elem)?{
?072 ????for?(var?i?=?0,?len?=?this.length;?i?<?len;?i++)?{
?073 ??????if?(this[i]?==?elem)?{
?074 ????????return;
?075 ??????}
?076 ????}
?077 ????this.push(elem);
?078 ??}
?079 ??/*
?080 ??window.alert?=?function?(msg)?{
?081 ????if?(!?window.confirm(msg))?{
?082 ??????throw?'aborted';
?083 ????}
?084 ??}*/
?085 ??function?findGenericISBN(themap)?{
?086 ????var?bodyhtml?=?document.body.innerHTML;
?087 ????while?(bodyhtml.match(/ISBN(?:-1[03])?\s*[?=:]\s*(?:<\/?[a-zA-Z0-9]+\s*\/?>)?([\n\r\s\dX-]+)((.*[\n\r]*)*)/i))?{
?088 ??????var?maybeMultiple?=?RegExp.$1;
?089 ??????bodyhtml?=?RegExp.$2;
?090 ??????while?(maybeMultiple.match(/\b((?:\d{3}-?)?(?:\d{9}[\dX]|[\d-]{8,}[\dx]))([\s\n\r\dX-]*)/i))?{
?091 ????????themap[RegExp.$1]='';
?092 ????????maybeMultiple?=?RegExp.$2;
?093 ??????}
?094 ????}
?095 ????try?{
?096 ??????themap[location.href.match(/isbn[=\/]((\d{3}-?)?\d{9}[\dX])/i)[1]]?=?'';
?097 ????}?catch?(e){}
?098 ??}
?099 ??function?getISBN()?{
?100 ????var?results?=?{};
?101 ????try?{
?102 ??????if?(location.href.match(/^https?:\/\/(www\.)?librarything\.com/))?{
?103 ????????var?isbns?=?document.evaluate("//div[@class='isbn']/a",?document,?null,?XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,?null);
?104 ????????for?(var?i?=?0,?len?=?isbns.snapshotLength;?i?<?len;?i++)?{
?105 ??????????var?a?=?isbns.snapshotItem(i);
?106 ??????????if?(a.innerHTML.match(/ISBN\s+((\d{3}-?)?\d{9}[\dX])/i))?{
?107 ????????????results[RegExp.$1]?=?'';
?108 ??????????}
?109 ????????}
?110 ??????}?else?if?(location.href.match(/^https?:\/\/(www\.)?amazon\./))?{
?111 ????????try?{
?112 ??????????results[location.href.match(/(asin|product|dp)[\/=]((\d{3}-?)?\d{9}[\dX])(\/|&|;|\?|$)/i)[2]]?=?'';
?113 ????????}?catch?(e)?{}
?114 ????????var?thiscontent?=?document.body.innerHTML;
?115 ????????var?idx?=?thiscontent.indexOf('ISBN-10:');
?116 ????????if?(idx?!=?-1?&&?thiscontent.substring(idx+12).match(/^[\n\r\s]*((\d{3}-?)?\d{9}[\dX])/i))?{
?117 ??????????results[RegExp.$1]?=?'';
?118 ????????}
?119 ????????var?idx?=?thiscontent.indexOf('ISBN-13:');
?120 ????????if?(idx?!=?-1?&&?thiscontent.substring(idx+12).match(/^[\n\r\s]*((\d{3}-?)?\d{9}[\dX])/i))?{
?121 ??????????results[RegExp.$1]?=?'';
?122 ????????}
?123 ??????}?else?if?(location.href.match('abebooks.com'))?{
?124 ????????try?{
?125 ??????????results[document.title.match(/ISBN?((\d{3}-?)?\d{9}[\dX])/i)[1]]?=?'';
?126 ????????}?catch?(e)?{};
?127 ????????try?{
?128 ??????????results[document.body.innerHTML.match(/class="isbn">((\d{3}-?)?\d{9}[\dX])/i)[1]]?=?'';
?129 ????????}?catch?(e)?{};
?130 ??????}?else?if?(location.href.match('buy.com'))?{
?131 ????????results[document.title.match(/ISBN?((\d{3}-?)?\d{9}[\dX])/i)[1]]?=?'';
?132 ??????}?else?if?(location.href.match('powells.com'))?{
?133 ????????findGenericISBN(results);
?134 ????????var?dts?=?document.getElementsByTagName('dt');
?135 ????????for?(var?i=0;?i<dts>
?136 ??????????if?(dts[i].innerHTML.match('ISBN(-?1[03])?:'))?{
?137 ????????????results[dts[i].nextSibling.firstChild.text]?=?'';
?138 ??????????}
?139 ????????}
?140 ??????}?else?if?(location.href.match('(alibris|half.ebay).com'))?{
?141 ????????var?bs?=?document.getElementsByTagName('b');
?142 ????????for?(var?i=0;?i<bs>
?143 ??????????if?(bs[i].innerHTML.match('ISBN(-?1[03])?:'))?{
?144 ????????????results[bs[i].nextSibling.nextSibling.text]?=?'';
?145 ??????????}
?146 ????????}
?147 ??????}?else?if?(location.href.match('books.google.com'))?{
?148 ????????results[location.href.match(/vid=ISBN((\d{3}-?)?\d{9}[\dX])/i)[1]]?=?'';
?149 ??????}?else?if?(location.href.match('bookmooch.com'))?{
?150 ????????results[location.href.match(/detail\/((\d{3}-?)?\d{9}[\dX])/i)[1]]?=?'';
?151 ??????}?else?if?(location.href.match(/worldcat(libraries)?.org/))?{
?152 ????????findGenericISBN(results);
?153 ????????var?thiscontent?=?document.body.innerHTML;
?154 ????????var?idx?=?thiscontent.indexOf('ISBN:?');
?155 ????????if?(idx?!=?-1)?{
?156 ??????????if?(thiscontent.substring(idx+23).match(/[\n\r\s]*((\d{3}-?)?\d{9}[\dX])/i))?{
?157 ????????????results[RegExp.$1]?=?'';
?158 ??????????}
?159 ??????????if?(thiscontent.substring(idx+23).match(/[\n\r\s]*\d+\s+((\d{3}-?)?\d{9}[\dX])/i))?{
?160 ????????????results[RegExp.$1]?=?'';
?161 ??????????}
?162 ????????}
?163 ??????}?else?{
?164 ????????findGenericISBN(results);
?165 ??????}
?166 ??????return?results;?//?sorting?doesn't?matter?as?search?requests?finish?out?of?order
?167 ????}?catch?(e)?{
?168 ??????return;
?169 ????}
?170 ??}
?171 ??var?thisisbn?=?getISBN();
?172 ??if?(!thisisbn?||?thisisbn.count?<=?0)?return;
?173 ??var?Drag?=?function(){?this.init.apply(?this,?arguments?);?};
?174
?175 ??Drag.fixE?=?function(?e?)?{
?176 ????if(?typeof?e?==?'undefined'?)?e?=?window.event;
?177 ????if(?typeof?e.layerX?==?'undefined'?)?e.layerX?=?e.offsetX;
?178 ????if(?typeof?e.layerY?==?'undefined'?)?e.layerY?=?e.offsetY;
?179 ????return?e;
?180 ??};
?181
?182 ??Drag.prototype.init?=?function(?handle,?dragdiv?)?{
?183 ????this.div?=?dragdiv?||?handle;
?184 ????this.handle?=?handle;
?185 ????if(?isNaN(parseInt(this.div.style.left))?)?this.div.style.left??=?'0px';
?186 ????if(?isNaN(parseInt(this.div.style.top))?)?this.div.style.top?=?'0px';
?187 ????this.onDragStart?=?function(){};
?188 ????this.onDragEnd?=?function(){};
?189 ????this.onDrag?=?function(){};
?190 ????this.onClick?=?function(){};
?191 ????this.mouseDown?=?addEventHandler(this.handle,?'mousedown',?this.start,?this);
?192 ??};
?193
?194 ??Drag.prototype.start?=?function(e)?{
?195 ????e?=?Drag.fixE(e);
?196
?197 ????this.started?=?new?Date();
?198 ????var?y?=?this.startY?=?parseInt(this.div.style.top);
?199 ????var?x?=?this.startX?=?parseInt(this.div.style.left);
?200 ????this.onDragStart(x,?y);
?201 ????this.lastMouseX?=?e.clientX;
?202 ????this.lastMouseY?=?e.clientY;
?203 ????this.documentMove?=?addEventHandler(document,?'mousemove',?this.drag,?this);
?204 ????this.documentStop?=?addEventHandler(document,?'mouseup',?this.end,?this);
?205 ????if?(e.preventDefault)?e.preventDefault();
?206 ????return?false;
?207 ??};
?208
?209 ??Drag.prototype.drag?=?function(?e?)?{
?210 ????e?=?Drag.fixE(e);
?211 ????var?ey?=?e.clientY;
?212 ????var?ex?=?e.clientX;
?213 ????var?y?=?parseInt(this.div.style.top);
?214 ????var?x?=?parseInt(this.div.style.left);
?215 ????var?nx?=?ex?+?x?-?this.lastMouseX;
?216 ????var?ny?=?ey?+?y?-?this.lastMouseY;
?217 ????this.div.style.left?=?nx?+?'px';
?218 ????this.div.style.top??=?ny?+?'px';
?219 ????this.lastMouseX?=?ex;
?220 ????this.lastMouseY?=?ey;
?221 ????this.onDrag(nx,?ny);
?222 ????if?(e.preventDefault)?{
?223 ??????e.preventDefault();
?224 ????}
?225 ????return?false;
?226 ??};
?227
?228 ??Drag.prototype.end?=?function()?{
?229 ????removeEventHandler(?document,?'mousemove',?this.documentMove?);
?230 ????removeEventHandler(?document,?'mouseup',?this.documentStop?);
?231 ????var?time?=?(new?Date())?-?this.started;
?232 ????var?x?=?parseInt(this.div.style.left),??dx?=?x?-?this.startX;
?233 ????var?y?=?parseInt(this.div.style.top),?dy?=?y?-?this.startY;
?234 ????this.onDragEnd(?x,?y,?dx,?dy,?time?);
?235 ????if(?(dx*dx?+?dy*dy)?<?(4*4)?&&?time?<?1e3?)?{
?236 ??????this.onClick(?x,?y,?dx,?dy,?time?);
?237 ????}
?238 ??};
?239
?240 ??function?removeEventHandler(?target,?eventName,?eventHandler?)?{
?241 ????if(?target.addEventListener?)?{
?242 ??????target.removeEventListener(?eventName,?eventHandler,?true?);
?243 ????}?else?if(?target.attachEvent?)?{
?244 ??????target.detachEvent(?'on'?+?eventName,?eventHandler?);
?245 ????}
?246 ??}
?247
?248 ??function?addEventHandler(?target,?eventName,?eventHandler,?scope?)?{
?249 ????var?f?=?scope???function(){?eventHandler.apply(?scope,?arguments?);?}?:?eventHandler;
?250 ????if(?target.addEventListener?)?{
?251 ??????target.addEventListener(?eventName,?f,?true?);
?252 ????}?else?if(?target.attachEvent?)?{
?253 ??????target.attachEvent(?'on'?+?eventName,?f?);
?254 ????}
?255 ????return?f;
?256 ??}
?257
?258 ??var?libraryUrlPattern?=?'http://ipac.trlib.org/ipac20/ipac.jsp?menu=search&index=ISBNEX&term=';
?259 ??var?libraryUrlPatternSuffix?=?'';
?260 ??var?libraryName?=?'Timberland?Regional?Library?Catalog';
?261 ??var?libraryAvailability?=?/>\s*Checked?in\s*
?262 ??var?libraryCheckedOut?=?/>\s*Checked?out\s*
?263 ??var?libraryTransit?=?/>\s*Transit?request\s*
?264 ??var?notFound?=?/Sorry,?could?not?find?anything?matching/;
?265 ??var?maindiv;
?266
?267 ??var?libraryLookup?=?{
?268 ????insertLinks:?function(isbn,?avails)?{
?269 ??????var?body?=?document.getElementsByTagName('body')[0];
?270 ??????var?divStyled=document.createElement('div');
?271 ??????divStyled.setAttribute('style','border:1px?solid?#e4e4e4;padding:4px;?background:#efefff;font-size:?12px;');
?272
?273 ??????var?thespan?=?document.createElement('span');
?274 ??????with?(thespan.style)?{
?275 ????????display?=?'block';
?276 ????????border?=?'dotted?1px?black';
?277 ????????textAlign?=?'left';
?278 ????????fontFamily?=?'arial,sans';
?279 ????????color?=?'black';
?280 ????????background?=?'#c0cfcf';
?281 ????????padding?=?'2px?1px?1px';
?282 ??????}
?283 ??????thespan.innerHTML?=?'?ISBN??'?+?isbn;
?284 ??????for?(var?i?=?0,?len?=?avails.length;?i?<?len;?i++)?{
?285 ????????var?hrefTitle?=?avails[i][0];
?286 ????????var?theColor?=?avails[i][1];
?287 ????????var?thislink?=?document.createElement('a');
?288 ????????with?(thislink)?{
?289 ??????????href?=?libraryUrlPattern?+?isbn?+?libraryUrlPatternSuffix;
?290 ??????????alt?=?hrefTitle;
?291 ??????????title?=?hrefTitle;
?292 ??????????textContent?=?hrefTitle;
?293 ????????}
?294 ????????with?(thislink.style)?{
?295 ??????????display?=?'block';
?296 ??????????border?=?'outset?thin?black';
?297 ??????????padding?=?'2px';
?298 ??????????textAlign?=?'center';
?299 ??????????color?=?'white';
?300 ??????????fontWeight?=?'bold';
?301 ??????????background?=?theColor;
?302 ??????????textDecoration?=?'none';
?303 ??????????fontFamily?=?'arial,sans';
?304 ??????????margin?=?'0px?0px?3px';
?305 ????????}
?306 ????????thespan.appendChild(thislink);
?307 ??????}
?308 ??????divStyled.appendChild(thespan);
?309 ??????if?(!maindiv)?{
?310 ????????maindiv?=?document.createElement('div');
?311 ????????maindiv.id?=?'trlcdiv';
?312 ????????with?(maindiv.style)?{
?313 ??????????left?=?'200px';
?314 ??????????top?=?'6px';
?315 ??????????zIndex?=?'999';
?316 ??????????border?=?'1px?solid?#000033';
?317 ??????????color?=?'black';
?318 ??????????padding?=?'0px';
?319 ??????????position?=?'absolute';
?320 ??????????opacity?=?'0.95';
?321 ??????????textAlign?=?'left';
?322 ????????}
?323
?324 ????????var?title?=?document.createElement('div');
?325 ????????with?(title.style)?{
?326 ??????????background?=?'rgb(153,204,255)';
?327 ??????????border?=?'solid';
?328 ??????????borderWidth?=?'0px?0px?1px';
?329 ??????????cursor?=?'move';
?330 ??????????fontFamily?=?'dialog,arial,sans';
?331 ??????????fontSize?=?'12px';
?332 ??????????fontWeight?=?'bold';
?333 ??????????padding?=?'3px?0px?2px?15px';
?334 ??????????textAlign?=?'right';
?335 ????????}
?336 ????????title.appendChild(document.createTextNode('?'?+?libraryName?+?'?'));
?337 ????????var?closeButton?=?document.createElement('a');
?338 ????????closeButton.href?=?'javascript:?closeTRLC();';
?339 ????????closeButton.innerHTML?=?'X';
?340 ????????with?(closeButton.style)?{
?341 ??????????display?=?'inline';
?342 ??????????padding?=?'2px?6px?1px';
?343 ??????????color?=?'white';
?344 ??????????cursor?=?'pointer';
?345 ??????????textDecoration?=?'none';
?346 ??????????border?=?'solid?1px?white';
?347 ??????????background?=?'#069';
?348 ????????}
?349 ????????title.appendChild(closeButton);
?350
?351 ????????maindiv.appendChild(title);
?352 ????????body.appendChild(maindiv);
?353 ????????title.drag?=?new?Drag(title,?maindiv);
?354 ??????}
?355 ??????maindiv.appendChild(divStyled);
?356 ????},
?357
?358 ????doLookup?:?function?(isbns)?{
?359 ??????var?makeCallback?=?function(isobune)?{
?360 ????????return?function(results)?{
?361 ??????????page?=?results.responseText;
?362 ??????????var?availTypes?=?[];
?363 ??????????if?(notFound.test(page))?{
?364 ????????????var?due?=?page.match(notFound)[1];
?365 ????????????availTypes.addUnique(["Not?available."?,?"#f66"]);
?366 ??????????}?else?{
?367 ????????????if?(libraryAvailability.test(page))?{
?368 ??????????????availTypes.addUnique(["On?the?shelf?now!"?,?"#00cc66"]);
?369 ????????????}
?370 ????????????if?(libraryCheckedOut.test(page))?{
?371 ??????????????availTypes.addUnique(["Checked?out"?,?"orange"]);
?372 ????????????}
?373 ????????????if?(libraryTransit.test(page))?{
?374 ??????????????availTypes.addUnique(["Transit?Request"?,?"orange"]);
?375 ????????????}
?376 ??????????}
?377 ??????????if?(!availTypes.length)?{
?378 ????????????while?(page.match(/(?:white|FCFDC|ormation)">(.+)<\/a>((.*[\n\r]*)*)/i))?{
?379 ??????????????var?extraType?=?RegExp.$1;
?380 ??????????????page?=?RegExp.$2;
?381 ??????????????extraType?=?extraType.replace(/<!--.*-->/g,'');
?382 ??????????????extraType?=?extraType.replace(/.nbsp;/g,?'?');
?383 ??????????????extraType?=?extraType.replace(/^\s+/,?'');
?384 ??????????????extraType?=?extraType.replace(/\s+$/,?'');
?385 ??????????????availTypes.addUnique([extraType,?"orange"]);
?386 ????????????}
?387 ??????????}
?388 ??????????if?(!availTypes.length)?{
?389 ????????????availTypes.addUnique(["Error:?Click?for?library?page.?You?can?check?by?searching?manually."?,?"red"]);
?390 ??????????}
?391 ??????????libraryLookup.insertLinks?(isobune,?availTypes);
?392 ????????};
?393 ??????};
?394 ??????for?(var?isbn?in?isbns)?{
?395 ????????GM_log(libraryUrlPattern?+?isbn?+?libraryUrlPatternSuffix);
?396 ????????GM_xmlhttpRequest?({method?:?'GET',?url?:?libraryUrlPattern?+?isbn?+?libraryUrlPatternSuffix,?onload?:?makeCallback(isbn)});
?397 ??????}
?398 ????}
?399 ??}
?400
?401 ??try?{
?402 ????libraryLookup.doLookup(thisisbn);
?403 ????var?head?=?document.getElementsByTagName('head');
?404 ????if?(head?&&?head[0])?{
?405 ??????var?s?=?document.createElement('script');
?406 ??????s.language='javascript';
?407 ??????s.type?=?'text/javascript';
?408 ??????s.text?=?'function?closeTRLC(){try{document.getElementById("trlcdiv").style.display="none"}catch(e){}}';
?409 ??????head[0].appendChild(s);
?410 ????}
?411 ??}?catch?(e)?{
?412 ????return;
?413 ??}
?414 }
?415 )();

 
Mar 29, 2007
Junk Blocker 23 posts

Topic: Script development / Having trouble updating my Amazon/library lookup script

Someone asked me to do a Script for Timberland Regional Llibrary Catalog which seems to match your ESLS library system completly. The code I wrote is available at my latest comment at http://userscripts.org/scripts/show/1072 . You should be able to use it completely by just changing the libraryUrlPattern .

HTH

 
Mar 18, 2007
Junk Blocker 23 posts

Topic: Script development / User Script Updates - Help!

Tmiland,

I am replying to this after looking at your 'Nettby Smileys' script. The only main issue seems to be the point 2 mentioned below.

1) Make sure the 'User Update Script' script is installed and enabled.

2) Change line 25 in your script to

	date: (new Date(2007,  3 - 1, 15))		// update date	

3) Replace line 31 with this

 try {
   (unsafeWindow || window.wrappedJSObject || window).UserScriptUpdates.requestAutomaticUpdates(SCRIPT);
 } catch (ex) {}

It works for me.

4) Remember that the 'User Script Updates' script caches your requests and only checks for updates once a week.

HTH

 
Mar 17, 2007
Junk Blocker 23 posts

Topic: Userscripts.org discussion / Welcome to the new site!

Thank you Henrik. Yes, editable comments would work even better. Removable comments in style of LiveJournal (for when I post while inebriated ;) ) would rock :)

 
Mar 17, 2007
Junk Blocker 23 posts

Topic: Userscripts.org discussion / Welcome to the new site!

The site needs details of the "Presentation HTML". Also needed is a preview facility to preview comments before posting.

 
Mar 12, 2007
Junk Blocker 23 posts

Topic: Userscripts.org discussion / Email update notify

LS, that doesn't work for a single user account with multiple computers to update.

 
Mar 10, 2007
Junk Blocker 23 posts

Topic: Userscripts.org discussion / Scripts modifying userscripts.org...

like http://userscripts.org/scripts/show/7697 should be built into the website. These are really useful. Other candidates would be the favorites functionality http://userscripts.org/scripts/show/1874 which, IIRC, is being planned already?

 
Feb 21, 2007
Junk Blocker 23 posts

Topic: Userscripts.org discussion / Need a direct link to ...

The header needs a direct link to the logged in user's scripts. Currently it takes some hunting to get there.

 
Feb 21, 2007
Junk Blocker 23 posts

Topic: Script development / A no fun naming surprise

I recently updated @name field of some of my scripts due to added functionality because 'Doer of foo' needs to be changed to 'Doer of foo, bar and baz' when the bar and baz functions are added. This ended up changing the file name for greasemonkey even though the somenumber.user.js name in the source url did not change. And consequently now I and my script users have duplicate (old and new) scripts operating for these functions and I can't help them other than leaving a note on my user script page after the fact. This needs to be fixed someplace :/

 
Feb 20, 2007
Junk Blocker 23 posts

Topic: Userscripts.org discussion / The "Your Scripts" list

How does install count remain correct for scripts which check for self updates? My scripts use 'User script updates' ( http://userscripts.org/scripts/show/2296 ) to do the same. Also, the 'view script source' script ( http://userscripts.org/scripts/show/5913 ) on here will skew this data.

 
Feb 19, 2007
Junk Blocker 23 posts

Topic: Userscripts.org discussion / Welcome to the new site!

peuh, Replace id='menu' with id='nav' on line 20 in that script and you have a system which works (mostly) again (for spending a couple of seconds on this) :).

Further updates:

Around line 108: Comment out var link and var script lines and replace with new script definition as follows and you have the full system working.

// orig var link = document.evaluate("//div[@id='content']/div[@id='name']/a[1]", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);

// orig var script = link.snapshotItem(0);

var script = document.evaluate("//div[@id='content']/h1", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null).snapshotItem(0);