r9475 - apps/gobi/trunk/code/Page/skins
[email protected] Tue, 23 Dec 2008 12:14:29 +0100
Newsgroups
gmane.comp.java.helma.cvs
Message-ID
<[email protected] >
Author: hannes
Date: 2008-12-23 12:14:29 +0100 (Tue, 23 Dec 2008)
New Revision: 9475
Modified:
apps/gobi/trunk/code/Page/skins/javascript.skin
Log:
Put non-legacy code at the beginning of the file.
Details at http://dev.helma.org/trac/helma/changeset/9475
Modified: apps/gobi/trunk/code/Page/skins/javascript.skin
===================================================================
--- apps/gobi/trunk/code/Page/skins/javascript.skin 2008-12-23 10:26:11 UTC (rev 9474)
+++ apps/gobi/trunk/code/Page/skins/javascript.skin 2008-12-23 11:14:29 UTC (rev 9475)
@@ -1,23 +1,115 @@
- var baseUri = "<% this.href %>";
+ var baseUri = "<% this.href %>";
- // currently showing menu id
- var currentMenu;
+ // currently showing menu id
+ var currentMenu;
- document.onmousedown = function(event) {
- if (currentMenu) {
- event = event || window.event;
- var elem = event.target || event.srcElement;
- while (elem) {
- if (elem.id == currentMenu) return true;
- elem = elem.parentNode;
- }
- showElement(currentMenu, false);
- currentMenu = null;
- }
- return true;
- }
+ document.onmousedown = function(event) {
+ if (currentMenu) {
+ event = event || window.event;
+ var elem = event.target || event.srcElement;
+ while (elem) {
+ if (elem.id == currentMenu) return true;
+ elem = elem.parentNode;
+ }
+ showElement(currentMenu, false);
+ currentMenu = null;
+ }
+ return true;
+ }
+ function commentShowForm() {
+ $('.commentToggle').toggle('normal', function() {
+ $('html,body').animate({
+ scrollTop: $('#commentForm').offset().top
+ });
+ $('#commentInput').focus();
+ });
+ return false;
+ }
+
+ function commentCancel() {
+ // $('#commentInput').val('');
+ $('.commentToggle').slideToggle('normal', function() {
+ $('.previewToggle').hide();
+ $('#pagePreview').html('');
+ });
+ return false;
+ }
+
+ function deleteCommentShow(link) {
+ var scratchpad = $(link).nextAll('.commentScratchpad:first');
+ scratchpad.next().show();
+ scratchpad.html('').hide().load(link.href, { ajax: true }, function() {
+ scratchpad.show();
+ });
+ return false;
+ }
+
+ function deleteCommentCancel(link) {
+ var parent = $(link).parents('.commentScratchpad');
+ if (parent.length > 0) {
+ parent.hide();
+ $(this).html('');
+ return false;
+ }
+ return true;
+ }
+
+ function editCommentShow(link) {
+ var scratchpad = $(link).nextAll('.commentScratchpad:first');
+ scratchpad.load(link.href, { ajaxedit: true }, function() {
+ $('html,body').animate({
+ scrollTop: $(link).offset().top
+ });
+ scratchpad.show().find('textarea').focus();
+ scratchpad.next().hide();
+ });
+ return false;
+ }
+
+ function editCommentCancel(link) {
+ var parent = $(link).parents('.commentScratchpad');
+ if (parent.length > 0) {
+ parent.hide().next().show();
+ return false;
+ }
+ return true;
+ }
+
+
+ function pagePreview(form) {
+ var input = $(form).find('[name=body]');
+ var action = form.action || location.href;
+ var preview = $(form).find('.pagePreview:first')
+ preview.load(action, {
+ ajaxpreview: true,
+ name: $(form).find('[name=name]').val(),
+ body: input.val()
+ }, function() {
+ $('.previewToggle').show('normal', function() {
+ $('html,body').animate({
+ scrollTop: preview.offset().top
+ });
+ });
+ });
+ input.focus();
+ return false;
+ }
+
+ function continueEditing(form) {
+ // $('.previewToggle').hide('normal');
+ var scrollTarget = $(form || 'html,body');
+ $('html,body').animate({
+ scrollTop: scrollTarget.offset().top
+ });
+ scrollTarget.find('[name=body]').focus();
+ return false;
+ }
+
+
+ //////////////////////// legacy stuff
+
function openPopup(url, name, width, height) {
if (isNaN(width)) width = 300;
if (isNaN(height)) height = 350;
@@ -147,95 +239,6 @@
return;
}
- function commentShowForm() {
- $('.commentToggle').toggle('normal', function() {
- $('html,body').animate({
- scrollTop: $('#commentForm').offset().top
- });
- $('#commentInput').focus();
- });
- return false;
- }
-
- function commentCancel() {
- // $('#commentInput').val('');
- $('.commentToggle').slideToggle('normal', function() {
- $('.previewToggle').hide();
- $('#pagePreview').html('');
- });
- return false;
- }
-
- function deleteCommentShow(link) {
- var scratchpad = $(link).nextAll('.commentScratchpad:first');
- scratchpad.next().show();
- scratchpad.html('').hide().load(link.href, { ajax: true }, function() {
- scratchpad.show();
- });
- return false;
- }
-
- function deleteCommentCancel(link) {
- var parent = $(link).parents('.commentScratchpad');
- if (parent.length > 0) {
- parent.hide();
- $(this).html('');
- return false;
- }
- return true;
- }
-
- function editCommentShow(link) {
- var scratchpad = $(link).nextAll('.commentScratchpad:first');
- scratchpad.load(link.href, { ajaxedit: true }, function() {
- $('html,body').animate({
- scrollTop: $(link).offset().top
- });
- scratchpad.show().find('textarea').focus();
- scratchpad.next().hide();
- });
- return false;
- }
-
- function editCommentCancel(link) {
- var parent = $(link).parents('.commentScratchpad');
- if (parent.length > 0) {
- parent.hide().next().show();
- return false;
- }
- return true;
- }
-
-
- function pagePreview(form) {
- var input = $(form).find('[name=body]');
- var action = form.action || location.href;
- var preview = $(form).find('.pagePreview:first')
- preview.load(action, {
- ajaxpreview: true,
- name: $(form).find('[name=name]').val(),
- body: input.val()
- }, function() {
- $('.previewToggle').show('normal', function() {
- $('html,body').animate({
- scrollTop: preview.offset().top
- });
- });
- });
- input.focus();
- return false;
- }
-
- function continueEditing(form) {
- // $('.previewToggle').hide('normal');
- var scrollTarget = $(form || 'html,body');
- $('html,body').animate({
- scrollTop: scrollTarget.offset().top
- });
- scrollTarget.find('[name=body]').focus();
- return false;
- }
-
function buildList(name, link) {
var safeName = name.replace(/\s/g, "_");
var value = getElement(name+"_links").value;