Chrome seems to be eating up my userscript metadata:
// ==UserScript== // @name Flag Offtopic button // @version 1.0 // @description Vote-to-off-topic button // @author Manish Goregaokar (http://stackapps.com/users/10098/manishearth) // @license GNU GPL v3 (http://gnu.org/copyleft/gpl.html) // @include http://meta.stackexchange.com/questions/* // ==/UserScript== function with_jquery(f) { var script = document.createElement("script"); script.type = "text/javascript"; script.textContent = "(" + f.toString() + ")(jQuery)"; document.body.appendChild(script); }; //(rest of script availible on request)
The script works, but the metadata doesn't (it tries to run on every site, the filename shows up instead of "Flag Offtopic button", etc)
I'm new to userscripts, so I don't know what I'm doing wrong. Something stupid, no doubt.
Additional info: initially, the script had an incompatible charset (dunno why). I changed it to UTF-8 using Dreamweaver's Modify>Page properties , and the script worked (with metadata). It later broke(can't remember when) the metadata, but I thought it was some errant space. Now I can't find what's wrong. The above code itself (when copy-pasted to notepad, saved as abc.user.js
, and drag-dropped to Chrome) loses its metadata.
There was no doubt a UTF-8 BOM hiding in the front of the document. That issue bit me the other day.
(Why the UTF-8 BOM even exists is certainly a good question, but why editors even use them is truly confusing.)