Import xinha so we can switch from htmlarea and fix a bunch of in-browser issues that htmlarea has
This commit is contained in:
BIN
xinha/plugins/UnFormat/img/unformat.gif
Normal file
BIN
xinha/plugins/UnFormat/img/unformat.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 149 B |
10
xinha/plugins/UnFormat/lang/de.js
Normal file
10
xinha/plugins/UnFormat/lang/de.js
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"Page Cleaner" : "Seite bereinigen",
|
||||
"Cleaning Area" : "Reinigungsbereich",
|
||||
"Selection" : "Ausgewählter Bereich",
|
||||
"All" : "Alles",
|
||||
"Cleaning options" : "Reinigungsoptionen",
|
||||
"Formatting:" : "Formatierung:",
|
||||
"All HTML:" : "Ganzes HTML:",
|
||||
"Select which types of formatting you would like to remove." : "Wählen Sie aus welche Formatierungen Sie entfernen wollen."
|
||||
};
|
||||
10
xinha/plugins/UnFormat/lang/nl.js
Normal file
10
xinha/plugins/UnFormat/lang/nl.js
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"Page Cleaner" : "Pagina Schoonmaker",
|
||||
"Cleaning Area" : "Schoonmaak gebied",
|
||||
"Selection" : "Geselecteerde tekst",
|
||||
"All" : "Alles",
|
||||
"Cleaning options" : "Schoonmaak opties",
|
||||
"Formatting:" : "Format",
|
||||
"All HTML:" : "Alle html",
|
||||
"Select which types of formatting you would like to remove." : "Selecteer welke types van Formatteren je wilt verwijderen"
|
||||
};
|
||||
14
xinha/plugins/UnFormat/lang/no.js
Normal file
14
xinha/plugins/UnFormat/lang/no.js
Normal file
@@ -0,0 +1,14 @@
|
||||
// I18N constants
|
||||
// LANG: "no", ENCODING: UTF-8
|
||||
// translated: Kim Steinhaug, http://www.steinhaug.com/, kim@steinhaug.com
|
||||
|
||||
{
|
||||
"Page Cleaner" : "Dokumentvasker",
|
||||
"Cleaning Area" : "Vaskeområde",
|
||||
"Selection" : "Markert område",
|
||||
"All" : "Hele dokumentet",
|
||||
"Cleaning options" : "Vaskemetoder",
|
||||
"Formatting:" : "Formattering:",
|
||||
"All HTML:" : "All HTML-kode:",
|
||||
"Select which types of formatting you would like to remove." : "Velg hva slags formattering du ønsker å fjerne."
|
||||
};
|
||||
85
xinha/plugins/UnFormat/popups/unformat.html
Normal file
85
xinha/plugins/UnFormat/popups/unformat.html
Normal file
@@ -0,0 +1,85 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>Page Cleaner</title>
|
||||
<link rel="stylesheet" type="text/css" href="../../../popups/popup.css" />
|
||||
<script type="text/javascript" src="../../../popups/popup.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
|
||||
|
||||
UnFormat = window.opener.UnFormat;
|
||||
window.resizeTo(300, 100);
|
||||
|
||||
var x = opener.screenX + (opener.outerWidth - window.outerWidth) / 2;
|
||||
var y = opener.screenY + (opener.outerHeight - window.outerHeight) / 2;
|
||||
window.moveTo(x, y);
|
||||
|
||||
|
||||
function Init() {
|
||||
__dlg_translate('UnFormat');
|
||||
__dlg_init();
|
||||
};
|
||||
|
||||
function onOK() {
|
||||
var param = new Object();
|
||||
|
||||
if (document.getElementById('clean_selection').checked) {
|
||||
param["cleaning_area"] = "selection";
|
||||
} else {
|
||||
param["cleaning_area"] = "all";
|
||||
}
|
||||
|
||||
var fields = ["formatting", "html_all"];
|
||||
|
||||
for (var i in fields) {
|
||||
var id = fields[i];
|
||||
var el = document.getElementById(id);
|
||||
if (el.checked) {param[id] = true;}
|
||||
}
|
||||
|
||||
__dlg_close(param);
|
||||
return false;
|
||||
};
|
||||
|
||||
function onCancel() {
|
||||
__dlg_close(null);
|
||||
return false;
|
||||
};
|
||||
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body class="Dialog" onload="Init();self.focus();">
|
||||
|
||||
<div class="title">Page Cleaner</div>
|
||||
|
||||
<form action="" method="get">
|
||||
<fieldset>
|
||||
<legend>Cleaning Area</legend>
|
||||
<span>Selection</span><input type="radio" name="cleaning_area" id="clean_selection" value="selection" checked="checked" />
|
||||
<span>All</span><input type="radio" name="cleaning_area" id="clean_page" value="page" />
|
||||
</fieldset>
|
||||
<br>
|
||||
<fieldset>
|
||||
<legend>Cleaning options</legend>
|
||||
<div class="space"></div>
|
||||
<div class="fr">Formatting:</div>
|
||||
<input type="checkbox" id="formatting" value="" checked />
|
||||
<p />
|
||||
<div class="fr">All HTML:</div>
|
||||
<input type="checkbox" id="html_all" value="" />
|
||||
<p />
|
||||
</fieldset>
|
||||
<br /><br />
|
||||
<p style="text-align:center"><span>Select which types of formatting you would like to remove.</span></p>
|
||||
|
||||
<div id="buttons">
|
||||
<button type="button" name="ok" onclick="return onOK();">OK</button>
|
||||
<button type="button" name="cancel" onclick="return onCancel();">Cancel</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
65
xinha/plugins/UnFormat/un-format.js
Normal file
65
xinha/plugins/UnFormat/un-format.js
Normal file
@@ -0,0 +1,65 @@
|
||||
// Unormat plugin for HTMLArea
|
||||
|
||||
|
||||
function UnFormat(editor) {
|
||||
this.editor = editor;
|
||||
var cfg = editor.config;
|
||||
var self = this;
|
||||
|
||||
cfg.registerButton({
|
||||
id : "unformat",
|
||||
tooltip : this._lc("Page Cleaner"),
|
||||
image : editor.imgURL("unformat.gif", "UnFormat"),
|
||||
textMode : false,
|
||||
action : function(editor) {
|
||||
self.buttonPress(editor);
|
||||
}
|
||||
})
|
||||
|
||||
cfg.addToolbarElement("unformat", "killword", 1);
|
||||
};
|
||||
|
||||
UnFormat._pluginInfo = {
|
||||
name : "UnFormat",
|
||||
version : "1.0",
|
||||
license : "htmlArea"
|
||||
};
|
||||
|
||||
|
||||
UnFormat.prototype._lc = function(string) {
|
||||
return HTMLArea._lc(string, 'UnFormat');
|
||||
}
|
||||
|
||||
UnFormat.prototype.buttonPress = function(editor){
|
||||
editor._popupDialog( "plugin://UnFormat/unformat", function( param){
|
||||
if (param) {
|
||||
if (param["cleaning_area"] == "all") {
|
||||
var html = editor._doc.body.innerHTML;
|
||||
} else {
|
||||
var html = editor.getSelectedHTML();
|
||||
}
|
||||
|
||||
if (param["html_all"]== true) {
|
||||
html = html.replace(/<[\!]*?[^<>]*?>/g, "");
|
||||
}
|
||||
|
||||
if (param["formatting"] == true) {
|
||||
html = html.replace(/style="[^"]*"/gi, "");
|
||||
html = html.replace(/<\/?font[^>]*>/gi,"");
|
||||
html = html.replace(/<\/?b>/gi,"");
|
||||
html = html.replace(/<\/?strong[^>]*>/gi,"");
|
||||
html = html.replace(/<\/?i>/gi,"");
|
||||
html = html.replace(/<\/?em[^>]*>/gi,"");
|
||||
html = html.replace(/<\/?u[^>]*>/gi,"");
|
||||
html = html.replace(/<\/?strike[^>]*>/gi,"");
|
||||
html = html.replace(/ align=[^\s|>]*/gi,"");
|
||||
html = html.replace(/ class=[^\s|>]*/gi,"");
|
||||
}
|
||||
if (param["cleaning_area"] == "all") {
|
||||
editor._doc.body.innerHTML = html;
|
||||
} else {
|
||||
editor.insertHTML(html);
|
||||
}
|
||||
} else { return false; }
|
||||
}, null);
|
||||
}
|
||||
Reference in New Issue
Block a user