<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Is Opera disabling Violentmonkey scripts?]]></title><description><![CDATA[<p dir="auto">All of a sudden, one of my Violentmonkey scripts stopped working.  It created a stylesheet to be used with any web page.  I tried different approaches, but none have worked.  What is wrong with Opera or Violentmonkey?  The script was working before.  Instead of creating a stylesheet on the fly, I tried loading one from my hard drive, but that does not work either.  Am I screwing up, suddenly?  The scripts:</p>
<pre><code>// ==UserScript==
// @name     Content-style
// @namespace Violentmonkey Scripts
// @include  *
// @grant none
// ==/UserScript==
function addCss(cssString) {
    var newCss = document.createElement('style');
    newCss.type = "text/css";
    newCss.innerHTML = cssString;
    document.getElementsByTagName('head')[0].appendChild(newCss);
    console.log("appended css");
}

addCss (
  'a[href^="javascript:"] {                                            \
     color: #006000 !important; background-color: #FFD8D8 !important;  \
     background-image: none !important;                                \
   }                                                                   \
   a:visited {                             \
   	 color: #AA00AA !important;            \
     background-color: #FFFFB0 !important; \
     background-image: none !important;    \
   }                                       \
   a:hover {                            \
     color: #E00000 !important;         \
     background-color: #A0FFFF;         \
     background-image: none !important; \
   }                                    \
   :link[target="_blank"], :visited[target="_blank"],\
   :link[target="_new"],   :visited[target="_new"] { \
   cursor:  crosshair;                               \
   }                                                 \
   p {user-select: text !important;   \
   }                                  \
   div.back2top {height: auto !important; \
   }                                      \
   canvas {                           \
     border: 4px solid red!important; \
   }                                  \
');
</code></pre>
<p dir="auto">With the same header but attempts at 3 different sets of contents ([username} replaces the name of my account):</p>
<pre><code>var cssId = 'myCss';
{
    var head  = document.getElementsByTagName('head')[0];
    var link  = document.createElement('link');
    link.id   = cssId;
    link.rel  = 'stylesheet';
    link.type = 'text/css';
    link.href = 'file:///Users/[username]/Sites/Opera%20Stuff/opcontent.css';
    link.media = 'all';
    head.appendChild(link);
}


  var styles = "@import url('file:///Users/[username]/Sites/Opera%20Stuff/opcontent.css');";
  var newSS=document.createElement('link');
  newSS.rel='stylesheet';
  newSS.href='data:text/css,'+escape(styles);
  document.getElementsByTagName("head")[0].appendChild(newSS);
  
  
  function loadcssfile(filename, filetype) {
    if (filetype == "css") {
    var fileref = document.createElement("link")
    fileref.setAttribute("rel", "stylesheet")
    fileref.setAttribute("type", "text/css")
    fileref.setAttribute("href", "file:///Users/[username]/Sites/Opera%20Stuff/opcontent.css")
  }
  if (typeof fileref != "undefined")
    document.getElementsByTagName("head")[0].appendChild(fileref)
}
</code></pre>
]]></description><link>https://forums.opera.com/topic/21505/is-opera-disabling-violentmonkey-scripts</link><generator>RSS for Node</generator><lastBuildDate>Sat, 09 May 2026 23:55:43 GMT</lastBuildDate><atom:link href="https://forums.opera.com/topic/21505.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 24 Jun 2017 22:05:52 GMT</pubDate><ttl>60</ttl></channel></rss>