Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modularized dialog creation library #97

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
154 changes: 90 additions & 64 deletions deploy/jN/includes/CSSLint.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,67 @@
(function(){

function createDialog(cfg){
var header = "";
for(var i=0; i<cfg.header.length; i++)
header +="<th>"+cfg.header[i]+"</th>";
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and this one too. Should definitely try to improve this. But I don't remember currently why don't I use DOM API here and if it is possible at allmor not. In fact I have modularized that very long ago.


new Dialog({
npp: Editor,
html: "<table id='results' onMouseOver='Dialog.cfg.onMOver(window.event);' onMouseOut='Dialog.cfg.onMOut(window.event);' onclick='Dialog.cfg.onClick(window.event, Dialog);' onkeypress='Dialog.cfg.onKeyDown(window.event, Dialog);'><tr>"+header+"</tr></table>",
height: 300,
width: 500,
title: cfg.title,
css: "body{overflow:auto;} .highlight{background-color:#eee;} #results{ font-size:12px; border-collapse:collapse} td{cursor:pointer;} td,th{border: 1px solid #d8d8d8; padding: 2px 10px} th{ background-color: #d8d8d8; padding-top:5px; text-align: center; vertical-align: middle;} i.warning{ background-position:-16px 0;} i.warning,i.error{width:16px; height:16px; background-repeat: no-repeat; background-image: URL(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAQCAYAAAB3AH1ZAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAABOtJREFUSMe1lFtsVGUQx3/zfefs2XN2l25b1ra0dqEtLQ1CUVJRlAApjddQ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Cjie4+4bA6t2IrdeXsE3pM6jShuQaD0SroCQBufycAMCIY2EK5BoPaq0AVLnCzrA2g32koj1od3ZDeeABUCxC6kUdk8fRD2YAxRHIDMNQ4ZA6wzLuuT9lzNmkeVwkMSZdn+kqk3V34IJXIfY4xg6yQ2WAWVQugGTLYaZGH7PUVTiTLtyOAgg+7V6fEOl/55lA3OBuIYFHtTVwGBf4RUNi6H3HPSNQ28WbMjnhHeO6Ec2kftoeq+04BTtUjW3N+m6lYinwVagBfIGsj4mmSffdwT/58OnyExuC20xhwCsklBRLLttbzY9lUcXBxA7KBJ1DI4rUhMCX5ncVFKkIYGpSBvTnDL+eB4Z+8lUnthdQyZBaIs5lHpnchv9X2z1U7+0SWUjEosjXjEmOY4ZGcAMdsNQV7uCPe7l5gDysWK1Rh4QY5IWIhpjlEjhDogRDL4PykfMDJgcyEwh6iYNX2yCL4EgULJ6AXXP3MOdi6tpnhuh0Q1QnprhwmiC7h/O07F9P9+fvMgAMAxMALnfARodxAmP18qUAAAAAElFTkSuQmCC)}",

oncreate: function(){
var el = this.getElementById("results");

var log="";
for (i=0, len=cfg.arr.length; i < len; i++){
var row = el.insertRow();
this.Dialog.cfg.cell(row, cfg.getCells( cfg.arr[i] ));
}

},
cell:function(r, arr){
for(var i=0,c=arr.length; i<c; i++)
r.insertCell().innerHTML = arr[i];
Copy link
Contributor Author

@KOLANICH KOLANICH Dec 26, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh SHIT, I dislike this code, it feels like a vulnr.

},
parent:function(el,name){
if (el.tagName == name)
return el;
return this.parent(el.parentNode, name);
},
onMOver:function(evt){
var target = evt.srcElement || evt.target;
var row = this.parent(target, "TR");
row.className = "highlight";
},
onMOut:function(evt){
var target = evt.srcElement || evt.target;
var row = this.parent(target, "TR");
row.className = "";
},
onClick:function(evt, d){
if (typeof(cfg.onRowClick)!="function")
return;

var target = evt.srcElement || evt.target;
var row = this.parent(target, "TR");

cfg.onRowClick(row, target);
},
onKeyDown: function(evt, dialog) {
var target = evt.srcElement || evt.target,
keycode = evt.keyCode || evt.which;

if (keycode == 27 || keycode == 13) {
dialog.hide();
}
}
});
}

function getCSSLint(){
if (typeof(CSSLint) != "undefined")
return CSSLint;
Expand Down Expand Up @@ -30,7 +92,7 @@ var settings = GlobalSettings.get("CSSLint") || {};
var CSSLintMenuCfg = {
text:"CSS Lint",
oninitpopup:function(){
this.verifyMenuItem.disabled = !/\.css/i.test(currentView.files[currentView.file]);
this.verifyMenuItem.disabled = !/\.(css|php|html)/i.test(currentView.files[currentView.file]);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does the csslint work also on php and html files properly? Maybe it is worth to make it part of settings or control it via (un)check in the menu?

}

};
Expand All @@ -51,55 +113,29 @@ CSSLintMenuCfg.verifyMenuItem = CSSLintMenu.addItem({
allowed[rules[i].id] = 1;
}

var results = csslint.verify(currentView.text, allowed);
var messages = [];
for(var i=0; i<results.messages.length; i++)
messages.push(this.getCells(results.messages[i]));

var results = csslint.verify(currentView.selection||currentView.text, allowed);
var messages = results.messages;
//alert(JSON.stringify(messages));
this.showDialog(messages);
},

getCells:function(m){
return ["<i class='"+m.type+"'/>",m.line,m.col,m.rule.name,m.message];
},
css: "i.warning{ background-position:-16px 0;} i.warning,i.error{width:16px; height:16px; background-repeat: no-repeat; background-image: URL(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAQCAYAAAB3AH1ZAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAABOtJREFUSMe1lFtsVGUQx3/zfefs2XN2l25b1ra0dqEtLQ1CUVJRlAApjddQjGg0Jj6oiQmXqEFj4oPigxGiRAM8eHsxUSNCYor64IUYIyFAQwoFbexFKKYV2tKL2+6lu3s+HxbxQtEn53Fm/jO/b+bLwL/YJ044/pHtVPE/mlwr8Dro+1fefM7PpDIHTpyufx78/yp24t5gDFgPrA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yQ2WAWVQugGTLYaZGH7PUVTiTLtyOAgg+7V6fEOl/55lA3OBuIYFHtTVwGBf4RUNi6H3HPSNQ28WbMjnhHeO6Ec2kftoeq+04BTtUjW3N+m6lYinwVagBfIGsj4mmSffdwT/58OnyExuC20xhwCsklBRLLttbzY9lUcXBxA7KBJ1DI4rUhMCX5ncVFKkIYGpSBvTnDL+eB4Z+8lUnthdQyZBaIs5lHpnchv9X2z1U7+0SWUjEosjXjEmOY4ZGcAMdsNQV7uCPe7l5gDysWK1Rh4QY5IWIhpjlEjhDogRDL4PykfMDJgcyEwh6iYNX2yCL4EgULJ6AXXP3MOdi6tpnhuh0Q1QnprhwmiC7h/O07F9P9+fvMgAMAxMALnfARodxAmP18qUAAAAAElFTkSuQmCC)}",
header: ["","Line", "Col", "Title","Description"],
dockable:{name:"CSSLint", docking:"bottom"},

showDialog:function(messages){
var dialCfg = new Dialog.Grid({
view: Editor.currentView,

dockable:this.dockable,
rows:messages,
title:"Results",
header: this.header,
css: this.css,
onRowClick:function(cell, target){
var row = cell.parentNode;
createGridViewDialog({
arr:messages,
title:"CSSLint - Results",
header: ["","Line", "Col", "Title","Description"],
getCells:function(m){
return ["<i class='"+m.type+"'/>",m.line,m.col,m.rule.name,m.message];
},

onRowClick:function(row){
var line = row.cells[1].innerText;
var col = row.cells[2].innerText;

var lnNr = 1*line -1;

// scroll to the line
this.view.line = lnNr;

//set current column
var lineObj = this.view.lines.get(lnNr);

var posNr = lineObj.start + col*1 -1;
this.view.pos = posNr;
this.view.anchor = posNr;

// aktivate view
MenuCmds.VIEW_SWITCHTO_OTHER_VIEW();
if (this.view != Editor.currentView)
MenuCmds.VIEW_SWITCHTO_OTHER_VIEW();
var col = row.cells[2].innerText;
Editor.currentView.line = 1*line -1;
//this.npp.currentView.column = 1*col -1;

}
});

new Dialog(dialCfg);
}
})

Expand All @@ -110,28 +146,20 @@ CSSLintMenu.addItem({
text:"Settings",
cmd:function(){
var rules = getCSSLint().getRules();
var rows = [];
for(var i=0,c=rules.length; i<c; i++){
rows.push(this.getCells(rules[i]));
}

this.showDialog(rows);
},
getCells:function(rule){
var checked = settings[rule.id] != 1 ? ' checked="checked"' : ''; // negative logic, if exists then not selected
return ['<input type="checkbox"' + checked + ' name="' + rule.id + '">', rule.name, rule.desc];
this.showDialog(rules);
},

showDialog:function(rules){
var dialCfg = new Dialog.Grid({
title : "CSSLint - Settings",
rows : rules,
createGridViewDialog({
arr:rules,
title:"CSSLint - Settings",
header: ["","Title","Description"],
clientHeight: 200,
clientWidth: 400,
onRowClick:function(cell, target){
var row = cell.parentNode;

getCells:function(rule){
var checked = settings[rule.id] != 1?"checked=''":""; // negative logic, if exists then not selected
return ["<input type='checkbox' "+checked+" name='"+rule.id+"'>",rule.name,rule.desc];
},

onRowClick:function(row, target){
var line = row.cells[1].innerText;
if (target.tagName != "INPUT"){
target = row.cells[0].firstChild;
this.toggle(target);
Expand All @@ -148,8 +176,6 @@ CSSLintMenu.addItem({
checkbox.checked = !checkbox.checked;
}
});

new Dialog(dialCfg);
}
})

Expand Down
81 changes: 81 additions & 0 deletions deploy/jN/includes/Dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,87 @@

})();

//own grid-view dialog
createGridViewDialog = function createGridViewDialog(cfg) {
var header = "";
for (var i = 0; i < cfg.header.length; i++)
header += "<th>" + cfg.header[i] + "</th>";

new Dialog({
npp : Editor,
html : "<table id='results' onMouseOver='Dialog.cfg.onMOver(window.event);' onMouseOut='Dialog.cfg.onMOut(window.event);' onclick='Dialog.cfg.onClick(window.event, Dialog);' onkeypress='Dialog.cfg.onKeyDown(window.event, Dialog);'><tr>" + header + "</tr></table>",
height : cfg.height || 500,
width : cfg.width || 800,
top : cfg.top || 200,
title : cfg.title,
css : (cfg.css ? cfg.css + "\n" : "") + "body{overflow:auto;} .highlight{background-color:#eee;} #results{ font-size:12px; border-collapse:collapse} td{cursor:pointer;} td,th{border: 1px solid #d8d8d8; padding: 2px 10px} th{ background-color: #d8d8d8; padding-top:5px; text-align: center; vertical-align: middle;} " +
"i.warning{ background-position:-16px 0;} i.fatal_error{ background-position:-32px 0;} i.notice{ background-position:-48px 0;}" +
"i.notice,i.fatal_error,i.warning,i.error{width:16px; height:16px; background-repeat: no-repeat; background-image: URL(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAAAQCAYAAACm53kpAAAHn0lEQVRYhcWXe3CU5RXGnwSSsa0tVpsOaEXaMrUt4kBROppELAuDEEFrh8I4eJnJ8IeVGZnxgg6tBdQMBBwtV7mkVBEW0pIuJARIlmCWEEMSlgV2ScCNZiAxkATcTYLJ3r5f/3g3VwLSdjp9Z86887znPd8559nznT2fdIN1VLrnsPSjG935H6+EXGnI/8XzbGkIEydcYNwv/EukxJuxaZqulOYMZbZkyN4yQ/7WGYq0zJC/JUP25gxlNk1Xys08x5OqMd40rfOlqcGbpnWeVI25qaBdrhRVVWXqeJVdx6v9Ol4Vie92VVVlyuW6Kf+SpGINeZbiqVAwkVJpzjfdb31ctisz5eh6bSwx+6twdDuW7xDW0e1Y9lfpem0sV2bK0fq4bIPZV09Q0ulUzfGlq9SXLgaR0tOpmlM9QUmDBuB22+Q+4VBtHTp/iT+1Btke6ODNlgBqaEa1dch9wiG3e1D//dYSKTkyLrWd1ffCxyPg/p8GNuo6jiUFnpStbZ48seU2KMsBbxH4+oi3CMpyiC230TZPnsCT/UnwjVGyN01110m8n3jTVOcbo+R+AVSetMnt9cjfwEuX2tgavMrfAl/3yNbgVV661Ib8Dcjt9ajy5I1JOKxbF7NjFtwpGC0oGI1LiQsHu9s0WynBuXLE3p4IxSuh4kMoXQPnigHMXrrGnBevJPb2RIJz5Wia3fs6xH/5b0y+W06n9qlIlztFFT6Hai4wrTHAokvtPH2xnY8CIQA+CoSY92Ubiy61M60xgGouoAqfQy734K/DRunb0dTfhEgVrMqDVXvhWcGDo7q2SrcMvH/1GWVG3rgbtj0He1+GvOchbw74dhoCfDsNznve6Lc9R+SNu7n6jDJ7KuD6ZX89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QqF5peMKcn30TCibBe3KQ1TsHeNM19z+cAxJ0IHi7DrQ5VNlJhjvCKGcU7bbQu6A/Y/bdFqOcUTLc8Qo40OZQYbvxXy5lMjxe9g8IZpsyZ8tdsFRGdo2Gt2TmgYnxXvBr4ZCeliTWysYWeSh5FM4vhda3IZCF1Z4FgSyDzy+FkkdhizysvXYS9KXr85sk4PPuSTBXulWStL/DpqKvPToSYt6xKC+4YiwsifGy0+wvuGLMOxZFR0Ko6GuP9nf0+q8b+q3XWb0jTNbHYTbsCrN5b4R/HAxTUBqhpDqC0x1mT1mEvx+IsPmfYdbYQyzbHmLh4i63hv6xpxd8IBub5KDwNvDMhMaF8NUys3tmQuFtsEkOPrjmWyChm4R4JVz3W8Cbrrl9x+Bq6Qc9T8nvtGlfyKGiMHJGmOqM8oeSGFOdUeSMoKIw2hdyKL+zv3+XNKlCWntMyj4urTwpZZ/ulZWnpBUnpJXHpeyj0gqXlO2UVhRLqx3StPhjbpF05+QReqTsRWW1Z6uYDWrgr4qyQQ3t2Soue1FZ47+n6ZJ+KRP4UEk6bH7FhL4xnXpIY31pWu9LU6MvTetPPaSxA0jTEilxt3TPQP9amp+lnLpi7W5rUH4kqt1tDcqpK9bS/EH9/wtmKS5npCFC7QAAAABJRU5ErkJggg==)}",

oncreate : function () {
var el = this.getElementById("results");

var log = "";
for (i = 0, len = cfg.arr.length; i < len; i++) {
var row = el.insertRow();
this.Dialog.cfg.cell(row, cfg.getCells(cfg.arr[i]));
}
el.focus();
},
cell : function (r, arr) {
for (var i = 0, c = arr.length; i < c; i++)
r.insertCell().innerHTML = arr[i];
},
parent : function (el, name) {
if (el.tagName == name)
return el;
return this.parent(el.parentNode, name);
},
onMOver : function (evt) {
var target = evt.srcElement || evt.target;
var row = this.parent(target, "TR");
row.className = "highlight";
},
onMOut : function (evt) {
var target = evt.srcElement || evt.target;
var row = this.parent(target, "TR");
row.className = "";
},
onClick : function (evt, d) {
if (typeof(cfg.onRowClick) != "function")
return;

var target = evt.srcElement || evt.target;
var row = this.parent(target, "TR");

cfg.onRowClick(row, target);
},
onKeyDown : function (evt, dialog) {
var target = evt.srcElement || evt.target,
keycode = evt.keyCode || evt.which;

if (keycode == 27 || keycode == 13) {
dialog.hide();
}
}
});
}
/*
new Dialog({
onbeforeclose : function () {
alert('bc');
return false;
},
onclose : function () {
alert('aa')
},
oncreate : function () {
this.getElementById('prompt_str').focus();
},
css : "body{background-color: buttonface; overflow:auto;}",
html : "<input type='text' id='prompt_str' style='width:100%' onkeypress='Dialog.close()' /><br/><a href='http://www.softwarecanoe.de' target='_blank'>www.softwarecanoe.de</a>"
});*/

/**
Example 1 Create dialog with grid

Expand Down