Unnaschied vunde Gschischde vun "Middawaida:YMS/eagleeye.js"

Inhalt gelöscht Inhalt hinzugefügt
YMS (Dischbediere | Baidräsch)
EagleEye v0.1
 
YMS (Dischbediere | Baidräsch)
v0.1b: Fixed issues with aborting, time display, button background change and section collapsing; set checkbox labels as proper labels; added installation indicator; multicolum layout for namespaces
Zail 15:
var useSkiplist = getOption("eeUseSkiplist", true); // Whether the skiplist should be used for the database scanner
var chunkSize = getOption("eeChunkSize", 10000000); // The chunk size for the database scanner (too low values will fail [depends on database] or cause bad performance, too high values may cause bad performance or even crashes)
var markerStyle = getOption("eeMarkerStyle", "background-color: #FF9191;"); // CSS style for the marker highlighting (more can be defined for span.eeMarker in user CSS)
var markerPrefix = getOption("eeMarkerPrefix", "ee_"); // Prefix for markers (e.g. "ee_" will result in markers like "ee_Doppelwort", may be set to "" for no prefix)
var scannerPage = getOption("eeScannerPage", mw.config.get("wgFormattedNamespaces")[2] + ":YMS/EagleEye"); // The page that will trigger the database scanner
Zail 41:
statusUnsupportedDump: { en: "Error: Unsupported dump type." },
lblAbort: { en: "Abort scan" },
lblChunkSize: { en: "Chunk size (in bytes)" },
lblInstalled: { en: "Script already is installed and active." },
lblNamespaces: { en: "Namespaces" },
lblOptions: { en: "Options" },
Zeile 47 ⟶ 49:
lblSearch: { en: "Search" },
lblSelectDump: { en: "Select database dump file" },
lblUseSkiplist: { en: "Use Skiplist" },
};
Zeile 174 ⟶ 177:
if (changed && (! a || ! a.nodeType || a.nodeName == "IMG")) {
$((a && a.nodeType) ? a : "img[rel=" + txt("generalName") + "EagleEye]").css("backgroundColor", changed ? "#DEF740" : "");
}
};
Zeile 184 ⟶ 187:
group: "format",
tools: {
regExEditEagleEye: {
label: txt("generalName"),
type: "button",
Zeile 220 ⟶ 223:
function addRuleEditor(i) {
var checkbox = $("<input />", { type: "checkbox", id: "eeRuleCB_" + i, checked: (rules[i].inactive == null || rules[i].inactive == false) });
$("#eeRulesPaneContent").append($("<div/>").append(checkbox).append($("<label />", { for: "eeRuleCB_" + i }).append(rules[i].name)));
}
// Add the GUI elements for the scanner
function loadScannerUI() {
// Collapse pre-defined installation section and set a marker
if ($("#eeInstallation").length) {
$("#eeInstallation").find(".mw-collapsible-content").prepend($("<div />", { id: "eeInstallationNotice" }).append(txt("lblInstalled")));
$("#eeInstallationNotice").css({ "background-color": "#44DD44", "padding": "5px", "margin": "5px" });
$("#eeInstallation").addClass("mw-collapsed");
}
// Rules
addSection("eeRulesPane", "eeRulesPaneContent", txt("lblRules"), null, true);
Zeile 235 ⟶ 245:
addSection("eeOptionsPane", "eeOptionsPaneContent", txt("lblOptions"), null, true);
 
$("#eeOptionsPaneContent").append($("<div/>").append($("<input />", { type: "checkbox", id: "eeOptionCB_useSkiplist", checked: (useSkiplist) })).append($("use<label Skiplist/>", { for: "eeOptionCB_useSkiplist" }).append(txt("lblUseSkiplist"))));
$("#eeOptionsPaneContent").append($("<div/>").append($("<input />", { type: "number", id: "eeOptionCB_chunkSize", value: chunkSize, min: 0 })).append($("Chunk<label size/>", { for: "eeOptionCB_chunkSize" }).append(txt("lblChunkSize"))));
// Namespaces
addSection("eeNamespacePane", "eeNamespacePaneContent", txt("lblNamespaces"), null, true);
$("#eeNamespacePaneContent").css("column-width", "200px");
for (var id in mw.config.get("wgFormattedNamespaces")) {
var name = (mw.config.get("wgFormattedNamespaces")[id] === "") ? txt("generalArticleNamespace") : mw.config.get("wgFormattedNamespaces")[id];
$("#eeNamespacePaneContent").append($("<div/>").append($("<input />", { type: "checkbox", id: "eeNamespaceCB_" + id, checked: ($.inArray(Number(id), namespaces) != -1) })).append($("<label />", { for: "eeNamespaceCB_" + id }).append(name)));
}
 
// Search
//addSection("eeSearchPane", "eeSearchPaneContent", txt("lblSearch"), $("<inputlabel />", { type: "file", idfor: "eeFile", name: }).append(txt("eeFilelblSelectDump" }), false));
//$("#eeSearchPaneContent").append($("<input />", { type: "button", id: "eeSearch", name: "eeSearch", value: txt("lblScanDump") }));
addSection("eeSearchPane", "eeSearchPaneContent", txt("lblSearch"), txt("lblSelectDump"));
$("#eeSearchPaneContent").append($("<div />").append($("<input />", { type: "file", id: "eeFile", name: "eeFile" }), false));
$("#eeSearchPaneContent").append($("<br/>"));
Zeile 262 ⟶ 270:
$("#eeSearchPaneContent").append($("<br/>"));
$("#eeSearchPaneContent").append($("<output/>", { id: "eeResults" }));
// Assure collapsible sections are made collapsible
mw.loader.using("mediawiki.page.ready", function () {
$(".mw-collapsible").makeCollapsible();
});
$("#eeAbortLink").click(function() {
Zeile 314 ⟶ 327:
reader.onloadend = function(e) {
if (aborted || e.target.readyState != FileReader.DONE || file == null || ! file) {
aborted = false;
return;
}
Zeile 376 ⟶ 390:
} else {
var msec = ((new Date()) - startTime);
var sec = ((Math.floor(msec / 1000) % 60 < 10) ? "0" : "") + Math.floor(msec / 1000) % 60;
var min = ((Math.floor(msec / 1000 / 60) < 10) ? "0" : "") + Math.floor(msec / 1000 / 60);
setStatus(txt("statusFinished").format(results, min, sec));
aborted = false;
$("#eeAbortDiv").hide();
}