Deleted:
/trunk/resources/gadgets/private-gadget-editor/codepress.js
Modified:
/trunk/resources/gadgets/private-gadget-editor/code.js
/trunk/resources/gadgets/private-gadget-editor/spec.xml
=======================================
--- /trunk/resources/gadgets/private-gadget-editor/codepress.js Tue Mar 10
17:20:57 2009
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
- * CodePress - Real Time Syntax Highlighting Editor written in JavaScript
- http://codepress.org/
- *
- * Copyright (C) 2006 Fernando M.A.d.S. <fer...@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify it
under the terms of the
- * GNU Lesser General Public License as published by the Free Software
Foundation.
- *
- * Read the full licence:
http://www.opensource.org/licenses/lgpl-license.php
- */
-
-// MOD: All local modifications marked with this comment prefix.
-
-// Copied from http://www.google.com/ig/modules/codepress/codepress.js.
-// Further modifications to decouple the domain of the script and the
-// editor iframe.
-
-CodePress = function(obj) {
- var self = document.getElementById('codepress-iframe');
- self.textarea = obj;
- self.textarea.disabled = true;
- self.textarea.style.overflow = 'hidden';
-
- // MOD(daniellee): Set height to match existing textarea element
- self.style.height = self.textarea.offsetHeight + 'px';
-
- // MOD(wwen): change width to 100%
- //self.style.width = self.textarea.clientWidth+'px';
- self.style.width = "100%";
-
- self.textarea.style.overflow = 'auto';
- // MOD(daniellee): Remove default border. Stylize editor in gge.xml
- //self.style.border = '1px solid gray';
- self.frameBorder = 0; // remove IE internal iframe border
- self.style.visibility = 'hidden';
- self.style.position = 'absolute';
- self.options = self.textarea.className;
-
- self.initialize = function() {
- self.editor = self.contentWindow.CodePress;
- self.editor.body =
self.contentWindow.document.getElementsByTagName('body')[0];
- self.editor.setCode(self.textarea.value);
- self.setOptions();
- self.editor.syntaxHighlight('init');
- self.textarea.style.display = 'none';
- self.style.position = 'static';
- self.style.visibility = 'visible';
- self.style.display = 'inline';
- // MOD(burdon): Call Wrapper.
- if (CodePress.postInitialize) {
- CodePress.postInitialize();
- }
- // MOD(burdon): Spell check off.
- if (self.editor.body.spellcheck) {
- self.editor.body.spellcheck = false;
- }
- }
-
- self.edit = function(id,language) {
- if(id) self.textarea.value = document.getElementById(id).value;
- if(!self.textarea.disabled) return;
- self.language = language ? language :
self.options.replace(/ ?codepress ?| ?readonly-on ?| ?autocomplete-off ?| ?linenumbers-off ?/g,'');
- // if(!CodePress.languages[self.language]) self.language = 'generic';
-
- var contentDoc = self.document || self.contentDocument ||
self.contentWindow.documnt;
- contentDoc.open();
- contentDoc.write(codePressEmptyIframeContent);
- contentDoc.close();
-
- if(self.attachEvent) self.attachEvent('onload',self.initialize);
- else self.addEventListener('load',self.initialize,false);
- }
-
- self.setOptions = function() {
- if(self.options.match('autocomplete-off')) self.toggleAutoComplete();
- if(self.options.match('readonly-on')) self.toggleReadOnly();
- if(self.options.match('linenumbers-off')) self.toggleLineNumbers();
- }
-
- self.getCode = function() {
- return self.textarea.disabled ? self.editor.getCode() :
self.textarea.value;
- }
-
- self.setCode = function(code) {
- self.textarea.disabled ? self.editor.setCode(code) :
self.textarea.value = code;
- }
-
- self.toggleAutoComplete = function() {
- self.editor.autocomplete = (self.editor.autocomplete) ? false : true;
- }
-
- self.toggleReadOnly = function() {
- self.textarea.readOnly = (self.textarea.readOnly) ? false : true;
- if(self.style.display != 'none') // prevent exception on FF + iframe
with display:none
- self.editor.readOnly(self.textarea.readOnly ? true : false);
- }
-
- self.toggleLineNumbers = function() {
- var cn = self.editor.body.className;
- self.editor.body.className = (cn==''||
cn=='show-line-numbers') ? 'hide-line-numbers' : 'show-line-numbers';
- }
-
- self.toggleEditor = function() {
- if(self.textarea.disabled) {
- self.textarea.value = self.getCode();
- self.textarea.disabled = false;
- self.style.display = 'none';
- self.textarea.style.display = 'inline';
- }
- else {
- self.textarea.disabled = true;
- self.setCode(self.textarea.value);
- self.editor.syntaxHighlight('init');
- self.style.display = 'inline';
- self.textarea.style.display = 'none';
- }
- }
-
- self.edit();
- return self;
-}
-
-CodePress.languages = {
- css : 'CSS',
- generic : 'Generic',
- html : 'HTML',
- java : 'Java',
- javascript : 'JavaScript',
- perl : 'Perl',
- ruby : 'Ruby',
- php : 'PHP',
- text : 'Text',
- sql : 'SQL',
- gadget : 'Gadget'
-}
-
-// MOD(burdon):
-CodePress.getEngine = function() {
- var engine = 'older';
- var ua = navigator.userAgent;
- if(ua.match('MSIE')) engine = 'msie';
- else if(ua.match('KHTML')) engine = 'khtml';
- else if(ua.match('Opera')) engine = 'opera';
- else if(ua.match('Gecko')) engine = 'gecko';
- return engine;
-}
-
-CodePress.run = function() {
- CodePress.engine = CodePress.getEngine();
- var s = document.getElementsByTagName('script');
-// for(var i=0,n=s.length;i<n;i++) {
-// if(s[i].src.match(/codepress_wrapper\.js.*/)) {
-// CodePress.path = s[i].src.replace(/codepress_wrapper\.js.*/,'');
-// }
-// }
- var t = document.getElementsByTagName('textarea');
- for(var i=0,n=t.length;i<n;i++) {
- if(t[i].className.match('codepress')) {
- var id = t[i].id;
- t[i].id = id+'_cp';
- window[id] = new CodePress(t[i]);
- t[i].parentNode.insertBefore(window[id], t[i]);
- }
- }
-}
-
-// MOD(burdon): Add our language.
-CodePress.languages["gm"] = 'GM';
-
-/*
-// MOD(burdon): Now triggered by CodePressEditor:init
-if(window.attachEvent) window.attachEvent('onload',CodePress.run);
-else window.addEventListener('DOMContentLoaded',CodePress.run,false);
-*/
-
-var language = "gm";
-var engine = "older";
-var ua = navigator.userAgent;
-var ts = (new Date).getTime(); // timestamp to avoid cache
-var lh = location.href;
-
-if(ua.match("MSIE")) engine = "msie";
-else if(ua.match("KHTML")) engine = "khtml";
-else if(ua.match("Opera")) engine = "opera";
-else if(ua.match("Gecko")) engine = "gecko";
-
-if(lh.match("language=")) language =
lh.replace(/.*language=(.*?)(&.*)?$/,"$1");
-
-// XSS fix (wwen)
-// these are the only languages that GGE supports
-if (!language.match(/^(css|gadget|javascript)$/)) {
- language = "gadget";
-}
-
-CodePress.path = 'http://www.google.com/ig/modules/codepress/';
-var codePressEmptyIframeContent = '<html>\n' +
- '<head>\n' +
- ' <title>CodePress - Real Time Syntax Highlighting Editor written in
JavaScript</title>\n' +
- ' <meta name="description" content="CodePress - source code editor
window" />\n' +
- '\n' +
- ' <link type="text/css" href="' + CodePress.path
+ 'codepress.css?ts='+ts+'" rel="stylesheet" />\n' +
- ' <link type="text/css" href="' + CodePress.path
+ 'languages/'+language+'.css?ts='+ts+'" rel="stylesheet"
id="cp-lang-style" />\n' +
- ' <script type="text/javascript" src="' + CodePress.path
+ 'engines/'+engine+'.js?ts='+ts+'"></script>\n' +
- ' <script type="text/javascript" src="' + CodePress.path
+ 'languages/'+language+'.js?ts='+ts+'"></script>\n' +
- '\n' +
- '</head>\n' +
- '<body></body>\n' +
- '</html>';
=======================================
--- /trunk/resources/gadgets/private-gadget-editor/code.js Thu Sep 3
13:49:46 2009
+++ /trunk/resources/gadgets/private-gadget-editor/code.js Sat Oct 16
20:15:53 2010
@@ -10,6 +10,15 @@
var SPINNER = '<img
src="http://google-feedserver.googlecode.com/svn/trunk/resources/gadgets/private-gadget-editor/spinner.gif">';
var DEFAULT_SPINNER_ID = 'spinner';
+var editor = {
+ getCode: function() {
+ return document.getElementById('editor').value;
+ },
+ setCode: function(text) {
+ document.getElementById('editor').value = text;
+ }
+};
+
function $(id) {
return document.getElementById(id);
};
@@ -91,7 +100,6 @@
setNameOfGadgetBeingEdited(name);
entryOfGadgetBeingEdited = response.entry;
editor.setCode(response.entry.content.entity.specContent);
- editor.editor.syntaxHighlight('init');
}, function(response) {
stopSpinner();
showMessage('Error: failed to open gadget spec "' + name + '"');
@@ -122,7 +130,6 @@
function newGadget() {
setNameOfGadgetBeingEdited('');
editor.setCode(getGadgetSpecTemplate());
- editor.editor.syntaxHighlight('init');
showPrivateGadgetNames();
entryOfGadgetBeingEdited = {xmlns: 'http://www.w3.org/2005/Atom',
content: {
type: 'application/xml', entity: {name: '', specContent: ''}}};
@@ -177,7 +184,6 @@
entryOfGadgetBeingEdited = {xmlns: 'http://www.w3.org/2005/Atom',
content: {
type: 'application/xml', entity: {name: '', specContent:
response.text}}};
editor.setCode(response.text);
- editor.editor.syntaxHighlight('init');
}
}, params);
}
@@ -193,24 +199,6 @@
miniMessage.createDismissibleMessage(message);
};
-//// google.load('gdata', '1.x', {packages: ['core']});
-// google.load('gdata', '1.x', {packages:
['core'], 'other_params': 'debug=1'});
-// google.setOnLoadCallback(initEditor);
-
-function initCodePress() {
- editor.style.height = '400px';
- CodePressWrapper.init();
-
- if (location.href.indexOf('codePressReloaded') < 0) {
- setTimeout(function() {
- if (!$('codepress-iframe').editor) {
- location.href += '&codePressReloaded';
- location.reload();
- }
- }, 500);
- }
-};
-
function detectDomainName() {
var params = location.href.split('&');
for (var i = 0; i < params.length; i++) {
@@ -239,7 +227,6 @@
};
function init() {
- initCodePress();
initGadget();
initEditor();
};
=======================================
--- /trunk/resources/gadgets/private-gadget-editor/spec.xml Fri Oct 16
12:27:09 2009
+++ /trunk/resources/gadgets/private-gadget-editor/spec.xml Sat Oct 16
20:15:53 2010
@@ -38,22 +38,6 @@
}
</style>
-<script type="text/javascript">
-function addScript(src) {
- var script = document.createElement('script');
- script.src = src;
- document.body.appendChild(script);
-};
-
-if (location.host.indexOf('gmodules.com') > 0) {
- addScript('/ig/modules/codepress/codepress.js?ts=092908');
- addScript('/ig/modules/codepress/codepress_wrapper.js?ts=092908');
-} else {
-
addScript('http://google-feedserver.googlecode.com/svn/trunk/resources/gadgets/private-gadget-editor/codepress.js');
-
addScript('http://www.google.com/ig/modules/codepress/codepress_wrapper.js?ts=092908');
-}
-</script>
-
<!--
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
-->
@@ -75,12 +59,7 @@
</div>
</div>
-<p style="color:red">Because of Firefox regressions, this editor is broken
for both 3.5 and 3.0 and will be deprecated soon.
-Please find <a
href="http://www.google.com/support/forum/p/apps-apis/thread?tid=7f3eb4c84bad2a97"
target="help">instructions</a>
-of how to use the command line tool FSCT to manage private gadgets for
your domain.</p>
-
-<textarea id="editor" class="codepress gadget"></textarea>
-<iframe id="codepress-iframe" style="display:none"></iframe>
+<textarea id="editor"></textarea>
<textarea id="gadget-spec-template" style="display:none">
<?xml version="1.0" encoding="UTF-8"?>