Forked from spiralx/User script templates for Tampermonkey
Created
April 4, 2018 03:31
-
-
Save aleung/af5d8cb75fea8bba55ea22f620d97532 to your computer and use it in GitHub Desktop.
Tampermonkey user script templates
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name New Coffee-Userscript | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description shows how to use coffeescript compiler | |
// @author You | |
// @require http://coffeescript.org/extras/coffee-script.js | |
// @match <$URL$> | |
// @name Site - CoffeeScript | |
// @description CoffeeScript script | |
// @author James Skinner <[email protected]> (http://github.com/spiralx) | |
// @namespace http://spiralx.org/ | |
// @version 0.0.1 | |
// @icon http://tampermonkey.net/favicon.ico | |
// @match <$URL$> | |
// @grant none | |
// @run-at document-end | |
// @require https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.js | |
// @require https://rawgit.com/spiralx/653f2226b08167e4aaf8/raw/e830ed1ff2202102b91eb326f7826613ae9070ed/urijs-all.js | |
// @require http://coffeescript.org/extras/coffee-script.js | |
// ==/UserScript== | |
/* jshint ignore:start */ | |
var inline_src = (<><![CDATA[ | |
/* jshint ignore:end */ | |
# Code... | |
/* jshint ignore:start */ | |
]]></>).toString(); | |
var compiled = this.CoffeeScript.compile(inline_src); | |
eval(compiled); | |
/* jshint ignore:end */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Site - Script | |
// @description ES6 script | |
// @author James Skinner <[email protected]> (http://github.com/spiralx) | |
// @namespace http://spiralx.org/ | |
// @version 0.0.1 | |
// @icon http://tampermonkey.net/favicon.ico | |
// @match <$URL$> | |
// @grant none | |
// @run-at document-end | |
// @require https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.js | |
// @require https://rawgit.com/spiralx/653f2226b08167e4aaf8/raw/e830ed1ff2202102b91eb326f7826613ae9070ed/urijs-all.js | |
// ==/UserScript== | |
/* jshint asi: true, esnext: true, -W097 */ | |
(function($) { | |
'use strict' | |
// Code... | |
}).bind(this)(jQuery) | |
jQuery.noConflict() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Site - Script | |
// @description ES6 script | |
// @author James Skinner <[email protected]> (http://github.com/spiralx) | |
// @namespace http://spiralx.org/ | |
// @version 0.0.1 | |
// @icon http://tampermonkey.net/favicon.ico | |
// @match <$URL$> | |
// @grant none | |
// @run-at document-end | |
// @require https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.js | |
// @require https://rawgit.com/spiralx/653f2226b08167e4aaf8/raw/e830ed1ff2202102b91eb326f7826613ae9070ed/urijs-all.js | |
// @require https://cdnjs.cloudflare.com/ajax/libs/babel-core/6.1.19/browser.min.js | |
// ==/UserScript== | |
/* jshint ignore:start */ | |
var inline_src = (<><![CDATA[ | |
/* jshint ignore:end */ | |
/* jshint asi:true, esnext:true, -W097 */ | |
(function($) { | |
'use strict' | |
// Code... | |
}).bind(this)(jQuery) | |
jQuery.noConflict() | |
/* jshint ignore:start */ | |
]]></>).toString(); | |
//var c = babel.transform(inline_src); | |
var c = babel.transform(inline_src, { | |
filename: GM_info.script.name.replace(/\s+/g, '-').replace(/[^\w\-]+/g, '') + '.user.js', | |
sourceMaps: 'inline' | |
}) | |
eval(c.code); | |
/* jshint ignore:end */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
For | |
* ES5 | |
* ES6 | |
* CoffeeScript |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment