Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save gagelafleur/5236f3889af1813adb6929fe94a3868f to your computer and use it in GitHub Desktop.

Select an option

Save gagelafleur/5236f3889af1813adb6929fe94a3868f to your computer and use it in GitHub Desktop.

Revisions

  1. @spiralx spiralx revised this gist Feb 14, 2016. 1 changed file with 6 additions and 1 deletion.
    7 changes: 6 additions & 1 deletion es6-user-script-template.user.js
    Original file line number Diff line number Diff line change
    @@ -31,7 +31,12 @@ jQuery.noConflict()
    /* jshint ignore:start */
    ]]></>).toString();

    var c = babel.transform(inline_src);
    //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 */
  2. @spiralx spiralx renamed this gist Feb 14, 2016. 1 changed file with 0 additions and 0 deletions.
  3. @spiralx spiralx revised this gist Feb 14, 2016. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions User script templates for Tampermonkey
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    For

    * ES5
    * ES6
    * CoffeeScript
  4. @spiralx spiralx renamed this gist Feb 14, 2016. 1 changed file with 0 additions and 1 deletion.
    Original file line number Diff line number Diff line change
    @@ -33,4 +33,3 @@ var compiled = this.CoffeeScript.compile(inline_src);
    eval(compiled);

    /* jshint ignore:end */

  5. @spiralx spiralx renamed this gist Feb 14, 2016. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  6. @spiralx spiralx revised this gist Feb 14, 2016. 3 changed files with 0 additions and 0 deletions.
    File renamed without changes.
    File renamed without changes.
    File renamed without changes.
  7. @spiralx spiralx created this gist Feb 14, 2016.
    36 changes: 36 additions & 0 deletions cs-template.coffee
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,36 @@
    // ==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 <spiralx@gmail.com> (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 */

    24 changes: 24 additions & 0 deletions es5-template.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,24 @@
    // ==UserScript==
    // @name Site - Script
    // @description ES6 script
    // @author James Skinner <spiralx@gmail.com> (https://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()
    37 changes: 37 additions & 0 deletions es6-template.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,37 @@
    // ==UserScript==
    // @name Site - Script
    // @description ES6 script
    // @author James Skinner <spiralx@gmail.com> (https://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);
    eval(c.code);

    /* jshint ignore:end */