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

Use require to load csslint script #107

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
23 changes: 4 additions & 19 deletions deploy/jN/includes/CSSLint.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,11 @@

(function(){

function getCSSLint(){
if (typeof(CSSLint) != "undefined")
return CSSLint;

var fso = new ActiveXObject("Scripting.FileSystemObject");

var fn = Editor.nppDir + "\\plugins\\jN\\jN\\includes\\csslint\\csslint.js";
if (fso.FileExists(fn)){
var f = fso.OpenTextFile(fn,1, false,0);
var scr = decodeFrom(65001,f.ReadAll());
if (scr && scr.length>0){
try{
addScript(scr);
}catch(e){
alert(e.message);
}
}
f.Close();
}else{
alert("csslint not found");
}
require("includes/csslint/csslint.js");

return CSSLint;
}
Expand Down Expand Up @@ -118,8 +103,8 @@ CSSLintMenu.addItem({
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];
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];
},

showDialog:function(rules){
Expand Down