--- a/web/static/ldt/js/projectscontents.js Wed Mar 02 18:58:29 2011 +0100
+++ b/web/static/ldt/js/projectscontents.js Mon Mar 07 18:50:01 2011 +0100
@@ -1,7 +1,8 @@
+
$.fn.realVal = function() {
var obj = $(this[0]);
if(obj.val) {
- if(obj.val() == obj.attr('defaultText')) {
+ if(obj.val() === obj.attr('defaultText')) {
return '';
}
else {
@@ -66,9 +67,7 @@
'tip': true
}
});
-
-
-};
+}
function testAndClose(close_fn) {
@@ -76,11 +75,11 @@
// Here we ask LDT if the current work is modified and if the user want to save it.
var ldtSwf = $('#ldtInitSwf',$.nmTop().store.iframe.contents()).get(0);
// In the ldt_link_create case, the modal page can be the form, or the ldt swf. So we have to test.
- if (!force && ldtSwf && ldtSwf.name=="ldtInitSwf" && ldtSwf.isModified()=="true") {
+ if (!force && ldtSwf && ldtSwf.name==="ldtInitSwf" && ldtSwf.isModified()==="true") {
ldtSwf.askSave();
}
else {
- close_fn.apply(this);
+ close_fn.apply(this);
}
};
}
@@ -88,8 +87,8 @@
function searchCallback(target, container_selector, url, timeout) {
- timeout = typeof(timeout) != 'undefined' ? timeout : 0;
- var target = $(target);
+ timeout = typeof(timeout) !== 'undefined' ? timeout : 0;
+ target = $(target);
// remove all qtip
$(".qtip").remove();
@@ -125,11 +124,11 @@
},
300)
);
-};
+}
function init_events_contents(base_node, embed_url, content_filter_url) {
-
+
init_events_base(base_node, embed_url);
$('.content_link_create').each(function(i){
@@ -149,15 +148,15 @@
nm.store.iframe.width(770);
nm.store.iframe.height(500);
nm.store.iframe.load(function() {
- var form_status = $(this).contents().find("#content_form_status").val();
- if(form_status == 'saved' || form_status == 'deleted' ) {
- $.nmTop().close();
- }
- });
- }
+ var form_status = $(this).contents().find("#content_form_status").val();
+ if(form_status === 'saved' || form_status === 'deleted' ) {
+ $.nmTop().close();
+ }
+ });
+ }
}
});
-
+
$('.contenttitlelink').each(function(i){
$(this).attr("target","_blank");
});
@@ -176,13 +175,14 @@
nm.store.iframe.height(500);
nm.store.iframe.load(function() {
var form_status = $(this).contents().find("#content_form_status").val();
- if(form_status == 'saved' || form_status == 'deleted') {
+ if(form_status === 'saved' || form_status === 'deleted') {
$.nmTop().close();
}
});
}
}
});
+
}
function init_events_base_projects(base_node, embed_url, searchprojectfilterurl, publishprojecturl, unpublishprojecturl) {
@@ -213,13 +213,35 @@
searchCallback($('#searchprojectsinput'), "#projectslistcontainer", searchprojectfilterurl, 0);
}
},
+ resize: function(recalc) {
+ // We need to hack resize AND _unreposition to avoid reload in the modal when we resize the browser.
+ // This code is from the resize function in nmObj.resize
+ this.sizes.w = this.sizes.initW;
+ this.sizes.h = this.sizes.initH;
+ this.size();
+ // callAnim('resize') generates the nodal reload, and we don't want that.
+ // this._callAnim('resize', $.proxy(function() {
+ // this._reposition();
+ // }, this));
+ // This code is from the resize function in _animations.basic
+ this.elts.cont.css({
+ width: this.sizes.w,
+ height: this.sizes.h,
+ top: (this.getInternal().fullSize.viewH - this.sizes.h - this.sizes.hMargin)/2,
+ left: (this.getInternal().fullSize.viewW - this.sizes.w - this.sizes.wMargin)/2
+ });
+ },
+ _unreposition: function() {
+ // We need to hack resize AND _unreposition to avoid reload in the modal when we resize the browser.
+ }
});
+
$('.ldt_link',base_node).each(function(i, e) {
- nm = $(e).data('nmObj');
- $(e).data('nmObj', $.extend(true, nm, {
- close: testAndClose(nm.close)
- }));
+ nm = $(e).data('nmObj');
+ $(e).data('nmObj', $.extend(true, nm, {
+ close: testAndClose(nm.close)
+ }));
});
@@ -243,7 +265,7 @@
var iframe = nm.store.iframe;
iframe.load(function(){
var form_status = $(this).contents().find("#project_form_status").val();
- if(form_status == 'saved' || form_status == 'deleted' ) {
+ if(form_status === 'saved' || form_status === 'deleted' ) {
$.nmTop().close();
}
var swfobject = $(this).contents().find("#ldtInitSwf");
@@ -260,13 +282,13 @@
searchCallback($('#searchprojectsinput'), "#projectslistcontainer", searchprojectfilterurl, 0);
}
}
- });
- $('.ldt_link_create',base_node).each(function(i, e) {
- nm = $(e).data('nmObj');
- $(e).data('nmObj', $.extend(true, nm, {
- close: testAndClose(nm.close)
- }));
- });
+ });
+ $('.ldt_link_create',base_node).each(function(i, e) {
+ nm = $(e).data('nmObj');
+ $(e).data('nmObj', $.extend(true, nm, {
+ close: testAndClose(nm.close)
+ }));
+ });
$('.publishedproject', base_node).click(function(e) {
@@ -322,7 +344,7 @@
var iframe = nm.store.iframe;
iframe.load(function(){
var form_status = $(this).contents().find("#project_form_status").val();
- if(form_status == 'saved' || form_status == 'deleted') {
+ if(form_status === 'saved' || form_status === 'deleted') {
$.nmTop().close();
}
});
@@ -339,17 +361,14 @@
}
function init_events_all(base_node, embed_url, searchcontentfilterurl, searchprojectfilterurl, publishprojecturl, unpublishprojecturl) {
-
init_events_contents(base_node, embed_url, searchcontentfilterurl);
- init_events_base_projects(base_node, embed_url, searchprojectfilterurl, publishprojecturl, unpublishprojecturl);
+ init_events_base_projects(base_node, embed_url, searchprojectfilterurl, publishprojecturl, unpublishprojecturl);
}
-
-
function searchFieldInit(input_list_init) {
$(".searchfieldinputbase").keydown(function (e) {
- if(e.which == 27) {
+ if(e.which === 27) {
$(e.target).blur();
$(e.target).next(".searchajaxloader").hide();
}
@@ -357,13 +376,13 @@
$('.searchfieldinput').each(function(i) {
var sbox = $(this);
- if(sbox.val() != '') {
+ if(sbox.val() !== '') {
sbox.attr('defaultText', sbox.val());
}
sbox.focus(function() {
box = $(this);
- if(box.val() == box.attr('defaultText')) {
+ if(box.val() === box.attr('defaultText')) {
box.val('');
box.toggleClass("searchfieldinput");
}
@@ -371,7 +390,7 @@
sbox.blur(function() {
var box = $(this);
- if(box.val() == '' && box.attr('defaultText')) {
+ if(box.val() === '' && box.attr('defaultText')) {
box.val(box.attr('defaultText'));
box.toggleClass("searchfieldinput");
}
@@ -396,5 +415,5 @@
$('.searchclear').each(function(i) {
$(this).hide();
});
-
+
}