Permalink
Browse files

Complete review for creating DOM element.

Fix error with embedly and iframe filters
  • Loading branch information...
1 parent 3cf30c2 commit f0430bbbced473cda3858f9c45d005fa1fc674a8 @nyroDev committed Oct 21, 2012
@@ -13,9 +13,8 @@ jQuery(function($, undefined) {
data: {
is: function(nm) {
var ret = nm.data ? true : false;
- if (ret) {
+ if (ret)
nm._delFilter('dom');
- }
return ret;
},
init: function(nm) {
@@ -47,7 +47,7 @@ jQuery(function($, undefined) {
dataType: 'jsonp',
data: data,
success: function(data) {
- if (data.type != 'error') {
+ if (data.type != 'error' && data.html) {
nm.store.embedly = data;
cache[nm.opener.attr('href')] = data;
nm._delFilter('iframe');
@@ -34,8 +34,7 @@ jQuery(function($, undefined) {
initElts: function(nm) {
var inputSel;
if (nm.store.form.sel)
- inputSel = $('<input />', {
- 'type': 'hidden',
+ inputSel = $('<input type="hidden" />', {
name: nm.selIndicator,
value: nm.store.form.sel.substring(1)
}).appendTo(nm.opener);
@@ -49,7 +48,13 @@ jQuery(function($, undefined) {
nm.store.formFileIframe = undefined;
delete(nm.store.formFileIframe);
}
- nm.store.formFileIframe = $('<iframe name="nyroModalFormFile" src="javascript:\'\';" id="nyromodal-iframe-'+(new Date().getTime())+'"></iframe>')
+ nm.store.formFileIframe = $('<iframe />')
+ .attr({
+ name: 'nyroModalFormFile',
+ src: 'javascript:\'\';',
+ id: 'nyromodal-iframe-'+(new Date().getTime()),
+ frameborder: '0'
+ })
.hide()
.load(function() {
if (nm.store.formFileLoading) {
@@ -62,7 +67,7 @@ jQuery(function($, undefined) {
nm._setCont(content.html(), nm.store.form.sel);
} else {
// Not totally ready, try it in a few secs
- var nbTry = 0;
+ var nbTry = 0,
fct = function() {
nbTry++;
var content = nm.store.formFileIframe
@@ -23,7 +23,12 @@ jQuery(function($, undefined) {
nm.loadFilter = 'iframe';
},
load: function(nm) {
- nm.store.iframe = $('<iframe src="javascript:\'\';" id="nyromodal-iframe-'+(new Date().getTime())+'" frameborder="0"></iframe>');
+ nm.store.iframe = $('<iframe />')
+ .attr({
+ src: 'javascript:\'\';',
+ id: 'nyromodal-iframe-'+(new Date().getTime()),
+ frameborder: '0'
+ });
nm._setCont(nm.store.iframe);
},
afterShowCont: function(nm) {
@@ -33,7 +33,13 @@ jQuery(function($, undefined) {
});
},
load: function(nm) {
- nm.store.iframeFormIframe = $('<iframe name="nyroModalIframeForm" src="javascript:\'\';" id="nyromodal-iframe-'+(new Date().getTime())+'"></iframe>');
+ nm.store.iframeFormIframe = $('<iframe />')
+ .attr({
+ name: 'nyroModalIframeForm',
+ src: 'javascript:\'\';',
+ id: 'nyromodal-iframe-'+(new Date().getTime()),
+ frameborder: '0'
+ });
nm._setCont(nm.store.iframeFormIframe);
},
afterShowCont: function(nm) {
@@ -34,7 +34,6 @@ jQuery(function($, undefined) {
nm._error();
}
});
-
$.ajax(ajax);
}
}
@@ -280,7 +280,7 @@ jQuery(function($, undefined) {
.append(this._filterScripts(html))
.prepend(this.header)
.append(this.footer)
- .wrapInner('<div class="nyroModal'+ucfirst(this.loadFilter)+'" />');
+ .wrapInner($('<div />', {'class': 'nyroModal'+ucfirst(this.loadFilter)}));
// Store the size of the element
this.sizes.initW = this.sizes.w = this.elts.hidden.width();
@@ -547,7 +547,7 @@ jQuery(function($, undefined) {
},
nmManual: function(url, opts) {
- $('<a href="'+url+'"></a>').nyroModal(opts).trigger('nyroModal');
+ $('<a />', {href: url}).nyroModal(opts).trigger('nyroModal');
},
nmData: function(data, opts) {
this.nmManual('#', $.extend({data: data}, opts));
@@ -589,7 +589,7 @@ jQuery(function($, undefined) {
nm.opener
.off('nyroModal.nyroModal nmClose.nyroModal nmResize.nyroModal')
.on({
- 'nyroModal.nyroModal': function(e) { nm.open(); return false;},
+ 'nyroModal.nyroModal': function() { nm.open(); return false;},
'nmClose.nyroModal': function() { nm.close(); return false;},
'nmResize.nyroModal': function() { nm.resize(); return false;}
});

0 comments on commit f0430bb

Please sign in to comment.