rhymix/modules/editor/skins/xquared/javascripts/macro/IFrameMacro.js
haneul 7c3b336e41 17223554 : xquared upgrade to 0.7
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@4968 201d5d3c-b55e-5fd7-737f-ddc643e51545
2008-11-24 08:52:19 +00:00

36 lines
No EOL
852 B
JavaScript

/**
* @requires macro/Base.js
*/
xq.macro.IFrameMacro = xq.Class(xq.macro.Base,
/**
* IFrame macro
*
* @name xq.macro.IFrameMacro
* @lends xq.macro.IFrameMacro.prototype
* @extends xq.macro.Base
* @constructor
*/
{
initFromHtml: function() {
this.params.html = this.html;
},
initFromParams: function() {
if(this.params.html) return;
var sb = [];
sb.push('<iframe');
for(var attrName in this.params) {
var attrValue = this.params[attrName];
if(attrValue) sb.push(' ' + attrName.substring("p_".length) + '="' + attrValue + '"');
}
sb.push('></iframe>');
this.params = {html:sb.join("")};
},
createHtml: function() {
return this.params.html;
}
});
xq.macro.IFrameMacro.recognize = function(html) {
var p = xq.compilePattern("<IFRAME\\s+[^>]+(?:/>|>.*?</(?:IFRAME)>)", "img");
return !!html.match(p);
}