Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

etab

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

etab - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

2

dist/github.js

@@ -1,1 +0,1 @@

!function(t){"use strict";function e(t){var e=t||{};this.settings={tabTagName:e.tabTagName||"span",tabClassName:e.tabClassName||"tab-char",indentClassName:e.indentClassName||"ident",tabIndentExtraSpace:8,tabSpaceMinWidth:e.tabSpaceMinWidth||"1em",styleId:e.styleId||"etab-style",styleRules:e.styleRules||[]}}function n(){for(var e=/^["'([{“‘]+$/,n=t.querySelectorAll(".highlight .p"),s=0;s<n.length;s++)e.test(n[s].textContent)&&n[s].classList.add("open");for(var a=t.querySelectorAll(".blob-wrapper"),s=0;s<a.length;s++)r.processLines(a[s].querySelectorAll(".blob-code"))}var s=" ",a=" ",i=3;e.prototype._addStyle=function(t){if(!t.getElementById(this.settings.styleId)){var e=t.createElement("style");e.id=this.settings.styleId,t.body.appendChild(e);var n=this.settings.tabTagName+"."+this.settings.tabClassName;e.sheet.insertRule(n+"{ display: inline-block; margin-right: "+this.settings.tabSpaceMinWidth+" }",0),this.settings.styleRules.forEach(function(t,n){e.sheet.insertRule(t,n+1)})}},e.prototype.testLines=function(t){for(var e=/[^\t]+\t/,n=!1,s=0,i=t.length;i>s;s++){var r=t[s].textContent;if(r.charAt(0)===a)return!1;if(e.test(r)){if(n)return!0;n=!0}else n=!1}return!1},e.prototype.processLines=function(t){function e(t,i){if(!(t>=a.length)){if(i>=a[t].length)return e(t+1,0);var r=s(t,i);if(r.aligned)return e(t,i+1);n(r),setTimeout(function(){e(t,i+1)})}}function n(t){var e=t.map(function(t){var e=t.getBoundingClientRect().right;return t.classList.contains(o.indentClassName)&&(e+=o.tabIndentExtraSpace),e}),n=Math.max.apply(null,e);t.forEach(function(t){t.style.width=n-t.getBoundingClientRect().right+"px"}),t.aligned=!0}function s(t,e){var n=[];if(t>=0&&t<a.length&&e>=0&&e<a[t].length){var s=l[t][e];if(s)return s;for(var i=t-1,r=t+1;i>=0&&e<a[i].length;)i--;for(;r<a.length&&e<a[r].length;)r++;for(var o=i+1;r>o;o++)n.push(a[o][e]),l[o][e]=n}return n}if(this.testLines(t)){this._addStyle(t[0].ownerDocument);for(var a=[],i=0,r=t.length;r>i;i++)this._wrapAllTabs(t[i]),a[i]=t[i].querySelectorAll(this.settings.tabTagName+"."+this.settings.tabClassName);var l=a.map(function(t){return new Array(t.length)}),o=this.settings;e(0,0)}},e.prototype._wrapAllTabs=function(t,e){if(void 0===e&&(e=!0),t.nodeType===i){for(var n;(n=t.wholeText.indexOf(s))>=0;){e&&n>0&&(e=!1);var a=t.splitText(n);t=a.splitText(1),this._wrapTab(a,e)}e&&t.wholeText.length>0&&(e=!1)}else if(!this._isTab(t))for(var r=t.firstChild;r;){var l=r.nextSibling;e=this._wrapAllTabs(r,e),r=l}return e},e.prototype._wrapTab=function(t,e){var n=t.ownerDocument.createElement(this.settings.tabTagName);return n.classList.add(this.settings.tabClassName),e&&n.classList.add(this.settings.indentClassName),t.parentNode.replaceChild(n,t),n.appendChild(t),n},e.prototype._isTab=function(t){return t.nodeName===this.settings.tabTagName&&t.classList.contains(this.settings.tabClassName)},e.prototype._wrapTabColumns=function(){};var r=new e({styleRules:[".blob-code { font-family: 'Input Serif Narrow', 'Georgia', serif; font-size: 1.167em; }",".highlight .p { color: #bbb; font-weight: lighter; }",".highlight span.tab-char + .open.p { position: absolute; transform: translateX(-100%); }"]});$(t).ready(n).on("pjax:success",n)}(document);
!function(t){"use strict";function e(t){var e=t||{};this.settings={tabTagName:e.tabTagName||"span",tabClassName:e.tabClassName||"tab-char",indentClassName:e.indentClassName||"ident",tabIndentExtraSpace:8,tabSpaceMinWidth:e.tabSpaceMinWidth||"1em",styleId:e.styleId||"etab-style",styleRules:e.styleRules||[]}}function n(){for(var e=/^["'([{“‘]+$/,n=t.querySelectorAll(".highlight .p"),a=0;a<n.length;a++)e.test(n[a].textContent)&&n[a].classList.add("open");for(var i=t.querySelectorAll(".blob-wrapper"),a=0;a<i.length;a++)s.processLines(i[a].querySelectorAll(".blob-code"))}e.prototype._addStyle=function(t){if(!t.getElementById(this.settings.styleId)){var e=t.createElement("style");e.id=this.settings.styleId,t.body.appendChild(e);var n=this.settings.tabTagName+"."+this.settings.tabClassName;e.sheet.insertRule(n+"{ display: inline-block; margin-right: "+this.settings.tabSpaceMinWidth+" }",0),this.settings.styleRules.forEach(function(t,n){e.sheet.insertRule(t,n+1)})}},e.prototype.testLines=function(t){for(var e=/[^\t]+\t/,n=!1,s=0,a=t.length;s<a;s++){var i=t[s].textContent;if(" "===i.charAt(0))return!1;if(e.test(i)){if(n)return!0;n=!0}else n=!1}return!1},e.prototype.processLines=function(t){function e(t,i){if(!(t>=a.length)){if(i>=a[t].length)return e(t+1,0);var r=s(t,i);if(r.aligned)return e(t,i+1);n(r),setTimeout(function(){e(t,i+1)})}}function n(t){var e=t.map(function(t){var e=t.getBoundingClientRect().right;return t.classList.contains(o.indentClassName)&&(e+=o.tabIndentExtraSpace),e}),n=Math.max.apply(null,e);t.forEach(function(t){t.style.width=n-t.getBoundingClientRect().right+"px"}),t.aligned=!0}function s(t,e){var n=[];if(t>=0&&t<a.length&&e>=0&&e<a[t].length){var s=l[t][e];if(s)return s;for(var i=t-1,r=t+1;i>=0&&e<a[i].length;)i--;for(;r<a.length&&e<a[r].length;)r++;for(var o=i+1;o<r;o++)n.push(a[o][e]),l[o][e]=n}return n}if(this.testLines(t)){this._addStyle(t[0].ownerDocument);for(var a=[],i=0,r=t.length;i<r;i++)this._wrapAllTabs(t[i]),a[i]=t[i].querySelectorAll(this.settings.tabTagName+"."+this.settings.tabClassName);var l=a.map(function(t){return new Array(t.length)}),o=this.settings;e(0,0)}},e.prototype._wrapAllTabs=function(t,e){if(void 0===e&&(e=!0),3===t.nodeType){for(var n;(n=t.wholeText.indexOf("\t"))>=0;){e&&n>0&&(e=!1);var s=t.splitText(n);t=s.splitText(1),this._wrapTab(s,e)}e&&t.wholeText.length>0&&(e=!1)}else if(!this._isTab(t))for(var a=t.firstChild;a;){var i=a.nextSibling;e=this._wrapAllTabs(a,e),a=i}return e},e.prototype._wrapTab=function(t,e){var n=t.ownerDocument.createElement(this.settings.tabTagName);return n.classList.add(this.settings.tabClassName),e&&n.classList.add(this.settings.indentClassName),t.parentNode.replaceChild(n,t),n.appendChild(t),n},e.prototype._isTab=function(t){return t.nodeName===this.settings.tabTagName&&t.classList.contains(this.settings.tabClassName)},e.prototype._wrapTabColumns=function(t){};var s=new e({styleRules:[".blob-code { font-family: 'Input Serif Narrow', 'Georgia', serif; font-size: 1.167em; }",".highlight .p { color: #bbb; font-weight: lighter; }",".highlight span.tab-char + .open.p { position: absolute; transform: translateX(-100%); }"]});ghImport("jquery").then(function(e){e(t).ready(n).on("pjax:success",n)})}(document);
// ==UserScript==
// @name github-etab
// @namespace https://github.com/hax/etab
// @version 0.7
// @version 0.8
// @description Support elastic tabstops for github.com

@@ -9,3 +9,3 @@ // @match https://github.com/*

// @downloadURL https://raw.githubusercontent.com/hax/etab/master/dist/github.user.js
// @copyright 2014, Hax
// @copyright 2014-2017, Hax
// ==/UserScript==
// ==UserScript==
// @name github-etab
// @namespace https://github.com/hax/etab
// @version 0.7
// @version 0.8
// @description Support elastic tabstops for github.com

@@ -9,4 +9,4 @@ // @match https://github.com/*

// @downloadURL https://raw.githubusercontent.com/hax/etab/master/dist/github.user.js
// @copyright 2014, Hax
// @copyright 2014-2017, Hax
// ==/UserScript==
!function(t){"use strict";function e(t){var e=t||{};this.settings={tabTagName:e.tabTagName||"span",tabClassName:e.tabClassName||"tab-char",indentClassName:e.indentClassName||"ident",tabIndentExtraSpace:8,tabSpaceMinWidth:e.tabSpaceMinWidth||"1em",styleId:e.styleId||"etab-style",styleRules:e.styleRules||[]}}function n(){for(var e=/^["'([{“‘]+$/,n=t.querySelectorAll(".highlight .p"),s=0;s<n.length;s++)e.test(n[s].textContent)&&n[s].classList.add("open");for(var a=t.querySelectorAll(".blob-wrapper"),s=0;s<a.length;s++)r.processLines(a[s].querySelectorAll(".blob-code"))}var s=" ",a=" ",i=3;e.prototype._addStyle=function(t){if(!t.getElementById(this.settings.styleId)){var e=t.createElement("style");e.id=this.settings.styleId,t.body.appendChild(e);var n=this.settings.tabTagName+"."+this.settings.tabClassName;e.sheet.insertRule(n+"{ display: inline-block; margin-right: "+this.settings.tabSpaceMinWidth+" }",0),this.settings.styleRules.forEach(function(t,n){e.sheet.insertRule(t,n+1)})}},e.prototype.testLines=function(t){for(var e=/[^\t]+\t/,n=!1,s=0,i=t.length;i>s;s++){var r=t[s].textContent;if(r.charAt(0)===a)return!1;if(e.test(r)){if(n)return!0;n=!0}else n=!1}return!1},e.prototype.processLines=function(t){function e(t,i){if(!(t>=a.length)){if(i>=a[t].length)return e(t+1,0);var r=s(t,i);if(r.aligned)return e(t,i+1);n(r),setTimeout(function(){e(t,i+1)})}}function n(t){var e=t.map(function(t){var e=t.getBoundingClientRect().right;return t.classList.contains(o.indentClassName)&&(e+=o.tabIndentExtraSpace),e}),n=Math.max.apply(null,e);t.forEach(function(t){t.style.width=n-t.getBoundingClientRect().right+"px"}),t.aligned=!0}function s(t,e){var n=[];if(t>=0&&t<a.length&&e>=0&&e<a[t].length){var s=l[t][e];if(s)return s;for(var i=t-1,r=t+1;i>=0&&e<a[i].length;)i--;for(;r<a.length&&e<a[r].length;)r++;for(var o=i+1;r>o;o++)n.push(a[o][e]),l[o][e]=n}return n}if(this.testLines(t)){this._addStyle(t[0].ownerDocument);for(var a=[],i=0,r=t.length;r>i;i++)this._wrapAllTabs(t[i]),a[i]=t[i].querySelectorAll(this.settings.tabTagName+"."+this.settings.tabClassName);var l=a.map(function(t){return new Array(t.length)}),o=this.settings;e(0,0)}},e.prototype._wrapAllTabs=function(t,e){if(void 0===e&&(e=!0),t.nodeType===i){for(var n;(n=t.wholeText.indexOf(s))>=0;){e&&n>0&&(e=!1);var a=t.splitText(n);t=a.splitText(1),this._wrapTab(a,e)}e&&t.wholeText.length>0&&(e=!1)}else if(!this._isTab(t))for(var r=t.firstChild;r;){var l=r.nextSibling;e=this._wrapAllTabs(r,e),r=l}return e},e.prototype._wrapTab=function(t,e){var n=t.ownerDocument.createElement(this.settings.tabTagName);return n.classList.add(this.settings.tabClassName),e&&n.classList.add(this.settings.indentClassName),t.parentNode.replaceChild(n,t),n.appendChild(t),n},e.prototype._isTab=function(t){return t.nodeName===this.settings.tabTagName&&t.classList.contains(this.settings.tabClassName)},e.prototype._wrapTabColumns=function(){};var r=new e({styleRules:[".blob-code { font-family: 'Input Serif Narrow', 'Georgia', serif; font-size: 1.167em; }",".highlight .p { color: #bbb; font-weight: lighter; }",".highlight span.tab-char + .open.p { position: absolute; transform: translateX(-100%); }"]});$(t).ready(n).on("pjax:success",n)}(document);
!function(t){"use strict";function e(t){var e=t||{};this.settings={tabTagName:e.tabTagName||"span",tabClassName:e.tabClassName||"tab-char",indentClassName:e.indentClassName||"ident",tabIndentExtraSpace:8,tabSpaceMinWidth:e.tabSpaceMinWidth||"1em",styleId:e.styleId||"etab-style",styleRules:e.styleRules||[]}}function n(){for(var e=/^["'([{“‘]+$/,n=t.querySelectorAll(".highlight .p"),a=0;a<n.length;a++)e.test(n[a].textContent)&&n[a].classList.add("open");for(var i=t.querySelectorAll(".blob-wrapper"),a=0;a<i.length;a++)s.processLines(i[a].querySelectorAll(".blob-code"))}e.prototype._addStyle=function(t){if(!t.getElementById(this.settings.styleId)){var e=t.createElement("style");e.id=this.settings.styleId,t.body.appendChild(e);var n=this.settings.tabTagName+"."+this.settings.tabClassName;e.sheet.insertRule(n+"{ display: inline-block; margin-right: "+this.settings.tabSpaceMinWidth+" }",0),this.settings.styleRules.forEach(function(t,n){e.sheet.insertRule(t,n+1)})}},e.prototype.testLines=function(t){for(var e=/[^\t]+\t/,n=!1,s=0,a=t.length;s<a;s++){var i=t[s].textContent;if(" "===i.charAt(0))return!1;if(e.test(i)){if(n)return!0;n=!0}else n=!1}return!1},e.prototype.processLines=function(t){function e(t,i){if(!(t>=a.length)){if(i>=a[t].length)return e(t+1,0);var r=s(t,i);if(r.aligned)return e(t,i+1);n(r),setTimeout(function(){e(t,i+1)})}}function n(t){var e=t.map(function(t){var e=t.getBoundingClientRect().right;return t.classList.contains(o.indentClassName)&&(e+=o.tabIndentExtraSpace),e}),n=Math.max.apply(null,e);t.forEach(function(t){t.style.width=n-t.getBoundingClientRect().right+"px"}),t.aligned=!0}function s(t,e){var n=[];if(t>=0&&t<a.length&&e>=0&&e<a[t].length){var s=l[t][e];if(s)return s;for(var i=t-1,r=t+1;i>=0&&e<a[i].length;)i--;for(;r<a.length&&e<a[r].length;)r++;for(var o=i+1;o<r;o++)n.push(a[o][e]),l[o][e]=n}return n}if(this.testLines(t)){this._addStyle(t[0].ownerDocument);for(var a=[],i=0,r=t.length;i<r;i++)this._wrapAllTabs(t[i]),a[i]=t[i].querySelectorAll(this.settings.tabTagName+"."+this.settings.tabClassName);var l=a.map(function(t){return new Array(t.length)}),o=this.settings;e(0,0)}},e.prototype._wrapAllTabs=function(t,e){if(void 0===e&&(e=!0),3===t.nodeType){for(var n;(n=t.wholeText.indexOf("\t"))>=0;){e&&n>0&&(e=!1);var s=t.splitText(n);t=s.splitText(1),this._wrapTab(s,e)}e&&t.wholeText.length>0&&(e=!1)}else if(!this._isTab(t))for(var a=t.firstChild;a;){var i=a.nextSibling;e=this._wrapAllTabs(a,e),a=i}return e},e.prototype._wrapTab=function(t,e){var n=t.ownerDocument.createElement(this.settings.tabTagName);return n.classList.add(this.settings.tabClassName),e&&n.classList.add(this.settings.indentClassName),t.parentNode.replaceChild(n,t),n.appendChild(t),n},e.prototype._isTab=function(t){return t.nodeName===this.settings.tabTagName&&t.classList.contains(this.settings.tabClassName)},e.prototype._wrapTabColumns=function(t){};var s=new e({styleRules:[".blob-code { font-family: 'Input Serif Narrow', 'Georgia', serif; font-size: 1.167em; }",".highlight .p { color: #bbb; font-weight: lighter; }",".highlight span.tab-char + .open.p { position: absolute; transform: translateX(-100%); }"]});ghImport("jquery").then(function(e){e(t).ready(n).on("pjax:success",n)})}(document);
{
"name": "etab",
"version": "0.0.3",
"description": "",
"main": "index.js",
"directories": {
"test": "test"
},
"version": "0.0.4",
"description": "Elastic Tabstops",
"main": "dist/index.js",
"files": ["dist", "src"],
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"dist": "cp src/github.meta.js dist; uglifyjs src/index.js src/github.js -o dist/github.js -e document:document -mc --inline-script && uglifyjs --comments all dist/github.meta.js dist/github.js -o dist/github.user.js",
"prepublish": "npm run dist"
"prepare": "cp src/github.meta.js dist; uglifyjs src/index.js src/github.js -o dist/github.js -e document:document -mc --inline-script && uglifyjs --comments all dist/github.meta.js dist/github.js -o dist/github.user.js"
},

@@ -32,4 +29,4 @@ "repository": {

"devDependencies": {
"uglify-js": "^2.4.15"
"uglify-js": "^2.8.27"
}
}

@@ -18,3 +18,2 @@ # Elastic Tabstops JavaScript Implementation for Browsers

* https://github.com/hax/etab/blob/master/src/github-head.js
* https://github.com/hax/haojing/blob/elastic-tabstops/htdocs/index.php
* https://github.com/hax/etab/blob/master/example/hanging-punc.js

@@ -42,2 +41,2 @@

- [x] support diff view
- [ ] only process the code block that use elastic tabstops
- [x] only process the code block that use elastic tabstops

@@ -15,3 +15,3 @@ var etab = new ElasticTabstops({

}
var blobs = document.querySelectorAll('.blob-wrapper')

@@ -23,2 +23,4 @@ for (var i = 0; i < blobs.length; i++) {

$(document).ready(process).on('pjax:success', process)
ghImport('jquery').then(function($) {
$(document).ready(process).on('pjax:success', process)
})
// ==UserScript==
// @name github-etab
// @namespace https://github.com/hax/etab
// @version 0.7
// @version 0.8
// @description Support elastic tabstops for github.com

@@ -9,3 +9,3 @@ // @match https://github.com/*

// @downloadURL https://raw.githubusercontent.com/hax/etab/master/dist/github.user.js
// @copyright 2014, Hax
// @copyright 2014-2017, Hax
// ==/UserScript==
'use strict'
var TAB = '\t'
var SPACE = ' '
var SPACE = ' '
var TEXT_NODE = 3

@@ -6,0 +6,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc