This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// trim long text | |
function trimText(text, maxlength, ellipsis) { | |
var output = '', | |
i = 0; | |
if (text.length >= maxlength) { | |
ellipsis = ellipsis || '…'; | |
text = text.split(' '); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// converts HTML to text using Javascript | |
function html2text(html) { | |
var tag = document.createElement('div'); | |
tag.innerHTML = html; | |
return tag.innerText; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.disabletextselect() { | |
-webkit-touch-callout: none; | |
-webkit-user-select: none; | |
-khtml-user-select: none; | |
-moz-user-select: none; | |
-ms-user-select: none; | |
user-select: none; | |
} | |
.handcursor() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Detect page change / auto refresh | |
$(document).ready(function() { | |
var currenthtml; | |
var latesthtml; | |
$.get(window.location.href, function(data) { | |
currenthtml = data; | |
latesthtml = data; | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function loadCSS(css) { | |
var styleElement = document.createElement("style"); | |
styleElement.type = "text/css"; | |
if (styleElement.styleSheet) { | |
styleElement.styleSheet.cssText = css; | |
} else { | |
styleElement.appendChild(document.createTextNode(css)); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* remember putting / caching element in variable is faster */ | |
/* select id with pure javascript, element by id is faster */ | |
var bar = document.getElementById("bar"); | |
var $el = document.querySelector('#hello'); | |
/* select tag with pure javascript */ | |
var $el = document.querySelector('.bye'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.hide-text { | |
text-indent: 100%; | |
white-space: nowrap; | |
overflow: hidden; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-webkit-touch-callout: none; | |
-webkit-user-select: none; | |
-khtml-user-select: none; | |
-moz-user-select: none; | |
-ms-user-select: none; | |
user-select: none; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
orem ipsum dolor sit amet, consectetur adipiscing elit. Etiam feugiat iaculis odio, sit amet gravida est suscipit vitae. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Donec rutrum, odio blandit malesuada facilisis, nibh nisl varius lacus, vitae pulvinar eros purus tincidunt enim. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Mauris varius mauris sed tellus volutpat pharetra. Duis porta fringilla justo, non suscipit ipsum pretium eu. Morbi consequat dapibus massa eget tempor. Curabitur sed velit nec dolor elementum facilisis. In hac habitasse platea dictumst. Cras vitae justo nec purus iaculis congue. Integer consequat arcu vel ipsum hendrerit facilisis. Sed bibendum diam vitae nulla tincidunt interdum. Maecenas sagittis ligula at ipsum scelerisque a dictum erat pharetra. Cras faucibus gravida vulputate. | |
Ut eleifend, lectus non viverra dapibus, quam erat dignissim diam, sed porta mauris velit vitae felis. Morbi sit amet ma |
NewerOlder