Skip to content

Instantly share code, notes, and snippets.

@abernier
Created November 15, 2011 22:51

Revisions

  1. abernier revised this gist Jul 18, 2012. 2 changed files with 82 additions and 83 deletions.
    94 changes: 82 additions & 12 deletions acegist.user.js
    Original file line number Diff line number Diff line change
    @@ -10,29 +10,99 @@
    (function (d, cb) {

    //
    // RequireJS over here!
    // A script loader over here!
    //

    if (typeof window.requirejs === 'undefined') {
    if (typeof $LAB === 'undefined') {
    var s;

    s = d.createElement('script');
    s.src = 'https://raw.github.com/jrburke/requirejs/master/require.js';
    s.onload = function () {
    s = d.createElement('script');
    s.src = 'https://raw.github.com/getify/LABjs/master/LAB.min.js';
    s.onload = function () {
    var s;

    s = d.createElement('script');
    s.textContent = '(' + cb.toString() + ')(requirejs);';
    s.textContent = '(' + cb.toString() + ')();';

    d.body.appendChild(s);
    }
    d.body.appendChild(s);
    } else {
    cb(requirejs)
    cb()
    }
    }(document, function (require) {
    require.config({
    baseUrl: "https://raw.github.com/gist/1368637"
    });
    require(['index']);
    }(document, function () {

    //
    // Syntax highlighting modes
    //

    var modes = {
    'js': {
    url: 'https://raw.github.com/ajaxorg/ace/v0.2.0/build/src/mode-javascript.js',
    module: 'ace/mode/javascript'
    },
    'coffee': {
    url: 'https://raw.github.com/ajaxorg/ace/v0.2.0/build/src/mode-coffee.js',
    module: 'ace/mode/coffee'
    },
    'html': {
    url: 'https://raw.github.com/ajaxorg/ace/v0.2.0/build/src/mode-html.js',
    module: 'ace/mode/html'
    },
    'css': {
    url: 'https://raw.github.com/ajaxorg/ace/v0.2.0/build/src/mode-css.js',
    module: 'ace/mode/css'
    }
    };

    $LAB
    .script('https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js')
    .script('https://raw.github.com/ajaxorg/ace/v0.2.0/build/src/ace.js')
    .script('https://raw.github.com/ajaxorg/ace/v0.2.0/build/src/theme-twilight.js')
    .wait(function () {
    $('textarea').each(function (i, el) {
    var $el,
    $container,
    editor,
    ext;

    $el = $(el);

    //
    // Principle: inject an DOM element (sized and positioned) and hide the textarea
    //

    $container = $('<div/>').css({
    position: 'relative',
    width: $el.width(),
    height: $el.height()
    }).insertAfter(el);

    $el.hide();

    //
    // ACE magic
    //

    editor = ace.edit($container[0]);

    editor.setTheme('ace/theme/twilight');

    // Keep hidden textarea in sync

    editor.getSession().setValue($el.val());
    editor.getSession().on('change', function () {
    $el.val(editor.getSession().getValue());
    });

    // Syntax highlighting depending on filename.<ext>

    ext = $el.closest('.file').find('.name input').val().split('.').slice(-1)[0];
    modes[ext] && $LAB.script(modes[ext].url).wait(function () {
    var Mode = require(modes[ext].module).Mode;
    editor.getSession().setMode(new Mode());
    });
    });
    })
    ;
    }));
    71 changes: 0 additions & 71 deletions index.js
    Original file line number Diff line number Diff line change
    @@ -1,71 +0,0 @@
    require(['https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js', 'https://raw.github.com/ajaxorg/ace/v0.2.0/build/src/ace.js', 'https://raw.github.com/ajaxorg/ace/v0.2.0/build/src/theme-twilight.js'], function() {

    //
    // Syntax highlighting modes
    //

    var modes = {
    'js': {
    url: 'https://raw.github.com/ajaxorg/ace/v0.2.0/build/src/mode-javascript.js',
    module: 'ace/mode/javascript'
    },
    'coffee': {
    url: 'https://raw.github.com/ajaxorg/ace/v0.2.0/build/src/mode-coffee.js',
    module: 'ace/mode/coffee'
    },
    'html': {
    url: 'https://raw.github.com/ajaxorg/ace/v0.2.0/build/src/mode-html.js',
    module: 'ace/mode/html'
    },
    'css': {
    url: 'https://raw.github.com/ajaxorg/ace/v0.2.0/build/src/mode-css.js',
    module: 'ace/mode/css'
    }
    };

    $(function () {
    $('textarea').each(function (i, el) {
    var $el,
    $container,
    editor,
    ext;

    $el = $(el);

    //
    // Principle: inject an DOM element (sized and positioned) and hide the textarea
    //

    $container = $('<div/>').css({
    position: 'relative',
    width: $el.width(),
    height: $el.height()
    }).insertAfter(el);

    $el.hide();

    //
    // ACE magic
    //

    editor = ace.edit($container[0]);

    editor.setTheme('ace/theme/twilight');

    // Keep hidden textarea in sync

    editor.getSession().setValue($el.val());
    editor.getSession().on('change', function () {
    $el.val(editor.getSession().getValue());
    });

    // Syntax highlighting depending on filename.<ext>

    ext = $el.closest('.file').find('.name input').val().split('.').slice(-1)[0];
    ext in modes && require(modes[ext].url, function () {
    var Mode = require(modes[ext].module).Mode;
    editor.getSession().setMode(new Mode());
    });
    });
    });
    });
  2. abernier revised this gist Jul 18, 2012. 1 changed file with 42 additions and 40 deletions.
    82 changes: 42 additions & 40 deletions index.js
    Original file line number Diff line number Diff line change
    @@ -23,47 +23,49 @@ require(['https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js', 'https://ra
    }
    };

    $(function () {$('textarea').each(function (i, el) {
    var $el,
    $container,
    editor,
    ext;

    $el = $(el);

    //
    // Principle: inject an DOM element (sized and positioned) and hide the textarea
    //

    $container = $('<div/>').css({
    position: 'relative',
    width: $el.width(),
    height: $el.height()
    }).insertAfter(el);

    $el.hide();

    //
    // ACE magic
    //

    editor = ace.edit($container[0]);
    $(function () {
    $('textarea').each(function (i, el) {
    var $el,
    $container,
    editor,
    ext;

    $el = $(el);

    //
    // Principle: inject an DOM element (sized and positioned) and hide the textarea
    //

    $container = $('<div/>').css({
    position: 'relative',
    width: $el.width(),
    height: $el.height()
    }).insertAfter(el);

    $el.hide();

    //
    // ACE magic
    //

    editor = ace.edit($container[0]);

    editor.setTheme('ace/theme/twilight');

    // Keep hidden textarea in sync

    editor.getSession().setValue($el.val());
    editor.getSession().on('change', function () {
    $el.val(editor.getSession().getValue());
    });
    editor.setTheme('ace/theme/twilight');
    // Keep hidden textarea in sync
    editor.getSession().setValue($el.val());
    editor.getSession().on('change', function () {
    $el.val(editor.getSession().getValue());
    });

    // Syntax highlighting depending on filename.<ext>

    ext = $el.closest('.file').find('.name input').val().split('.').slice(-1)[0];
    modes[ext] && $LAB.script(modes[ext].url).wait(function () {
    var Mode = require(modes[ext].module).Mode;
    editor.getSession().setMode(new Mode());
    // Syntax highlighting depending on filename.<ext>

    ext = $el.closest('.file').find('.name input').val().split('.').slice(-1)[0];
    ext in modes && require(modes[ext].url, function () {
    var Mode = require(modes[ext].module).Mode;
    editor.getSession().setMode(new Mode());
    });
    });
    });});
    });
    });
  3. abernier revised this gist Jul 18, 2012. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions index.js
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    require(['http://code.jquery.com/jquery-latest.min.js', 'https://raw.github.com/ajaxorg/ace/v0.2.0/build/src/ace.js', 'https://raw.github.com/ajaxorg/ace/v0.2.0/build/src/theme-twilight.js'], function() {
    require(['https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js', 'https://raw.github.com/ajaxorg/ace/v0.2.0/build/src/ace.js', 'https://raw.github.com/ajaxorg/ace/v0.2.0/build/src/theme-twilight.js'], function() {

    //
    // Syntax highlighting modes
    @@ -23,7 +23,7 @@ require(['http://code.jquery.com/jquery-latest.min.js', 'https://raw.github.com/
    }
    };

    $('textarea').each(function (i, el) {
    $(function () {$('textarea').each(function (i, el) {
    var $el,
    $container,
    editor,
    @@ -65,5 +65,5 @@ require(['http://code.jquery.com/jquery-latest.min.js', 'https://raw.github.com/
    var Mode = require(modes[ext].module).Mode;
    editor.getSession().setMode(new Mode());
    });
    });
    });});
    });
  4. abernier revised this gist Jul 18, 2012. 2 changed files with 82 additions and 83 deletions.
    96 changes: 13 additions & 83 deletions acegist.user.js
    Original file line number Diff line number Diff line change
    @@ -2,107 +2,37 @@
    // @id acegist
    // @name ACEgist
    // @author Antoine BERNIER (abernier)
    // @version 0.1.1
    // @version 0.1.2
    // @description ACE editor in your gists
    // @match https://gist.github.com/gists/*/edit
    // ==/UserScript==

    (function (d, cb) {

    //
    // A script loader over here!
    // RequireJS over here!
    //

    if (typeof $LAB === 'undefined') {
    if (typeof window.requirejs === 'undefined') {
    var s;

    s = d.createElement('script');
    s.src = 'https://raw.github.com/getify/LABjs/master/LAB.min.js';
    s.onload = function () {
    s = d.createElement('script');
    s.src = 'https://raw.github.com/jrburke/requirejs/master/require.js';
    s.onload = function () {
    var s;

    s = d.createElement('script');
    s.textContent = '(' + cb.toString() + ')();';
    s.textContent = '(' + cb.toString() + ')(requirejs);';

    d.body.appendChild(s);
    }
    d.body.appendChild(s);
    } else {
    cb()
    cb(requirejs)
    }
    }(document, function () {

    //
    // Syntax highlighting modes
    //

    var modes = {
    'js': {
    url: 'https://raw.github.com/ajaxorg/ace/v0.2.0/build/src/mode-javascript.js',
    module: 'ace/mode/javascript'
    },
    'coffee': {
    url: 'https://raw.github.com/ajaxorg/ace/v0.2.0/build/src/mode-coffee.js',
    module: 'ace/mode/coffee'
    },
    'html': {
    url: 'https://raw.github.com/ajaxorg/ace/v0.2.0/build/src/mode-html.js',
    module: 'ace/mode/html'
    },
    'css': {
    url: 'https://raw.github.com/ajaxorg/ace/v0.2.0/build/src/mode-css.js',
    module: 'ace/mode/css'
    }
    };

    $LAB
    .script('http://code.jquery.com/jquery-latest.min.js')
    .script('https://raw.github.com/ajaxorg/ace/v0.2.0/build/src/ace.js')
    .script('https://raw.github.com/ajaxorg/ace/v0.2.0/build/src/theme-twilight.js')
    .wait(function () {
    $('textarea').each(function (i, el) {
    var $el,
    $container,
    editor,
    ext;

    $el = $(el);

    //
    // Principle: inject an DOM element (sized and positioned) and hide the textarea
    //

    $container = $('<div/>').css({
    position: 'relative',
    width: $el.width(),
    height: $el.height()
    }).insertAfter(el);

    $el.hide();

    //
    // ACE magic
    //

    editor = ace.edit($container[0]);

    editor.setTheme('ace/theme/twilight');

    // Keep hidden textarea in sync

    editor.getSession().setValue($el.val());
    editor.getSession().on('change', function () {
    $el.val(editor.getSession().getValue());
    });

    // Syntax highlighting depending on filename.<ext>

    ext = $el.closest('.file').find('.name input').val().split('.').slice(-1)[0];
    modes[ext] && $LAB.script(modes[ext].url).wait(function () {
    var Mode = require(modes[ext].module).Mode;
    editor.getSession().setMode(new Mode());
    });
    });
    })
    ;
    }(document, function (require) {
    require.config({
    baseUrl: "https://raw.github.com/gist/1368637"
    });
    require(['index']);
    }));
    69 changes: 69 additions & 0 deletions index.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,69 @@
    require(['http://code.jquery.com/jquery-latest.min.js', 'https://raw.github.com/ajaxorg/ace/v0.2.0/build/src/ace.js', 'https://raw.github.com/ajaxorg/ace/v0.2.0/build/src/theme-twilight.js'], function() {

    //
    // Syntax highlighting modes
    //

    var modes = {
    'js': {
    url: 'https://raw.github.com/ajaxorg/ace/v0.2.0/build/src/mode-javascript.js',
    module: 'ace/mode/javascript'
    },
    'coffee': {
    url: 'https://raw.github.com/ajaxorg/ace/v0.2.0/build/src/mode-coffee.js',
    module: 'ace/mode/coffee'
    },
    'html': {
    url: 'https://raw.github.com/ajaxorg/ace/v0.2.0/build/src/mode-html.js',
    module: 'ace/mode/html'
    },
    'css': {
    url: 'https://raw.github.com/ajaxorg/ace/v0.2.0/build/src/mode-css.js',
    module: 'ace/mode/css'
    }
    };

    $('textarea').each(function (i, el) {
    var $el,
    $container,
    editor,
    ext;

    $el = $(el);

    //
    // Principle: inject an DOM element (sized and positioned) and hide the textarea
    //

    $container = $('<div/>').css({
    position: 'relative',
    width: $el.width(),
    height: $el.height()
    }).insertAfter(el);

    $el.hide();

    //
    // ACE magic
    //

    editor = ace.edit($container[0]);

    editor.setTheme('ace/theme/twilight');

    // Keep hidden textarea in sync

    editor.getSession().setValue($el.val());
    editor.getSession().on('change', function () {
    $el.val(editor.getSession().getValue());
    });

    // Syntax highlighting depending on filename.<ext>

    ext = $el.closest('.file').find('.name input').val().split('.').slice(-1)[0];
    modes[ext] && $LAB.script(modes[ext].url).wait(function () {
    var Mode = require(modes[ext].module).Mode;
    editor.getSession().setMode(new Mode());
    });
    });
    });
  5. abernier revised this gist Nov 16, 2011. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions acegist.user.js
    Original file line number Diff line number Diff line change
    @@ -99,8 +99,8 @@

    ext = $el.closest('.file').find('.name input').val().split('.').slice(-1)[0];
    modes[ext] && $LAB.script(modes[ext].url).wait(function () {
    var Mode = require(modes[ext].module).Mode
    editor.getSession().setMode(new Mode())
    var Mode = require(modes[ext].module).Mode;
    editor.getSession().setMode(new Mode());
    });
    });
    })
  6. abernier revised this gist Nov 16, 2011. 1 changed file with 22 additions and 0 deletions.
    22 changes: 22 additions & 0 deletions acegist.user.js
    Original file line number Diff line number Diff line change
    @@ -8,6 +8,11 @@
    // ==/UserScript==

    (function (d, cb) {

    //
    // A script loader over here!
    //

    if (typeof $LAB === 'undefined') {
    var s;

    @@ -26,6 +31,11 @@
    cb()
    }
    }(document, function () {

    //
    // Syntax highlighting modes
    //

    var modes = {
    'js': {
    url: 'https://raw.github.com/ajaxorg/ace/v0.2.0/build/src/mode-javascript.js',
    @@ -58,6 +68,10 @@

    $el = $(el);

    //
    // Principle: inject an DOM element (sized and positioned) and hide the textarea
    //

    $container = $('<div/>').css({
    position: 'relative',
    width: $el.width(),
    @@ -66,15 +80,23 @@

    $el.hide();

    //
    // ACE magic
    //

    editor = ace.edit($container[0]);

    editor.setTheme('ace/theme/twilight');

    // Keep hidden textarea in sync

    editor.getSession().setValue($el.val());
    editor.getSession().on('change', function () {
    $el.val(editor.getSession().getValue());
    });

    // Syntax highlighting depending on filename.<ext>

    ext = $el.closest('.file').find('.name input').val().split('.').slice(-1)[0];
    modes[ext] && $LAB.script(modes[ext].url).wait(function () {
    var Mode = require(modes[ext].module).Mode
  7. abernier revised this gist Nov 16, 2011. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions acegist.user.js
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,7 @@
    // ==UserScript==
    // @id acegist
    // @name ACEgist
    // @author Antoine BERNIER (abernier)
    // @version 0.1.1
    // @description ACE editor in your gists
    // @match https://gist.github.com/gists/*/edit
  8. abernier revised this gist Nov 16, 2011. 1 changed file with 9 additions and 1 deletion.
    10 changes: 9 additions & 1 deletion acegist.user.js
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    // ==UserScript==
    // @id acegist
    // @name ACEgist
    // @version 0.1.0
    // @version 0.1.1
    // @description ACE editor in your gists
    // @match https://gist.github.com/gists/*/edit
    // ==/UserScript==
    @@ -33,6 +33,14 @@
    'coffee': {
    url: 'https://raw.github.com/ajaxorg/ace/v0.2.0/build/src/mode-coffee.js',
    module: 'ace/mode/coffee'
    },
    'html': {
    url: 'https://raw.github.com/ajaxorg/ace/v0.2.0/build/src/mode-html.js',
    module: 'ace/mode/html'
    },
    'css': {
    url: 'https://raw.github.com/ajaxorg/ace/v0.2.0/build/src/mode-css.js',
    module: 'ace/mode/css'
    }
    };

  9. abernier revised this gist Nov 16, 2011. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions acegist.user.js
    Original file line number Diff line number Diff line change
    @@ -44,6 +44,7 @@
    $('textarea').each(function (i, el) {
    var $el,
    $container,
    editor,
    ext;

    $el = $(el);
  10. abernier revised this gist Nov 16, 2011. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion acegist.user.js
    Original file line number Diff line number Diff line change
    @@ -43,7 +43,7 @@
    .wait(function () {
    $('textarea').each(function (i, el) {
    var $el,
    container,
    $container,
    ext;

    $el = $(el);
  11. abernier revised this gist Nov 16, 2011. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions acegist.user.js
    Original file line number Diff line number Diff line change
    @@ -29,6 +29,10 @@
    'js': {
    url: 'https://raw.github.com/ajaxorg/ace/v0.2.0/build/src/mode-javascript.js',
    module: 'ace/mode/javascript'
    },
    'coffee': {
    url: 'https://raw.github.com/ajaxorg/ace/v0.2.0/build/src/mode-coffee.js',
    module: 'ace/mode/coffee'
    }
    };

  12. abernier revised this gist Nov 16, 2011. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion acegist.user.js
    Original file line number Diff line number Diff line change
    @@ -27,7 +27,7 @@
    }(document, function () {
    var modes = {
    'js': {
    url: 'https://raw.github.com/ajaxorg/ace/master/build/src/mode-javascript.js',
    url: 'https://raw.github.com/ajaxorg/ace/v0.2.0/build/src/mode-javascript.js',
    module: 'ace/mode/javascript'
    }
    };
  13. abernier revised this gist Nov 16, 2011. 1 changed file with 15 additions and 1 deletion.
    16 changes: 15 additions & 1 deletion acegist.user.js
    Original file line number Diff line number Diff line change
    @@ -25,14 +25,22 @@
    cb()
    }
    }(document, function () {
    var modes = {
    'js': {
    url: 'https://raw.github.com/ajaxorg/ace/master/build/src/mode-javascript.js',
    module: 'ace/mode/javascript'
    }
    };

    $LAB
    .script('http://code.jquery.com/jquery-latest.min.js')
    .script('https://raw.github.com/ajaxorg/ace/v0.2.0/build/src/ace.js')
    .script('https://raw.github.com/ajaxorg/ace/v0.2.0/build/src/theme-twilight.js')
    .wait(function () {
    $('textarea').each(function (i, el) {
    var $el,
    container;
    container,
    ext;

    $el = $(el);

    @@ -52,6 +60,12 @@
    editor.getSession().on('change', function () {
    $el.val(editor.getSession().getValue());
    });

    ext = $el.closest('.file').find('.name input').val().split('.').slice(-1)[0];
    modes[ext] && $LAB.script(modes[ext].url).wait(function () {
    var Mode = require(modes[ext].module).Mode
    editor.getSession().setMode(new Mode())
    });
    });
    })
    ;
  14. abernier revised this gist Nov 16, 2011. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions acegist.user.js
    Original file line number Diff line number Diff line change
    @@ -28,6 +28,7 @@
    $LAB
    .script('http://code.jquery.com/jquery-latest.min.js')
    .script('https://raw.github.com/ajaxorg/ace/v0.2.0/build/src/ace.js')
    .script('https://raw.github.com/ajaxorg/ace/v0.2.0/build/src/theme-twilight.js')
    .wait(function () {
    $('textarea').each(function (i, el) {
    var $el,
    @@ -44,6 +45,8 @@
    $el.hide();

    editor = ace.edit($container[0]);

    editor.setTheme('ace/theme/twilight');

    editor.getSession().setValue($el.val());
    editor.getSession().on('change', function () {
  15. abernier revised this gist Nov 16, 2011. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions acegist.user.js
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,7 @@
    // ==UserScript==
    // @id acegist
    // @name ACEgist
    // @version 0.1.0
    // @description ACE editor in your gists
    // @match https://gist.github.com/gists/*/edit
    // ==/UserScript==
  16. abernier revised this gist Nov 16, 2011. No changes.
  17. abernier revised this gist Nov 16, 2011. 1 changed file with 8 additions and 3 deletions.
    11 changes: 8 additions & 3 deletions acegist.user.js
    Original file line number Diff line number Diff line change
    @@ -10,11 +10,16 @@
    var s;

    s = d.createElement('script');
    s.async = true;
    s.src = 'https://raw.github.com/getify/LABjs/master/LAB.min.js';
    s.onload = cb
    s.onload = function () {
    var s;

    d.getElementsByTagName('head')[0].appendChild(s);
    s = d.createElement('script');
    s.textContent = '(' + cb.toString() + ')();';

    d.body.appendChild(s);
    }
    d.body.appendChild(s);
    } else {
    cb()
    }
  18. abernier revised this gist Nov 16, 2011. 1 changed file with 37 additions and 9 deletions.
    46 changes: 37 additions & 9 deletions acegist.user.js
    Original file line number Diff line number Diff line change
    @@ -5,17 +5,45 @@
    // @match https://gist.github.com/gists/*/edit
    // ==/UserScript==

    (function (d) {
    if (typeof ace === 'undefined') {
    (function (d, cb) {
    if (typeof $LAB === 'undefined') {
    var s;

    s = d.createElement('script');
    s.async = true;
    s.src = 'https://raw.github.com/ajaxorg/ace/master/build/src/ace.js';
    s.load = function () {
    console.log('kikou', ace, document.querySelectorAll('textarea'));
    }
    s = d.createElement('script');
    s.async = true;
    s.src = 'https://raw.github.com/getify/LABjs/master/LAB.min.js';
    s.onload = cb

    d.getElementsByTagName('head')[0].appendChild(s);
    } else {
    cb()
    }
    }(document));
    }(document, function () {
    $LAB
    .script('http://code.jquery.com/jquery-latest.min.js')
    .script('https://raw.github.com/ajaxorg/ace/v0.2.0/build/src/ace.js')
    .wait(function () {
    $('textarea').each(function (i, el) {
    var $el,
    container;

    $el = $(el);

    $container = $('<div/>').css({
    position: 'relative',
    width: $el.width(),
    height: $el.height()
    }).insertAfter(el);

    $el.hide();

    editor = ace.edit($container[0]);

    editor.getSession().setValue($el.val());
    editor.getSession().on('change', function () {
    $el.val(editor.getSession().getValue());
    });
    });
    })
    ;
    }));
  19. abernier revised this gist Nov 15, 2011. 1 changed file with 10 additions and 9 deletions.
    19 changes: 10 additions & 9 deletions acegist.user.js
    Original file line number Diff line number Diff line change
    @@ -6,15 +6,16 @@
    // ==/UserScript==

    (function (d) {
    var s;
    if (typeof ace === 'undefined') {
    var s;

    s = d.createElement('script');
    s.async = true;
    s.src = 'https://raw.github.com/ajaxorg/ace/master/build/src/ace.js';
    s.load = function () {
    console.log('kikou', ace, document.querySelectorAll('textarea'));

    }
    s = d.createElement('script');
    s.async = true;
    s.src = 'https://raw.github.com/ajaxorg/ace/master/build/src/ace.js';
    s.load = function () {
    console.log('kikou', ace, document.querySelectorAll('textarea'));
    }

    d.getElementsByTagName('head')[0].appendChild(s);
    d.getElementsByTagName('head')[0].appendChild(s);
    }
    }(document));
  20. abernier revised this gist Nov 15, 2011. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions acegist.user.js
    Original file line number Diff line number Diff line change
    @@ -10,9 +10,9 @@

    s = d.createElement('script');
    s.async = true;
    s.src = 'https://github.com/ajaxorg/ace/blob/master/build/src/ace.js';
    s.src = 'https://raw.github.com/ajaxorg/ace/master/build/src/ace.js';
    s.load = function () {
    console.log(ace, document.querySelectorAll('textarea'));
    console.log('kikou', ace, document.querySelectorAll('textarea'));

    }

  21. abernier renamed this gist Nov 15, 2011. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  22. abernier created this gist Nov 15, 2011.
    20 changes: 20 additions & 0 deletions acegist.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    // ==UserScript==
    // @id acegist
    // @name ACEgist
    // @description ACE editor in your gists
    // @match https://gist.github.com/gists/*/edit
    // ==/UserScript==

    (function (d) {
    var s;

    s = d.createElement('script');
    s.async = true;
    s.src = 'https://github.com/ajaxorg/ace/blob/master/build/src/ace.js';
    s.load = function () {
    console.log(ace, document.querySelectorAll('textarea'));

    }

    d.getElementsByTagName('head')[0].appendChild(s);
    }(document));