Skip to content

Commit f0430bb

Browse files
committed
Complete review for creating DOM element.
Fix error with embedly and iframe filters
1 parent 3cf30c2 commit f0430bb

7 files changed

+27
-13
lines changed

js/jquery.nyroModal.filters.data.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@ jQuery(function($, undefined) {
1313
data: {
1414
is: function(nm) {
1515
var ret = nm.data ? true : false;
16-
if (ret) {
16+
if (ret)
1717
nm._delFilter('dom');
18-
}
1918
return ret;
2019
},
2120
init: function(nm) {

js/jquery.nyroModal.filters.embedly.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jQuery(function($, undefined) {
4747
dataType: 'jsonp',
4848
data: data,
4949
success: function(data) {
50-
if (data.type != 'error') {
50+
if (data.type != 'error' && data.html) {
5151
nm.store.embedly = data;
5252
cache[nm.opener.attr('href')] = data;
5353
nm._delFilter('iframe');

js/jquery.nyroModal.filters.formFile.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ jQuery(function($, undefined) {
3434
initElts: function(nm) {
3535
var inputSel;
3636
if (nm.store.form.sel)
37-
inputSel = $('<input />', {
38-
'type': 'hidden',
37+
inputSel = $('<input type="hidden" />', {
3938
name: nm.selIndicator,
4039
value: nm.store.form.sel.substring(1)
4140
}).appendTo(nm.opener);
@@ -49,7 +48,13 @@ jQuery(function($, undefined) {
4948
nm.store.formFileIframe = undefined;
5049
delete(nm.store.formFileIframe);
5150
}
52-
nm.store.formFileIframe = $('<iframe name="nyroModalFormFile" src="javascript:\'\';" id="nyromodal-iframe-'+(new Date().getTime())+'"></iframe>')
51+
nm.store.formFileIframe = $('<iframe />')
52+
.attr({
53+
name: 'nyroModalFormFile',
54+
src: 'javascript:\'\';',
55+
id: 'nyromodal-iframe-'+(new Date().getTime()),
56+
frameborder: '0'
57+
})
5358
.hide()
5459
.load(function() {
5560
if (nm.store.formFileLoading) {
@@ -62,7 +67,7 @@ jQuery(function($, undefined) {
6267
nm._setCont(content.html(), nm.store.form.sel);
6368
} else {
6469
// Not totally ready, try it in a few secs
65-
var nbTry = 0;
70+
var nbTry = 0,
6671
fct = function() {
6772
nbTry++;
6873
var content = nm.store.formFileIframe

js/jquery.nyroModal.filters.iframe.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,12 @@ jQuery(function($, undefined) {
2323
nm.loadFilter = 'iframe';
2424
},
2525
load: function(nm) {
26-
nm.store.iframe = $('<iframe src="javascript:\'\';" id="nyromodal-iframe-'+(new Date().getTime())+'" frameborder="0"></iframe>');
26+
nm.store.iframe = $('<iframe />')
27+
.attr({
28+
src: 'javascript:\'\';',
29+
id: 'nyromodal-iframe-'+(new Date().getTime()),
30+
frameborder: '0'
31+
});
2732
nm._setCont(nm.store.iframe);
2833
},
2934
afterShowCont: function(nm) {

js/jquery.nyroModal.filters.iframeForm.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,13 @@ jQuery(function($, undefined) {
3333
});
3434
},
3535
load: function(nm) {
36-
nm.store.iframeFormIframe = $('<iframe name="nyroModalIframeForm" src="javascript:\'\';" id="nyromodal-iframe-'+(new Date().getTime())+'"></iframe>');
36+
nm.store.iframeFormIframe = $('<iframe />')
37+
.attr({
38+
name: 'nyroModalIframeForm',
39+
src: 'javascript:\'\';',
40+
id: 'nyromodal-iframe-'+(new Date().getTime()),
41+
frameborder: '0'
42+
});
3743
nm._setCont(nm.store.iframeFormIframe);
3844
},
3945
afterShowCont: function(nm) {

js/jquery.nyroModal.filters.link.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ jQuery(function($, undefined) {
3434
nm._error();
3535
}
3636
});
37-
3837
$.ajax(ajax);
3938
}
4039
}

js/jquery.nyroModal.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ jQuery(function($, undefined) {
280280
.append(this._filterScripts(html))
281281
.prepend(this.header)
282282
.append(this.footer)
283-
.wrapInner('<div class="nyroModal'+ucfirst(this.loadFilter)+'" />');
283+
.wrapInner($('<div />', {'class': 'nyroModal'+ucfirst(this.loadFilter)}));
284284

285285
// Store the size of the element
286286
this.sizes.initW = this.sizes.w = this.elts.hidden.width();
@@ -547,7 +547,7 @@ jQuery(function($, undefined) {
547547
},
548548

549549
nmManual: function(url, opts) {
550-
$('<a href="'+url+'"></a>').nyroModal(opts).trigger('nyroModal');
550+
$('<a />', {href: url}).nyroModal(opts).trigger('nyroModal');
551551
},
552552
nmData: function(data, opts) {
553553
this.nmManual('#', $.extend({data: data}, opts));
@@ -589,7 +589,7 @@ jQuery(function($, undefined) {
589589
nm.opener
590590
.off('nyroModal.nyroModal nmClose.nyroModal nmResize.nyroModal')
591591
.on({
592-
'nyroModal.nyroModal': function(e) { nm.open(); return false;},
592+
'nyroModal.nyroModal': function() { nm.open(); return false;},
593593
'nmClose.nyroModal': function() { nm.close(); return false;},
594594
'nmResize.nyroModal': function() { nm.resize(); return false;}
595595
});

0 commit comments

Comments
 (0)