mirror of
https://github.com/friendica/friendica
synced 2025-04-23 13:50:11 +00:00
Initial checkin
This commit is contained in:
commit
6348e70daa
393 changed files with 59765 additions and 0 deletions
106
tinymce/jscripts/tiny_mce/plugins/template/js/template.js
vendored
Normal file
106
tinymce/jscripts/tiny_mce/plugins/template/js/template.js
vendored
Normal file
|
@ -0,0 +1,106 @@
|
|||
tinyMCEPopup.requireLangPack();
|
||||
|
||||
var TemplateDialog = {
|
||||
preInit : function() {
|
||||
var url = tinyMCEPopup.getParam("template_external_list_url");
|
||||
|
||||
if (url != null)
|
||||
document.write('<sc'+'ript language="javascript" type="text/javascript" src="' + tinyMCEPopup.editor.documentBaseURI.toAbsolute(url) + '"></sc'+'ript>');
|
||||
},
|
||||
|
||||
init : function() {
|
||||
var ed = tinyMCEPopup.editor, tsrc, sel, x, u;
|
||||
|
||||
tsrc = ed.getParam("template_templates", false);
|
||||
sel = document.getElementById('tpath');
|
||||
|
||||
// Setup external template list
|
||||
if (!tsrc && typeof(tinyMCETemplateList) != 'undefined') {
|
||||
for (x=0, tsrc = []; x<tinyMCETemplateList.length; x++)
|
||||
tsrc.push({title : tinyMCETemplateList[x][0], src : tinyMCETemplateList[x][1], description : tinyMCETemplateList[x][2]});
|
||||
}
|
||||
|
||||
for (x=0; x<tsrc.length; x++)
|
||||
sel.options[sel.options.length] = new Option(tsrc[x].title, tinyMCEPopup.editor.documentBaseURI.toAbsolute(tsrc[x].src));
|
||||
|
||||
this.resize();
|
||||
this.tsrc = tsrc;
|
||||
},
|
||||
|
||||
resize : function() {
|
||||
var w, h, e;
|
||||
|
||||
if (!self.innerWidth) {
|
||||
w = document.body.clientWidth - 50;
|
||||
h = document.body.clientHeight - 160;
|
||||
} else {
|
||||
w = self.innerWidth - 50;
|
||||
h = self.innerHeight - 170;
|
||||
}
|
||||
|
||||
e = document.getElementById('templatesrc');
|
||||
|
||||
if (e) {
|
||||
e.style.height = Math.abs(h) + 'px';
|
||||
e.style.width = Math.abs(w - 5) + 'px';
|
||||
}
|
||||
},
|
||||
|
||||
loadCSSFiles : function(d) {
|
||||
var ed = tinyMCEPopup.editor;
|
||||
|
||||
tinymce.each(ed.getParam("content_css", '').split(','), function(u) {
|
||||
d.write('<link href="' + ed.documentBaseURI.toAbsolute(u) + '" rel="stylesheet" type="text/css" />');
|
||||
});
|
||||
},
|
||||
|
||||
selectTemplate : function(u, ti) {
|
||||
var d = window.frames['templatesrc'].document, x, tsrc = this.tsrc;
|
||||
|
||||
if (!u)
|
||||
return;
|
||||
|
||||
d.body.innerHTML = this.templateHTML = this.getFileContents(u);
|
||||
|
||||
for (x=0; x<tsrc.length; x++) {
|
||||
if (tsrc[x].title == ti)
|
||||
document.getElementById('tmpldesc').innerHTML = tsrc[x].description || '';
|
||||
}
|
||||
},
|
||||
|
||||
insert : function() {
|
||||
tinyMCEPopup.execCommand('mceInsertTemplate', false, {
|
||||
content : this.templateHTML,
|
||||
selection : tinyMCEPopup.editor.selection.getContent()
|
||||
});
|
||||
|
||||
tinyMCEPopup.close();
|
||||
},
|
||||
|
||||
getFileContents : function(u) {
|
||||
var x, d, t = 'text/plain';
|
||||
|
||||
function g(s) {
|
||||
x = 0;
|
||||
|
||||
try {
|
||||
x = new ActiveXObject(s);
|
||||
} catch (s) {
|
||||
}
|
||||
|
||||
return x;
|
||||
};
|
||||
|
||||
x = window.ActiveXObject ? g('Msxml2.XMLHTTP') || g('Microsoft.XMLHTTP') : new XMLHttpRequest();
|
||||
|
||||
// Synchronous AJAX load file
|
||||
x.overrideMimeType && x.overrideMimeType(t);
|
||||
x.open("GET", u, false);
|
||||
x.send(null);
|
||||
|
||||
return x.responseText;
|
||||
}
|
||||
};
|
||||
|
||||
TemplateDialog.preInit();
|
||||
tinyMCEPopup.onInit.add(TemplateDialog.init, TemplateDialog);
|
Loading…
Add table
Add a link
Reference in a new issue