angular-overflow-tracking
Advanced tools
Comparing version 0.0.4 to 1.0.1
@@ -1,1 +0,1 @@ | ||
!function(e){function t(r){if(o[r])return o[r].exports;var n=o[r]={exports:{},id:r,loaded:!1};return e[r].call(n.exports,n,n.exports,t),n.loaded=!0,n.exports}var o={};return t.m=e,t.c=o,t.p="/bundle/",t(0)}([function(e,t,o){"use strict";function r(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t.default=e,t}function n(e){return e&&e.__esModule?e:{default:e}}var i=o(6),l=n(i),d=o(8),a=r(d);angular.module(a.moduleName,[]).directive(a.directiveName,l.default)},,,,,,function(e,t,o){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function n(e,t,o){var r=window.getComputedStyle(e,null);return"hidden"!==r.getPropertyValue("overflow")&&(e.style.overflow="hidden"),0===parseInt(r.getPropertyValue("height"))&&console.warn("height === 0 for "+e.className,e),o?new s.default(e,t,o):new s.default(e,t)}function i(e){var t=getComputedStyle(e,null).getPropertyValue("background-color");return"rgba(0, 0, 0, 0)"===t&&e.parentNode?i(e.parentNode):e.parentNode?t:(console.warn("not define background-image"),"rgba(255,255,255,1)")}function l(e){var t=document.createElement("span");t.innerHTML="t",t.style.display="inline-block",e.appendChild(t);var o=t.getBoundingClientRect().height;return e.removeChild(t),o}function d(e,t,o){!o||o<0&&o>1?o=.2:null,t=t||"hor";var r=l(e),n=window.getComputedStyle(e,null);"hidden"!==n.getPropertyValue("overflow")&&(e.style.overflow="hidden"),"static"===n.getPropertyValue("position")&&(e.style.position="relative");var d=document.createElement("div");d.className="ot-gradient",d.style.position="absolute";var a=i(e);if(console.log(a),"hor"===t){var s=n.getPropertyValue("padding-bottom");d.style.bottom=s,d.style.right="0px",d.style.height=r+"px",d.style.width=Math.ceil(e.offsetWidth*o)+"px",d.style.backgroundImage="linear-gradient(to left, "+a+" 0%,"+a+" 60%,rgba(0,0,0,0) 100%)"}else d.style.bottom="0px",d.style.right="0px",d.style.left="0px",d.style.height=Math.ceil(e.offsetHeight*o)+"px",d.style.backgroundImage="linear-gradient(to top, "+a+" 0%,"+a+" 60%,rgba(0,0,0,0) 100%)";return e.appendChild(d),{el:d,destroy:function(){this.el.parentNode.removeChild(this.el)}}}Object.defineProperty(t,"__esModule",{value:!0});var a=o(7),s=r(a),c=o(8);t.default=function(){return{scope:{addedWord:"@",container:"@",resize:"@",position:"@",size:"@"},restrict:"A",controller:["$scope","$element","$attrs","$timeout",function(e,t,o,r){"ngInject";r(function(){var r=o[c.directiveName];switch(r){case"html":var i;i=e.container?n(t[0],t[0].querySelector(e.container),e.addedWord):n(t[0],t[0],e.addedWord);var l;e.resize=+e.resize||0;var a=function(){clearTimeout(l),l=setTimeout(function(){i.refresh()},e.resize)};e.resize&&window.addEventListener("resize",a),e.$on("$destroy",function(){i.destroy(),window.removeEventListener("resize",a)});break;case"gradient":"ver"!==e.position?e.position="hor":null,e.size?d(t[0],e.position,+e.size):d(t[0],e.position)}t.addClass("is-tracking")})}]}}},function(e,t){"use strict";function o(e,t,o){function r(){l.deleteUnnecessaryHtml(e,t),l.addedNode&&l.addNode(e,t,l.addedNode)}function n(){t.innerHTML="",i(),r()}function i(){for(var e=0;e<l.originalHtml.childNodes.length;e++)t.appendChild(l.originalHtml.childNodes[e].cloneNode(!0))}var l=this;this.addedNode=!!o&&document.createTextNode(" "+o),t=t||e,this.originalHtml=t.cloneNode(!0),this.trackingElem=e,this.container=t,this.destroy=function(){t.innerHTML="",i()},this.refresh=function(){n()},r()}Object.defineProperty(t,"__esModule",{value:!0}),o.prototype.deleteLastWord=function(e){return e.replace(/\s*\S+\s*$/,"")},o.prototype.deletingLastWords=function(e){for(;this.trackingElem.scrollHeight-this.trackingElem.offsetHeight>0&&e.textContent;)e.textContent=this.deleteLastWord(e.textContent);return e.textContent},o.prototype.cutTextByLastWord=function(e){var t=e.lastChild;if(t)switch(t.nodeType){case 1:t.childNodes.length?this.cutTextByLastWord(t):t.parentNode.removeChild(t);break;case 3:if(t.textContent.replace(/\s*/,"")){var o=this.deletingLastWords(t);""===o&&1===e.childNodes.length&&e.parentNode.removeChild(e)}else t.parentNode.removeChild(t);break;case 8:t.parentNode.removeChild(t)}},o.prototype.cutTextByLastWordStatic=function(e){var t=e.lastChild;if(t)switch(t.nodeType){case 1:t.childNodes.length?this.cutTextByLastWordStatic(t):t.parentNode.removeChild(t);break;case 3:if(t.textContent.replace(/\s*/,"")){var o=this.deleteLastWord(t.textContent);t.textContent=o,""===o&&1===e.childNodes.length&&e.parentNode.removeChild(e)}else t.parentNode.removeChild(t);break;case 8:t.parentNode.removeChild(t)}},o.prototype.deleteUnnecessaryHtml=function(e,t){for(;e.scrollHeight-e.offsetHeight>0&&t.lastChild;)this.cutTextByLastWord(t);t.lastChild?e.classList.remove("is-empty"):e.classList.add("is-empty")},o.prototype.toString=function(){return this.trackingElem.textContent},o.prototype.valueOf=function(){return this.trackingElem.textContent.length},o.prototype.addNode=function(e,t,o){for(t.appendChild(o);e.scrollHeight-e.offsetHeight>0&&t.childNodes.length>1;)t.removeChild(o),this.cutTextByLastWordStatic(t),t.appendChild(o);e.scrollHeight-e.offsetHeight>0&&1===t.childNodes.length&&t.removeChild(o)};var r={enumerable:!1,configurable:!1,writable:!1};for(var n in o.prototype)"function"==typeof o.prototype[n]&&Object.defineProperty(o.prototype,n,r);t.default=o},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.moduleName="overflow-tracking",t.directiveName="overflowTracking"}]); | ||
!function(e){function t(r){if(o[r])return o[r].exports;var n=o[r]={exports:{},id:r,loaded:!1};return e[r].call(n.exports,n,n.exports,t),n.loaded=!0,n.exports}var o={};return t.m=e,t.c=o,t.p="/bundle/",t(0)}([function(e,t,o){"use strict";function r(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t.default=e,t}function n(e){return e&&e.__esModule?e:{default:e}}var i=o(6),d=n(i),l=o(8),a=r(l);angular.module(a.moduleName,[]).directive(a.directiveName,d.default)},,,,,,function(e,t,o){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function n(e,t,o){var r=window.getComputedStyle(e,null);return"hidden"!==r.getPropertyValue("overflow")&&(e.style.overflow="hidden"),0===parseInt(r.getPropertyValue("height"))&&console.warn("height === 0 for "+e.className,e),o?new s.default(e,t,o):new s.default(e,t)}function i(e){var t=getComputedStyle(e,null).getPropertyValue("background-color");return"rgba(0, 0, 0, 0)"===t&&e.parentNode?i(e.parentNode):e.parentNode?t:(console.warn("not define background-image"),"rgba(255,255,255,1)")}function d(e){var t=document.createElement("span");t.innerHTML="t",t.style.display="inline-block",e.appendChild(t);var o=t.getBoundingClientRect().height;return e.removeChild(t),o}function l(e,t,o){!o||o<0&&o>1?o=.2:null,t=t||"hor";var r=d(e),n=window.getComputedStyle(e,null);"hidden"!==n.getPropertyValue("overflow")&&(e.style.overflow="hidden"),"static"===n.getPropertyValue("position")&&(e.style.position="relative");var l=document.createElement("div");l.className="ot-gradient",l.style.position="absolute";var a=i(e);if("hor"===t){var s=n.getPropertyValue("padding-bottom");l.style.bottom=s,l.style.right="0px",l.style.height=r+"px",l.style.width=Math.ceil(e.offsetWidth*o)+"px",l.style.backgroundImage="linear-gradient(to left, "+a+" 0%,"+a+" 60%,rgba(0,0,0,0) 100%)"}else l.style.bottom="0px",l.style.right="0px",l.style.left="0px",l.style.height=Math.ceil(e.offsetHeight*o)+"px",l.style.backgroundImage="linear-gradient(to top, "+a+" 0%,"+a+" 60%,rgba(0,0,0,0) 100%)";return e.appendChild(l),{el:l,destroy:function(){this.el.parentNode.removeChild(this.el)}}}Object.defineProperty(t,"__esModule",{value:!0});var a=o(7),s=r(a),c=o(8);t.default=function(){return{scope:{addedWord:"@",container:"@",resize:"@",position:"@",size:"@"},restrict:"A",controller:["$scope","$element","$attrs","$timeout",function(e,t,o,r){"ngInject";r(function(){var r=o[c.directiveName];switch(r){case"html":var i;i=e.container?n(t[0],t[0].querySelector(e.container),e.addedWord):n(t[0],t[0],e.addedWord);var d;e.resize=+e.resize||100;var a=function(){clearTimeout(d),d=setTimeout(function(){i.refresh()},e.resize)};0!==+e.resize&&window.addEventListener("resize",a),e.$on("$destroy",function(){i.destroy(),window.removeEventListener("resize",a)});break;case"gradient":"ver"!==e.position?e.position="hor":null,e.size?l(t[0],e.position,+e.size):l(t[0],e.position)}t.addClass("is-tracking")})}]}}},function(e,t){"use strict";function o(e,t,o){function r(){d.deleteUnnecessaryHtml(e,t),d.addedNode&&d.addNode(e,t,d.addedNode)}function n(){t.innerHTML="",i(),r()}function i(){for(var e=0;e<d.originalHtml.childNodes.length;e++)t.appendChild(d.originalHtml.childNodes[e].cloneNode(!0))}var d=this;this.addedNode=!!o&&document.createTextNode(" "+o),t=t||e,this.originalHtml=t.cloneNode(!0),this.trackingElem=e,this.container=t,this.destroy=function(){t.innerHTML="",i()},this.refresh=function(){n()},r()}Object.defineProperty(t,"__esModule",{value:!0}),o.prototype.deleteLastWord=function(e){return e.replace(/\s*\S+\s*$/,"")},o.prototype.deletingLastWords=function(e){for(;this.trackingElem.scrollHeight-this.trackingElem.offsetHeight>0&&e.textContent;)e.textContent=this.deleteLastWord(e.textContent);return e.textContent},o.prototype.cutTextByLastWord=function(e){var t=e.lastChild;if(t)switch(t.nodeType){case 1:t.childNodes.length?this.cutTextByLastWord(t):t.parentNode.removeChild(t);break;case 3:if(t.textContent.replace(/\s*/,"")){var o=this.deletingLastWords(t);""===o&&1===e.childNodes.length&&e.parentNode.removeChild(e)}else t.parentNode.removeChild(t);break;case 8:t.parentNode.removeChild(t)}},o.prototype.cutTextByLastWordStatic=function(e){var t=e.lastChild;if(t)switch(t.nodeType){case 1:t.childNodes.length?this.cutTextByLastWordStatic(t):t.parentNode.removeChild(t);break;case 3:if(t.textContent.replace(/\s*/,"")){var o=this.deleteLastWord(t.textContent);t.textContent=o,""===o&&1===e.childNodes.length&&e.parentNode.removeChild(e)}else t.parentNode.removeChild(t);break;case 8:t.parentNode.removeChild(t)}},o.prototype.deleteUnnecessaryHtml=function(e,t){for(;e.scrollHeight-e.offsetHeight>0&&t.lastChild;)this.cutTextByLastWord(t);t.lastChild?e.classList.remove("is-empty"):e.classList.add("is-empty")},o.prototype.toString=function(){return this.trackingElem.textContent},o.prototype.valueOf=function(){return this.trackingElem.textContent.length},o.prototype.addNode=function(e,t,o){for(t.appendChild(o);e.scrollHeight-e.offsetHeight>0&&t.childNodes.length>1;)t.removeChild(o),this.cutTextByLastWordStatic(t),t.appendChild(o);e.scrollHeight-e.offsetHeight>0&&1===t.childNodes.length&&t.removeChild(o)};var r={enumerable:!1,configurable:!1,writable:!1};for(var n in o.prototype)"function"==typeof o.prototype[n]&&Object.defineProperty(o.prototype,n,r);t.default=o},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.moduleName="overflow-tracking",t.directiveName="overflowTracking"}]); |
require('./bundle/js/overflow-tracking.js'); | ||
//module.exports = angular; | ||
//module.exports = overflowTracking; |
@@ -18,3 +18,2 @@ import HtmlOverflowTracking from '../classes/HtmlOverflowTracking.cls'; | ||
} | ||
} | ||
@@ -62,3 +61,3 @@ function getBackground(element){ | ||
var bg = getBackground(element); | ||
console.log(bg); | ||
if(position==='hor'){ | ||
@@ -105,3 +104,3 @@ var bottom = elementStyle.getPropertyValue('padding-bottom'); | ||
case 'html': | ||
//onsole.time('initHot'); | ||
//console.time('initHot'); | ||
var hot; | ||
@@ -114,3 +113,3 @@ if($scope.container){ | ||
var timeout; | ||
$scope.resize = +$scope.resize || 0; | ||
$scope.resize = +$scope.resize || 100; | ||
var refresh = function(){ | ||
@@ -122,3 +121,3 @@ clearTimeout(timeout); | ||
}; | ||
if($scope.resize){ | ||
if(+$scope.resize!==0){ | ||
window.addEventListener('resize',refresh); | ||
@@ -125,0 +124,0 @@ } |
{ | ||
"name": "angular-overflow-tracking", | ||
"version": "0.0.4", | ||
"version": "1.0.1", | ||
"description": "directive tracks the container overflows", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
31
2
1
71
167199
396