• Login
    • Search
    • Categories
    • Recent
    • Tags
    • Users
    • Groups
    • Rules
    • Help

    Do more on the web, with a fast and secure browser!

    Download Opera browser with:

    • built-in ad blocker
    • battery saver
    • free VPN
    Download Opera

    Migrated 12.11->12.17, now my js doesn't work

    Opera for Windows
    2
    5
    1230
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • ozpa
      ozpa last edited by

      Hi all!
      I only have a single script that highlights words on the page for me that match the list in the script. He's my script:

      // ==UserScript==
      // @name Highlight Words
      // @author bpm
      // @version 1.1
      // @description Highlights works from an array
      // @include https://www.examplesite.com/*
      // ==/UserScript==
      // 1.1 Updated by Frenzie, added easy to configure wordlist
      (function () {
      var wordlist=[
      /@Wordlist (quote properly and use commas between values)@string@/

      "word 1",
      "word 2",
      "word 3",
      "word 4",

      /@/
      ];
      // other config
      var highlightBgColor = /@Highlight background color@string@/'grey'/@/;
      var highlightColor = /@Highlight font color@string@/'grey'/@/;

      function hilite(text){
      	var count=0,dv;
      	dv=document.defaultView;
      	function searchWithinNode(node,te,len){
      		var pos,skip,spannode,middlebit,endbit,middleclone;
      		skip=0;
      		if(node.nodeType==3){
      			pos=node.data.toUpperCase().indexOf(te);
      			if(pos>=0){
      				spannode=document.createElement('SPAN');
      				spannode.style.backgroundColor=highlightBgColor;
      				spannode.style.color=highlightColor;
      				spannode.style.fontWeight='bold';
      				middlebit=node.splitText(pos);
      				endbit=middlebit.splitText(len);
      				middleclone=middlebit.cloneNode(true);
      				spannode.appendChild(middleclone);
      				middlebit.parentNode.replaceChild(spannode,middlebit);
      				++count;
      				skip=1;
      			}
      		}
      		else if(node.nodeType==1&& node.childNodes && node.tagName.toUpperCase()!='SCRIPT' && node.tagName.toUpperCase!='STYLE'){
      			for (var child=0;child<node.childNodes.length;++child){
      				child=child+searchWithinNode(node.childNodes[child],te,len);
      			}
      		}
      	return skip;
      	}
      	searchWithinNode(document.body,text.toUpperCase(),text.length);
      }
      
      document.addEventListener('DOMContentLoaded',function() {
      	for (i=0; i<wordlist.length; i++) {
      		hilite(wordlist[i]);
      	}
      }, false);
      

      })();

      Reply Quote 0
        1 Reply Last reply
      • ozpa
        ozpa last edited by

        Sorry I can't edit my 1st post, here's a tidier version on pastebin:

        http://pastebin.com/e8uRCdQ4

        Reply Quote 0
          1 Reply Last reply
        • Deleted User
          Deleted User last edited by

          My Code on http://pastebin.com/UXHRg4yG works fine for me.

          • check antivirus sioftware interfering with UserJS
          • check other UserJS scripts interfering
          • check Extensions blocking your UserJS
          • check your userJS file name, name the file hilite.js, hilite.user.js does not load the file
          • set path to all your UserJS files with opera:config#UserPrefs|UserJavaScriptFile
          • activate opera:config#UserPrefs|AlwaysLoadUserJavaScript
          • activate opera:config#UserPrefs|UserJavaScript
          • activate UserJS on https sites with opera:config#UserPrefs|UserJavaScriptonHTTPS
          Reply Quote 0
            1 Reply Last reply
          • ozpa
            ozpa last edited by

            Found it! (thanks to your bullet point "set path to all your UserJS files with opera:config#UserPrefs|UserJavaScriptFile")

            Noticed 1 small thing below the path to user scripts, remembered that my links were in HTTPS so I enabled a checbox below and wuala! 😃

            http://i.imgur.com/0Tm5luD.jpg

            Much love angiesdom 😉

            Reply Quote 0
              1 Reply Last reply
            • Deleted User
              Deleted User last edited by

              Fine.

              Much love angiesdom 😉

              Thanks for the flowers 🙂

              Reply Quote 0
                1 Reply Last reply
              • First post
                Last post

              Computer browsers

              • Opera for Windows
              • Opera for Mac
              • Opera for Linux
              • Opera beta version
              • Opera USB

              Mobile browsers

              • Opera for Android
              • Opera Mini
              • Opera Touch
              • Opera for basic phones

              • Add-ons
              • Opera account
              • Wallpapers
              • Opera Ads

              • Help & support
              • Opera blogs
              • Opera forums
              • Dev.Opera

              • Security
              • Privacy
              • Cookies Policy
              • EULA
              • Terms of Service

              • About Opera
              • Press info
              • Jobs
              • Investors
              • Become a partner
              • Contact us

              Follow Opera

              • Opera - Facebook
              • Opera - Twitter
              • Opera - YouTube
              • Opera - LinkedIn
              • Opera - Instagram

              © Opera Software 1995-