Created
November 15, 2011 22:51
Revisions
-
abernier revised this gist
Jul 18, 2012 . 2 changed files with 82 additions and 83 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -10,29 +10,99 @@ (function (d, cb) { // // A script loader over here! // if (typeof $LAB === 'undefined') { var s; 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() + ')();'; d.body.appendChild(s); } d.body.appendChild(s); } else { cb() } }(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()); }); }); }) ; })); This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,71 +0,0 @@ -
abernier revised this gist
Jul 18, 2012 . 1 changed file with 42 additions and 40 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal 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]); 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()); }); }); }); }); -
abernier revised this gist
Jul 18, 2012 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ 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/ } }; $(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()); }); });}); }); -
abernier revised this gist
Jul 18, 2012 . 2 changed files with 82 additions and 83 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -2,107 +2,37 @@ // @id acegist // @name ACEgist // @author Antoine BERNIER (abernier) // @version 0.1.2 // @description ACE editor in your gists // @match https://gist.github.com/gists/*/edit // ==/UserScript== (function (d, cb) { // // RequireJS over here! // if (typeof window.requirejs === 'undefined') { var s; 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() + ')(requirejs);'; d.body.appendChild(s); } d.body.appendChild(s); } else { cb(requirejs) } }(document, function (require) { require.config({ baseUrl: "https://raw.github.com/gist/1368637" }); require(['index']); })); This file contains hidden or 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 charactersOriginal 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()); }); }); }); -
abernier revised this gist
Nov 16, 2011 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal 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()); }); }); }) -
abernier revised this gist
Nov 16, 2011 . 1 changed file with 22 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal 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 -
abernier revised this gist
Nov 16, 2011 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal 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 -
abernier revised this gist
Nov 16, 2011 . 1 changed file with 9 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ // ==UserScript== // @id acegist // @name ACEgist // @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' } }; -
abernier revised this gist
Nov 16, 2011 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal 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); -
abernier revised this gist
Nov 16, 2011 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -43,7 +43,7 @@ .wait(function () { $('textarea').each(function (i, el) { var $el, $container, ext; $el = $(el); -
abernier revised this gist
Nov 16, 2011 . 1 changed file with 4 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal 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' } }; -
abernier revised this gist
Nov 16, 2011 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal 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/v0.2.0/build/src/mode-javascript.js', module: 'ace/mode/javascript' } }; -
abernier revised this gist
Nov 16, 2011 . 1 changed file with 15 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal 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, 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()) }); }); }) ; -
abernier revised this gist
Nov 16, 2011 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal 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 () { -
abernier revised this gist
Nov 16, 2011 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal 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== -
abernier revised this gist
Nov 16, 2011 . No changes.There are no files selected for viewing
-
abernier revised this gist
Nov 16, 2011 . 1 changed file with 8 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -10,11 +10,16 @@ var s; 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() + ')();'; d.body.appendChild(s); } d.body.appendChild(s); } else { cb() } -
abernier revised this gist
Nov 16, 2011 . 1 changed file with 37 additions and 9 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -5,17 +5,45 @@ // @match https://gist.github.com/gists/*/edit // ==/UserScript== (function (d, cb) { if (typeof $LAB === 'undefined') { var s; 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, 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()); }); }); }) ; })); -
abernier revised this gist
Nov 15, 2011 . 1 changed file with 10 additions and 9 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -6,15 +6,16 @@ // ==/UserScript== (function (d) { 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')); } d.getElementsByTagName('head')[0].appendChild(s); } }(document)); -
abernier revised this gist
Nov 15, 2011 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -10,9 +10,9 @@ 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')); } -
abernier renamed this gist
Nov 15, 2011 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
abernier created this gist
Nov 15, 2011 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal 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));