OpusVL-AppKit
view release on metacpan or search on metacpan
lib/auto/OpusVL/AppKit/root/static/js/appkit.js view on Meta::CPAN
}
};
$(function() {
$(window).click(function(){appKit.windowClick();
if (!appList.hover) {
appList.hide();
}
if (!appKitSearch.hover) {
appKitSearch.hide();
}
//$(".control-edit-small > ul").each(function(){
//if (!$(this).hasClass('nohide')) {
// $(this).hide();
//};
//});
//$(".control-edit-small > ul").removeClass('nohide');
});
$(".control-edit-small").each(function() {
$('<a href="#"></a>').click(
function() {
$(".control-edit-small > ul").each(function(){$(this).hide();});
var x = $(this).prev();
if (x.css('display') == 'none') {
x.show();
//x.addClass('nohide');
} else {
x.hide();
}
return false;
}
).appendTo($(this));
});
});
//--Setup form focus classes----------------------------------------------------
$(function(){
$("input[type!='file']").focus(function() {
$(this).parent().addClass("has_focus")
});
$("input[type!='file']").blur(function() {
$(this).parent().removeClass("has_focus")
});
$("textarea").focus(function() {
$(this).parent().addClass("has_focus")
});
$("textarea").blur(function() {
$(this).parent().removeClass("has_focus")
});
});
//--Form change indicator-------------------------------------------------------
// Needs to ignore search box, i.e. only run on forms within the content block
// part of the template - DONE
// Look at how it interacts with jQuery UI popups - HAVE NOT SEEN PROBLEM
// Stop it from triggering on the login page - DONE
// Only activate if the form method is "POST" (i.e. ignore GET forms for search
// queries etc) - DONE
// Allow form elements to be marked as not triggering the change indicator,
// e.g. elements which trigger AJAX calls and do not affect the main form - DONE
// Support dynamically generated forms
// Potential features to stop change indications on innapropriate forms:
// * Only attach to forms with two submit elements
// * Only attach to forms with a "cancel" submit button
// * Only attach to forms with a "save" submit button
var changes = false;
$(function() {
$('#application form[method="POST"]').not('.no_change_alert').not('[id="login_form"]').find(':input').not('.no_change_alert').change(function(event) {
changes = true;
$('.save_indicator').addClass('unsaved');
});
var form_submission_in_progress = false;
$('#application form[method="POST"]').not('.no_disable_submit').not('[id="login_form"]').find('[type="submit"]').click(function(event) {
if (form_submission_in_progress) {
return false;
} else {
form_submission_in_progress = true;
return true;
}
});
$('.form_indicator').dialog({
title: "Working... please wait",
show: "fade",
autoOpen: false,
modal: true,
closeOnEscape: false,
draggable: false,
beforeClose: function( event, ui ) {return false}
});
$('#application form[method="POST"]').not('.no_disable_submit').not('[id="login_form"]').submit(function(event) {
window.setTimeout(function(){$('.form_indicator').dialog("open")}, 2000);
});
});
// displays the ajax_loading class items on the page when ajax is in action
// it avoids any url with notification in it.
$(function() {
var notifications = /notification/;
$('.ajax_indicator').ajaxSend(function(e, j, s) {
if(!s.url.match(notifications)) {
$(this).addClass('ajax_loading');
}
}).ajaxComplete(function(e, j, s) {
if(!s.url.match(notifications)) {
$(this).removeClass('ajax_loading');
}
});
});
( run in 0.669 second using v1.01-cache-2.11-cpan-364913b4093 )