Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d33a26526f | ||
|
|
e5cef9f768 | ||
|
|
02dc70d435 | ||
|
|
5354db236d | ||
|
|
ff2ce99a19 | ||
|
|
ca2c8d57cc | ||
|
|
37309931be |
No files matched your search
+23
-3
@@ -16,6 +16,11 @@ module.exports = function (grunt) {
|
||||
|
||||
browserify: {
|
||||
default: {
|
||||
options: {
|
||||
browserifyOptions: {
|
||||
debug: true
|
||||
}
|
||||
},
|
||||
src: ['<%= pkg.grunt.src.path %>/debug.js', '<%= pkg.grunt.src.path %>/<%= pkg.grunt.src.script %>'],
|
||||
dest: '<%= pkg.grunt.src.path %>/<%= pkg.grunt.build.script %>.js'
|
||||
},
|
||||
@@ -25,6 +30,20 @@ module.exports = function (grunt) {
|
||||
}
|
||||
},
|
||||
|
||||
exorcise: {
|
||||
default: {
|
||||
options: {
|
||||
url: "http://localhost:63344/lint-neo-yt/src/app.map",
|
||||
root: "../",
|
||||
base: "../",
|
||||
strict: true
|
||||
},
|
||||
files: {
|
||||
'src/app.map': ['src/app.js']
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
uglify: {
|
||||
options: {
|
||||
banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
|
||||
@@ -68,14 +87,15 @@ module.exports = function (grunt) {
|
||||
});
|
||||
|
||||
// Load the plugins.
|
||||
grunt.loadNpmTasks('grunt-browserify');
|
||||
grunt.loadNpmTasks('grunt-contrib-uglify');
|
||||
grunt.loadNpmTasks('grunt-contrib-clean');
|
||||
grunt.loadNpmTasks('grunt-browserify');
|
||||
grunt.loadNpmTasks('grunt-exorcise');
|
||||
grunt.loadNpmTasks('grunt-contrib-uglify');
|
||||
grunt.loadNpmTasks('grunt-contrib-copy');
|
||||
grunt.loadNpmTasks('grunt-cache-breaker');
|
||||
|
||||
// Default task(s).
|
||||
grunt.registerTask('default', ['clean', 'browserify:default', 'copy', 'cachebreaker']);
|
||||
grunt.registerTask('default', ['clean', 'browserify:default', 'exorcise:default', 'copy', 'cachebreaker']);
|
||||
grunt.registerTask('build', ['clean', 'browserify:build', 'uglify:build', 'copy', 'cachebreaker']);
|
||||
|
||||
};
|
||||
+7
-4
@@ -1,12 +1,11 @@
|
||||
{
|
||||
"name": "lint-neo-yt",
|
||||
"version": "1.0.0",
|
||||
"version": "1.1.0",
|
||||
"description": "Neo's Linter",
|
||||
"main": "js/app.js",
|
||||
"scripts": {
|
||||
"prebuild": "npm install",
|
||||
"build": "grunt build",
|
||||
|
||||
"prebuild:dev": "npm run prebuild",
|
||||
"build:dev": "grunt"
|
||||
},
|
||||
@@ -14,13 +13,14 @@
|
||||
"license": "MIT",
|
||||
"repository": "https://github.com/Neo-Desktop/lint-neo-yt",
|
||||
"devDependencies": {
|
||||
"bootstrap": "^3.3.7",
|
||||
"bcryptjs": "^2.4.3",
|
||||
"bootstrap.native": "^2.0.8",
|
||||
"bootswatch": "^3.3.7",
|
||||
"browserify": "^14.1.0",
|
||||
"browserify-css": "^0.10.0",
|
||||
"browserify-shim": "^3.8.13",
|
||||
"bulkify": "^1.4.2",
|
||||
"crypto-js": "^3.1.9-1",
|
||||
"gencryption": "^3.5.0",
|
||||
"grunt": "^1.0.1",
|
||||
"grunt-browserify": "^5.0.0",
|
||||
"grunt-cache-breaker": "^2.0.1",
|
||||
@@ -28,14 +28,17 @@
|
||||
"grunt-contrib-clean": "^1.0.0",
|
||||
"grunt-contrib-copy": "^1.0.0",
|
||||
"grunt-contrib-uglify": "^2.2.0",
|
||||
"grunt-exorcise": "^2.1.1",
|
||||
"hasher": "^1.2.0",
|
||||
"highlight.js": "^9.9.0",
|
||||
"html": "^1.0.0",
|
||||
"htmllint": "^0.6.0",
|
||||
"jquery": "^3.1.1",
|
||||
"js-beautify": "^1.6.11",
|
||||
"node-forge": "^0.7.0",
|
||||
"sql-formatter": "^1.2.0",
|
||||
"uglifyify": "^3.0.4",
|
||||
"whirlpool": "0.0.4",
|
||||
"xml-beautifier": "^0.3.0"
|
||||
},
|
||||
"grunt": {
|
||||
|
||||
+1099
File diff suppressed because it is too large.
Load diff
+1
-1
@@ -2,7 +2,7 @@
|
||||
CSS Boilerplate
|
||||
*/
|
||||
|
||||
@import url('../node_modules/bootstrap/dist/css/bootstrap.min.css');
|
||||
@import url('../node_modules/bootstrap.native/assets/css/bootstrap.min.css');
|
||||
@import url('../node_modules/bootswatch/darkly/bootstrap.min.css');
|
||||
@import url('../node_modules/highlight.js/styles/default.css');
|
||||
@import url('../node_modules/highlight.js/styles/monokai-sublime.css');
|
||||
|
||||
+32
-22
@@ -9,7 +9,8 @@
|
||||
<nav class="navbar navbar-fixed-top navbar-default">
|
||||
<div class="container">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
|
||||
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"
|
||||
aria-expanded="false" aria-controls="navbar">
|
||||
<span class="sr-only">Toggle navigation</span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
@@ -18,42 +19,51 @@
|
||||
<a class="navbar-brand" href="#">Linter</a>
|
||||
</div>
|
||||
<div id="navbar" class="collapse navbar-collapse">
|
||||
<ul class="nav navbar-nav">
|
||||
<li id="html_tab" data-name="HTML Linter" class="active"><a href="#">HTML</a></li>
|
||||
<li id="json_tab" data-name="JSON Linter"><a href="#">JSON</a></li>
|
||||
<li id="xml_tab" data-name="XML Linter"><a href="#">XML</a></li>
|
||||
<li id="js_tab" data-name="JavaScript Linter"><a href="#">JavaScript</a></li>
|
||||
<li id="css_tab" data-name="CSS Linter"><a href="#">CSS</a></li>
|
||||
<li id="sql_tab" data-name="SQL Linter"><a href="#">SQL</a></li>
|
||||
<li id="encode_decode_tab" class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="true">Encode/Decode <span class="caret"></span></a>
|
||||
<ul class="dropdown-menu" role="menu">
|
||||
<li id="urlencode_tab" data-extra-highlight="encode_decode_tab" data-name="URL Encoder"><a href="#">URLEncode</a></li>
|
||||
<li id="urldecode_tab" data-extra-highlight="encode_decode_tab" data-name="URL Decoder"><a href="#">URLDecode</a></li>
|
||||
<li id="base64encode_tab" data-extra-highlight="encode_decode_tab" data-name="Base64 Encoder"><a href="#">Base64Encode</a></li>
|
||||
<li id="base64decode_tab" data-extra-highlight="encode_decode_tab" data-name="Base64 Decoder"><a href="#">Base64Decode</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="nav navbar-nav"></ul>
|
||||
</div><!-- /.nav-collapse -->
|
||||
</div><!-- /.container -->
|
||||
</nav>
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-sm-9">
|
||||
<div class="col">
|
||||
<h1 id="header">HTML Lint</h1>
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-9">
|
||||
<p>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<hr>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<div class="input">
|
||||
<textarea id="input"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="form-group">
|
||||
<label for="select" class="control-label">Dropdown</label>
|
||||
<select class="form-control" id="select">
|
||||
<option>1</option>
|
||||
<option>2</option>
|
||||
<option>3</option>
|
||||
<option>4</option>
|
||||
<option>5</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<hr>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<div class="output">
|
||||
<pre><code id="output" class="hljs" contenteditable="true"></code></pre>
|
||||
</div>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
+420
-92
@@ -26,7 +26,7 @@ window.$ = window.jQuery = require('jquery');
|
||||
|
||||
// include bootstrap css and javascript
|
||||
require('./index.css');
|
||||
require('bootstrap');
|
||||
var bsn = require('bootstrap.native');
|
||||
|
||||
// use hasher for application page management
|
||||
var hasher = require('hasher');
|
||||
@@ -53,55 +53,155 @@ var beautify_xml = require('xml-beautifier');
|
||||
// sql-formatter library
|
||||
var beautify_sql = require('sql-formatter');
|
||||
|
||||
// bcrypt-js library
|
||||
var bcrypt = require('bcryptjs');
|
||||
|
||||
// forge library
|
||||
var forge = require('node-forge');
|
||||
|
||||
// gencryption
|
||||
var gencryption = require("gencryption");
|
||||
|
||||
// whirlpool
|
||||
var whirlpool = require("whirlpool");
|
||||
|
||||
var cryptoShim = {
|
||||
shim: {
|
||||
out: function (md) {
|
||||
return md.digest().toHex();
|
||||
}
|
||||
},
|
||||
/**
|
||||
* MD(4|5) support
|
||||
* @param type
|
||||
* @param textIn
|
||||
* @return {*}
|
||||
* @constructor
|
||||
*/
|
||||
MD: function (type, textIn) {
|
||||
switch (type) {
|
||||
case 4:
|
||||
type = "md4";
|
||||
return gencryption.md4.getHashOfTextSync.apply(this, [textIn]);
|
||||
break;
|
||||
case 5:
|
||||
type = "md5";
|
||||
return gencryption.md5.getHashOfTextSync.apply(this, [textIn]);
|
||||
default:
|
||||
throw new Error("Unable to parse MD " + type);
|
||||
}
|
||||
},
|
||||
/**
|
||||
* SHA(1|2|3|KE) support
|
||||
* @param type
|
||||
* @param bits
|
||||
* @param textIn
|
||||
* @param outputBitLength
|
||||
* @return {*}
|
||||
* @constructor
|
||||
*/
|
||||
SHA: function (type, bits, textIn, outputBitLength) {
|
||||
switch (type) {
|
||||
case 1:
|
||||
return gencryption.sha1.getHashOfTextSync.apply(this, [textIn]);
|
||||
break;
|
||||
case 2:
|
||||
return gencryption.sha2.getHashOfTextSync.apply(this, [bits, textIn]);
|
||||
break;
|
||||
case 3:
|
||||
return gencryption.sha3.getHashOfTextSync.apply(this, [bits, textIn]);
|
||||
break;
|
||||
case "ke":
|
||||
return gencryption.shake.getHashOfTextSync.apply(this, [bits, outputBitLength, textIn]);
|
||||
break;
|
||||
default:
|
||||
throw new Error("Unable to parse SHA " + type);
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Keccak support
|
||||
* @param bitSize [224, 256, 384, 512]
|
||||
* @param stringIn
|
||||
* @return {*}
|
||||
*/
|
||||
keccak: function (bitSize, stringIn) {
|
||||
return gencryption.keccak.getHashOfTextSync.apply(this, [bitSize, stringIn]);
|
||||
},
|
||||
/**
|
||||
* Whirlpool support
|
||||
* @param stringIn
|
||||
* @return {*}
|
||||
*/
|
||||
whirlpool: function (stringIn) {
|
||||
return whirlpool.apply(this, [stringIn]);
|
||||
},
|
||||
/**
|
||||
* RIPEMD[160] support
|
||||
* @param length
|
||||
* @param stringIn
|
||||
* @constructor
|
||||
*/
|
||||
RIPEMD: function (length, stringIn) {
|
||||
if (length === 160) {
|
||||
return gencryption.ripemd160.getHashOfTextSync.apply(this, [stringIn]);
|
||||
} else {
|
||||
return gencryption.ripemd.getHashOfTextSync.apply(this, [stringIn]);
|
||||
}
|
||||
},
|
||||
/**
|
||||
* DSS1 support
|
||||
* @param stringIn
|
||||
* @return {*}
|
||||
* @constructor
|
||||
*/
|
||||
DSS1: function (stringIn) {
|
||||
return gencryption.dss1.getHashOfTextSync.apply(this, [stringIn])
|
||||
},
|
||||
/**
|
||||
* MDC2 support
|
||||
* @param stringIn
|
||||
* @return {*}
|
||||
* @constructor
|
||||
*/
|
||||
MDC2: function (stringIn) {
|
||||
return gencryption.mdc2.getHashOfTextSync.apply(this, [stringIn]);
|
||||
},
|
||||
/**
|
||||
* BCrypt support
|
||||
* @param stringIn
|
||||
* @return {string|?string}
|
||||
*/
|
||||
bcrypt: function (stringIn) {
|
||||
return bcrypt.hashSync.apply(this, [stringIn, 10]);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* JSON linting!
|
||||
* @param json
|
||||
*/
|
||||
var jsonLint = function (json) {
|
||||
if (typeof json !== 'string') {
|
||||
return JSON.stringify(json, undefined, 4);
|
||||
} else {
|
||||
return jsonLint(JSON.parse(json));
|
||||
}
|
||||
return typeof json !== 'string' ? JSON.stringify(json, undefined, 4) : jsonLint(JSON.parse(json));
|
||||
};
|
||||
|
||||
|
||||
var hashShim = {
|
||||
/**
|
||||
* Returns hash, code, and type based on hashIn and separator
|
||||
* @param hashIn
|
||||
* @param separator
|
||||
* @param doHash
|
||||
* @return {{type: string, code: string, hash: string}}
|
||||
*/
|
||||
getHash: function (hashIn, separator, doHash) {
|
||||
getHash: function (hashIn, separator) {
|
||||
hashIn = typeof hashIn !== 'string' ? hasher.getHash() : hashIn;
|
||||
separator = typeof separator !== 'string' ? hasher.separator : separator;
|
||||
doHash = typeof doHash !== 'boolean' ? false : doHash;
|
||||
|
||||
var out = {
|
||||
'type': '',
|
||||
'code': '',
|
||||
'hash': ''
|
||||
var split = hashIn.split(separator, 3);
|
||||
|
||||
return {
|
||||
'type': typeof split[0] === 'string' ? split[0] : '',
|
||||
'code': typeof split[1] === 'string' ? atob(split[1]) : '',
|
||||
'hash': typeof split[2] === 'string' ? atob(split[2]) : ''
|
||||
};
|
||||
var split = hashIn.split(separator, 2);
|
||||
out.type = split[0];
|
||||
|
||||
if (doHash) {
|
||||
split = hashIn.split(separator, 3);
|
||||
out.hash = split[1];
|
||||
out.code = split[2];
|
||||
} else {
|
||||
out.code = split[1];
|
||||
}
|
||||
|
||||
if (typeof out.code === 'string') {
|
||||
out.code = atob(out.code);
|
||||
} else {
|
||||
out.code = '';
|
||||
}
|
||||
|
||||
return out;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -126,15 +226,13 @@ var hashShim = {
|
||||
* Calls hasher.setHash()
|
||||
*/
|
||||
setHash: function (path) {
|
||||
debug.type("setHash() in", arguments);
|
||||
debug.type("setHash() in", JSON.stringify(arguments));
|
||||
|
||||
// arguments[0]; // = type
|
||||
arguments[1] = btoa(arguments[1]); // = code/hash
|
||||
if (typeof arguments[2] !== 'undefined') {
|
||||
arguments[2] = btoa(arguments[2]); // code
|
||||
}
|
||||
arguments[1] = btoa(arguments[1]); // = code
|
||||
arguments[2] = typeof arguments[2] !== 'undefined' ? btoa(arguments[2]) : arguments[2]; // hash
|
||||
|
||||
debug.type("setHash() out", arguments);
|
||||
debug.type("setHash() out", JSON.stringify(arguments));
|
||||
|
||||
hasher.setHash.apply(this, arguments);
|
||||
},
|
||||
@@ -143,26 +241,216 @@ var hashShim = {
|
||||
* Calls hasher.replaceHash()
|
||||
*/
|
||||
replaceHash: function (path) {
|
||||
debug.type("replaceHash() in", arguments);
|
||||
debug.type("replaceHash() in", JSON.stringify(arguments));
|
||||
|
||||
// arguments[0]; // = type
|
||||
arguments[1] = btoa(arguments[1]); // = code/hash
|
||||
if (typeof arguments[2] !== 'undefined') {
|
||||
arguments[2] = btoa(arguments[2]); // code
|
||||
}
|
||||
arguments[1] = btoa(arguments[1]); // = code
|
||||
arguments[2] = typeof arguments[2] !== 'undefined' ? btoa(arguments[2]) : arguments[2]; // hash
|
||||
|
||||
debug.type("replaceHash() out", arguments);
|
||||
debug.type("replaceHash() out", JSON.stringify(arguments));
|
||||
|
||||
hasher.replaceHash.apply(this, arguments);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
var config = {
|
||||
_valid_tabs: [],
|
||||
html: {
|
||||
name: "HTML Linter",
|
||||
text: "HTML"
|
||||
},
|
||||
json: {
|
||||
name: "JSON Linter",
|
||||
text: "JSON"
|
||||
},
|
||||
xml: {
|
||||
name: "XML Linter",
|
||||
text: "XML"
|
||||
},
|
||||
css: {
|
||||
name: "CSS Linter",
|
||||
text: "CSS"
|
||||
},
|
||||
js: {
|
||||
name: "JS Linter",
|
||||
text: "JS"
|
||||
},
|
||||
sql: {
|
||||
name: "SQL Linter",
|
||||
text: "SQL"
|
||||
},
|
||||
encode_decode: {
|
||||
name: "Encode/Decode",
|
||||
text: "Encode/Decode",
|
||||
tabs: {
|
||||
urlencode: {
|
||||
name: "URL Encoder",
|
||||
text: "URLEncode"
|
||||
},
|
||||
urldecode: {
|
||||
name: "URL Decoder",
|
||||
text: "URLDecode"
|
||||
},
|
||||
base64encode: {
|
||||
name: "Base64 Encoder",
|
||||
text: "Base64Encode"
|
||||
},
|
||||
base64decode: {
|
||||
name: "Base64 Decoder",
|
||||
text: "Base64Decode"
|
||||
}
|
||||
}
|
||||
},
|
||||
hash_tools: {
|
||||
name: "Hash Tools",
|
||||
text: "Hash Tools",
|
||||
tabs: {
|
||||
md_hash: {
|
||||
name: "MD Hasher",
|
||||
text: "MD"
|
||||
},
|
||||
sha_hash: {
|
||||
name: "SHA Hasher",
|
||||
text: "SHA"
|
||||
},
|
||||
ripemd_hash: {
|
||||
name: "RIPEMD Hasher",
|
||||
text: "RIPEMD"
|
||||
},
|
||||
bcrypt_hash: {
|
||||
name: "BCrypt Hasher",
|
||||
text: "BCrypt"
|
||||
},
|
||||
keccak_hash: {
|
||||
name: "Keccak Hasher",
|
||||
text: "Keccak"
|
||||
},
|
||||
whirlpool_hash: {
|
||||
name: "Whirlpool Hasher",
|
||||
text: "Whirlpool"
|
||||
},
|
||||
dss1_hash: {
|
||||
name: "DSS1 Hasher",
|
||||
text: "DSS1"
|
||||
},
|
||||
mdc2_hash: {
|
||||
name: "MDC2 Hasher",
|
||||
text: "MDC2"
|
||||
}
|
||||
}
|
||||
},
|
||||
encryption_tools: {
|
||||
name: "Encryption Tools",
|
||||
text: "Encryption",
|
||||
tabs: {
|
||||
aes_enc: {
|
||||
name: "AES Encryption",
|
||||
text: "AES"
|
||||
},
|
||||
"3des_enc": {
|
||||
name: "Triple DES Encryption",
|
||||
text: "3-DES"
|
||||
},
|
||||
rc4_enc: {
|
||||
name: "RC-4 Encryption",
|
||||
text: "RC4"
|
||||
},
|
||||
rabbit_enc: {
|
||||
name: "Rabbit Encryption",
|
||||
text: "Rabbit"
|
||||
},
|
||||
evpkdf_enc: {
|
||||
name: "Evpkdf Encryption",
|
||||
text: "Evpkdf"
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var shim = {
|
||||
/**
|
||||
* Shim for d.gEBI();
|
||||
* @param id
|
||||
* @return {Element}
|
||||
*/
|
||||
element: function(id) {
|
||||
if (id.substring(0, 1) === '#') {
|
||||
id = id.substring(1);
|
||||
}
|
||||
return document.getElementById(id);
|
||||
}
|
||||
};
|
||||
|
||||
$('window').ready(function () {
|
||||
|
||||
// main I/O
|
||||
var input = $('#input');
|
||||
var output = $('#output');
|
||||
var navbar = $('#navbar').find('.nav');
|
||||
|
||||
Object.keys(config).forEach(function (key) {
|
||||
if (key[0] === '_') {
|
||||
return;
|
||||
}
|
||||
|
||||
var listItemID = key + '_tab';
|
||||
var linkID = key + '_link';
|
||||
|
||||
var listItem = $('<li />')
|
||||
.attr('id', listItemID)
|
||||
.attr('data-name', config[key].name)
|
||||
.attr('data-function', key);
|
||||
|
||||
var link = $('<a />')
|
||||
.attr('id', linkID)
|
||||
.attr('href', '#')
|
||||
.html(config[key].text)
|
||||
.appendTo(listItem);
|
||||
|
||||
navbar.append(listItem);
|
||||
|
||||
if (config[key].hasOwnProperty('tabs')) {
|
||||
|
||||
var tabs = config[key].tabs;
|
||||
|
||||
listItem.addClass('dropdown');
|
||||
|
||||
link.addClass('dropdown-toggle')
|
||||
.attr('role', 'button')
|
||||
.attr('aria-expanded', 'false')
|
||||
.attr('data-toggle', 'dropdown');
|
||||
|
||||
$('<span />')
|
||||
.addClass('caret')
|
||||
.appendTo(link);
|
||||
|
||||
var ul = $('<ul />')
|
||||
.addClass('dropdown-menu')
|
||||
.attr('role', 'menu');
|
||||
|
||||
Object.keys(tabs).forEach(function (k2) {
|
||||
var id2 = k2 + '_tab';
|
||||
|
||||
var li = $('<li />')
|
||||
.attr('id', id2)
|
||||
.attr('data-extra-highlight', listItemID)
|
||||
.attr('data-name', tabs[k2].name)
|
||||
.attr('data-function', k2)
|
||||
.appendTo(ul);
|
||||
|
||||
$('<a />')
|
||||
.attr('href', '#')
|
||||
.html(tabs[k2].text)
|
||||
.appendTo(li);
|
||||
|
||||
});
|
||||
listItem.append(ul);
|
||||
|
||||
new bsn.Dropdown(shim.element(linkID), {persist: true});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
/**
|
||||
* hasher page changer function
|
||||
@@ -171,46 +459,53 @@ $('window').ready(function () {
|
||||
*/
|
||||
var changeType = function (type, setHash) {
|
||||
setHash = typeof setHash !== 'boolean' ? true : setHash;
|
||||
debug.type('changeType()', 'setHash: ' + (setHash ? 'true' : 'false'));
|
||||
debug.type('changeType()', 'Start: ' + type + ' | setHash: ' + (setHash ? 'true' : 'false'));
|
||||
|
||||
var hash = hashShim.getHash();
|
||||
|
||||
switch (type) {
|
||||
case 'html':
|
||||
case 'xml':
|
||||
case 'json':
|
||||
case 'js':
|
||||
case 'css':
|
||||
case 'sql':
|
||||
case 'urlencode':
|
||||
case 'urldecode':
|
||||
case 'base64encode':
|
||||
case 'base64decode':
|
||||
debug.type('changeType()', 'type: ' + type);
|
||||
var exists = false;
|
||||
|
||||
$('#navbar').find('.active').removeClass('active');
|
||||
var tab = $('#' + type + '_tab');
|
||||
tab.addClass('active');
|
||||
|
||||
if (tab.data('extra-highlight') !== '') {
|
||||
$('#' + tab.data('extra-highlight')).addClass('active');
|
||||
}
|
||||
|
||||
$('#header').text(tab.data('name'));
|
||||
|
||||
if (setHash) {
|
||||
debug.type('changeType()', 'Calling hasher.sethash with {' + type + '} : {' + hash.code + '}');
|
||||
hashShim.setHash(type, hash.code);
|
||||
} else {
|
||||
debug.type('changeType()', 'Not calling hasher.sethash');
|
||||
}
|
||||
for (var key in config) {
|
||||
if (config.hasOwnProperty(type)) {
|
||||
exists = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
debug.type('changeType()', 'Default Case: Calling hasher.sethash with {html} : {' + hash.code + '}');
|
||||
hashShim.setHash('html', hash.code);
|
||||
}
|
||||
else if (config[key].hasOwnProperty('tabs') && config[key].tabs.hasOwnProperty(type)) {
|
||||
exists = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!exists) {
|
||||
debug.type('changeType()', 'Default Case: Calling hasher.sethash with {html} : {' + hash.code + '}');
|
||||
hashShim.setHash('html', hash.code);
|
||||
debug.type('changeType()', '----------End----------');
|
||||
return;
|
||||
}
|
||||
|
||||
debug.type('changeType()', 'type: ' + type);
|
||||
|
||||
// de-highlight currently highlighted tab
|
||||
navbar.find('.active').removeClass('active');
|
||||
|
||||
// add highlighting to active tab
|
||||
var tab = $('#' + type + '_tab');
|
||||
tab.addClass('active');
|
||||
|
||||
// if it's a sub tab this will be populated
|
||||
if (tab.data('extra-highlight') !== '') {
|
||||
$('#' + tab.data('extra-highlight')).addClass('active');
|
||||
}
|
||||
|
||||
$('#header').text(tab.data('name'));
|
||||
|
||||
if (setHash) {
|
||||
debug.type('changeType()', 'Calling hasher.sethash with {' + type + '} : {' + hash.code + '}');
|
||||
hashShim.setHash(type, hash.code);
|
||||
} else {
|
||||
debug.type('changeType()', 'Not calling hasher.sethash');
|
||||
}
|
||||
|
||||
debug.type('changeType()', '----------End----------');
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -231,34 +526,60 @@ $('window').ready(function () {
|
||||
}).catch(function (e) {
|
||||
debug.log(e);
|
||||
});
|
||||
stringOut = hljs.highlightAuto(beautify_html(code)).value;
|
||||
stringOut = hljs.highlight('html', beautify_html(code), true).value;
|
||||
break;
|
||||
case 'xml':
|
||||
stringOut = hljs.highlightAuto(beautify_xml(code)).value;
|
||||
stringOut = hljs.highlight('xml', beautify_xml(code), true).value;
|
||||
break;
|
||||
case 'json':
|
||||
stringOut = hljs.highlightAuto(jsonLint(code)).value;
|
||||
stringOut = hljs.highlight('json', jsonLint(code), true).value;
|
||||
break;
|
||||
case 'js':
|
||||
stringOut = hljs.highlightAuto(beautify_js(code)).value;
|
||||
stringOut = hljs.highlight('js', beautify_js(code), true).value;
|
||||
break;
|
||||
case 'css':
|
||||
stringOut = hljs.highlightAuto(beautify_css(code)).value;
|
||||
stringOut = hljs.highlight('css', beautify_css(code), true).value;
|
||||
break;
|
||||
case 'sql':
|
||||
stringOut = hljs.highlightAuto(beautify_sql.format(code)).value;
|
||||
stringOut = hljs.highlight('sql', beautify_sql.format(code), true).value;
|
||||
break;
|
||||
|
||||
case 'urlencode':
|
||||
stringOut = hljs.highlightAuto(encodeURIComponent(code)).value;
|
||||
stringOut = hljs.highlight('yaml', encodeURIComponent(code), true).value;
|
||||
break;
|
||||
case 'urldecode':
|
||||
stringOut = hljs.highlightAuto(decodeURIComponent(code)).value;
|
||||
stringOut = hljs.highlight('yaml', decodeURIComponent(code), true).value;
|
||||
break;
|
||||
case 'base64encode':
|
||||
stringOut = hljs.highlightAuto(btoa(code)).value;
|
||||
stringOut = hljs.highlight('yaml', btoa(code), true).value;
|
||||
break;
|
||||
case 'base64decode':
|
||||
stringOut = hljs.highlightAuto(atob(code)).value;
|
||||
stringOut = hljs.highlight('yaml', atob(code), true).value;
|
||||
break;
|
||||
|
||||
case 'md_hash':
|
||||
stringOut = hljs.highlight('yaml', cryptoShim.MD(5, code), true).value;
|
||||
break;
|
||||
case 'sha_hash':
|
||||
stringOut = hljs.highlight('yaml', cryptoShim.SHA(1, null, code, null), true).value;
|
||||
break;
|
||||
case 'ripemd_hash':
|
||||
stringOut = hljs.highlight('yaml', cryptoShim.RIPEMD(160, code), true).value;
|
||||
break;
|
||||
case 'keccak_hash':
|
||||
stringOut = hljs.highlight('yaml', cryptoShim.keccak(512, code), true).value;
|
||||
break;
|
||||
case 'whirlpool_hash':
|
||||
stringOut = hljs.highlight('yaml', cryptoShim.whirlpool(code), true).value;
|
||||
break;
|
||||
case 'dss1_hash':
|
||||
stringOut = hljs.highlight('yaml', cryptoShim.DSS1(code), true).value;
|
||||
break;
|
||||
case 'mdc2_hash':
|
||||
stringOut = hljs.highlight('yaml', cryptoShim.MDC2(code), true).value;
|
||||
break;
|
||||
case 'bcrypt_hash':
|
||||
stringOut = hljs.highlight('yaml', cryptoShim.bcrypt(code), true).value;
|
||||
break;
|
||||
}
|
||||
} catch (e) {
|
||||
@@ -297,14 +618,21 @@ $('window').ready(function () {
|
||||
hasher.init();
|
||||
|
||||
// hook into the navbar tabs and use hasher for them
|
||||
var navbar = $('#navbar');
|
||||
navbar.find('>ul>li:not(.dropdown)').click(function (e) {
|
||||
navbar.find('li:not(.dropdown)').click(function (e) {
|
||||
e.preventDefault();
|
||||
changeType(this.id.replace('_tab', ''));
|
||||
var t = $(this);
|
||||
var func = t.data('function');
|
||||
var dbinfo = {
|
||||
id: t.attr('id'),
|
||||
func: t.data('function')
|
||||
};
|
||||
debug.type('navbar.find()', 'fired! ' + JSON.stringify(dbinfo));
|
||||
changeType(func);
|
||||
});
|
||||
navbar.find('.dropdown>ul>li').click(function (e) {
|
||||
|
||||
$(".navbar-brand").click(function (e) {
|
||||
e.preventDefault();
|
||||
changeType(this.id.replace('_tab', ''));
|
||||
changeType('html');
|
||||
});
|
||||
|
||||
// function main ()
|
||||
|
||||
Reference in new issue
Block a user