Search Results

Search found 4 results on 1 pages for 'userjs'.

Page 1/1 | 1 

  • Scroll to anchor

    - by ZyX
    I have the following userjs which is intended to remove anchor part of the URL but still jump to it: // ==UserScript== // @name PurgeAnchor // @include * // ==/UserScript== (function() { var reg=/^(.*)\#(.*)$/; var match=reg.exec(location); function ObjectPosition(obj) { var curtop = 0; if(obj.offsetParent) while(1) { curtop += obj.offsetTop; if(!obj.offsetParent) break; obj = obj.offsetParent; } else if(obj.y) curtop += obj.y; return curtop; } if(match) { document.location.replace(match[1]); sessionStorage.setItem("anchor", match[2]); } window.addEventListener("load", (function() { var anchor=sessionStorage.getItem("anchor"); if(anchor!==null) { var obj=document.getElementById(anchor); if(obj===null) { obj=document.getElementsByName(anchor)[0]; } var pos=0; if(obj!==null) { pos=ObjectPosition(obj); window.scrollTo(0, pos); } sessionStorage.removeItem("anchor"); } }), false); })() The problem is that if I have an empty <a> tag with the name set, it fails to jump. obj.scrollIntoView() also fails. Opera-10.52_pre6306, Gentoo.

    Read the article

  • Getting rid of site-specific hotkeys

    - by ZyX
    How do I disable site-specific hotkeys if (and only if) they are already mapped in Opera? For example, I use <C-b> instead of <Right> and <C-h> instead of <BS>. On Stack Overflow/Super User they produce **strong text** and ## Heading ## respectively. I do not want this happen. I can examine Super User/Stack Overflow/some_other_site's javascript and write a userjs to do the job, but this method is not universal. I'm using Opera-10.51_pre6252 in Gentoo Linux.

    Read the article

  • Spoofing UserAgent in Opera

    - by PoweRoy
    I'm trying to spoof Opera (under linux) to be an other browser, in this case iPad for some testing purposes. Now I know sites can check which browser is accessing the using for example in PHP $useragent = $_SERVER['HTTP_USER_AGENT']; and in javascript navigator.userAgent (or navigator.platform). In firefox you can use an addon to easily switch your useragent and other relevant information, but in Opera it seems it bit hard to do. First in opera.ini you can do: [User Agent] Spoof UserAgent ID=1 But this is limited to a predefined list of UserAgents. No room for custom ones. Also in opera.ini [ISP] Id=iPad This will add iPad to the User Agent of Opera. It's a start and works most of the time on the sites. In opera.ini you can set a 'User JavaScript file' to load a custom JavaScript file before loading a website: [User Prefs] User JavaScript File=/opera_dir/userjs/load.js In load.js you can do: navigator.userAgent = "Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B334b Safari/531.21.10" Because this file gets executed before loading the website I can modify the UserAgent, but this won't work when a site is checking the UserAgent via PHP, but it works for sites checking with Javascript) So here's my question: is there another way of spoofing a complete custom UserAgent?

    Read the article

1