Opera User Javascript och Firefox Greasemonkey

Permalänk
Medlem

Opera User Javascript och Firefox Greasemonkey

Har ett litet problem med att få ett Greasemonkey-script att fungera i Opera. Det är ju helt vanlig Javascript, så det borde fungera. Jag får en del andra greasemonkey scripts att fungera i Opera, så jag tycker det är konstigt att inte denna fungerar. http://www.deviantart.com/deviation/18410488/

Så här ser min user.js till Opera ut just nu: (Har IGN och Gamespot ad page skipper också. Men det blir för mycket att scrolla med det.)

// ==UserScript== // @include * // @exclude http://www.deviantart.com/deviation/*/favourites // ==/UserScript== //Site Specifik CSS// document.addEventListener('load', function(ev){ if ((document.body) && (!document.body.hasAttribute('id'))) { document.body.setAttribute('id', location.host.replace(/^www\./,'').replace(/^\d/,'_$&').replace(/\./g,'-')); } }, false); //Deviantart gallery skip// (function (){ var thumbs = 5; var thumbsize = 100; var bkcolor = "BBC2BB"; var deviationId = (document.location+'').match(/[0-9]+/)[0]; var deviantName = xpSingle("//div[@class='author section']/div/a/img[@title]").title; if(deviationId && deviantName){ // Adapted from moeffju's slideshow code. Hope you don't mind ;) var gf = document.createElement('script'); gf.src = 'ht' + 'tp://' + deviantName + '.deviantart.com/stats/gallery/script.js.php/gallerystats.js'; document.getElementsByTagName('head')[0].appendChild(gf); var gfTimer = setInterval(checkForGF, 100); initDisplay(); } function getURL(s) { //Again.. adapted from moeffju's slideshow code. Because he is a regex ninja, and I am not. if (s.match(/^http:\/\/.*\.deviantart\.com\/\d+\/(.*)\.deviantart\.com/)) return s.replace(/^http:\/\/.*\.deviantart\.com\/\d+\/(.*)\.deviantart\.com/, 'http://ic1.deviantart.com/$1'); else return s.replace(/^http:\/\/.*\.deviantart\.com\/\d+\//, 'http://images.deviantart.com/'); } function checkForGF(){ if(window.GalleryFeed){ clearInterval(gfTimer); document.getElementById('gs-top').innerHTML = "Other deviations by " + deviantName; var gfId = -1; for(var i=0;i<window.GalleryFeed.deviations.length;i++){ if(window.GalleryFeed.deviations[i].id == deviationId) gfId = i; } if(gfId == -1){ document.getElementById('gs-top').innerHTML = "Error locating current deviation in GalleryFeed"; }else{ var start=(gfId-parseInt(thumbs/2)); if(start < 0) start = 0; if(start+thumbs > window.GalleryFeed.deviations.length) start = window.GalleryFeed.deviations.length - thumbs; var gsTr = document.getElementById('gs-thumbs'); gsTr.style.verticalAlign = "center"; gsTrLoop(start, start+thumbs, gsTr, IMGFromGFItem); gsTr = document.getElementById('gs-titles'); gsTr.style.verticalAlign = "top"; gsTrLoop(start, start+thumbs, gsTr, TitleFromGFItem); } } } function gsTrLoop(start, end, node, func){ for(var j=start;j<end;j++){ var td = document.createElement('td'); td.innerHTML = func(window.GalleryFeed.deviations[j]); td.style.textAlign = "center"; td.style.width = parseInt(100 / thumbs) + "%"; node.appendChild(td); } } function initDisplay(){ var authorDiv = xpSingle("//div[@class='author section']"); var gsDiv = document.createElement('div'); gsDiv.id = "gs-outer"; gsDiv.className = "section"; gsDiv.style.marginTop = "-1em"; gsDiv.innerHTML = '\ <div class="section-head"><h2 id="gs-top">Loading other deviations by '+deviantName+'...</h2></div>\ <div class="trailing section-block">\ <table style="width:100%"><tr id="gs-thumbs"></tr><tr id="gs-titles"></tr></table>\ </div>\ '; authorDiv.parentNode.insertBefore(gsDiv, authorDiv); } function xpSingle(str){ return document.evaluate(str, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue; } function IMGFromGFItem(item){ var wh = item.resolution.split('x'); var w = wh[0]; var h = wh[1]; var small = (w<thumbsize && h<thumbsize); if(small) var url = getURL(item.thumb); else{ if((w/h) > 1){ h = parseInt(h / (w / thumbsize)); w = thumbsize; }else{ w = parseInt(w / (h / thumbsize)); h = thumbsize; } var url = item.thumb.replace(/deviantart\.com\/\d+/, 'deviantart.com/'+thumbsize); } var out = '<a href="/view/'+item.id+'/"><img src="'+url+'" width="'+w+'" height="'+h+'" /></a>'; if(!small){ out = '<span class="shadow-holder"><span class="shadow" style="background-image:url(http://sh.deviantart.com/shadow/'+bkcolor+'-000000/5.1-0.6/'+w+'/'+h+'/null.png);">'+out+'</span></span>'; } return out; } function TitleFromGFItem(item){ return '<a href="/view/'+item.id+'/">'+item.title+'</a><br /><sup>'+item.category+'</sup>'; } })();

Det är deviantart gallery skip jag vill få att fungera. Det är väldigt användbart med Greasemonkey till Firefox tycker jag. Nu vill jag också få det fungera i Opera.

Visa signatur