This file contains 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
<main> | |
<h1 data-middle-ellipsis>A Javascript solution to middle ellipsis</h1> | |
<div data-middle-ellipsis>The quick fox</div> | |
<div data-middle-ellipsis class="inline-block">The lazy dog</div> | |
<div data-middle-ellipsis>theQuickBrownFoxJumpsOverTheLazyDog</div> | |
<div data-middle-ellipsis class="bold">The quick brown fox jumps over the lazy dog</div> | |
<div data-middle-ellipsis class="small">The quick brown fox jumps over the lazy dog</div> | |
<div data-middle-ellipsis class="small bold">The quick brown fox jumps over the lazy dog</div> | |
<div data-middle-ellipsis class="large">The quick brown fox jumps over the lazy dog</div> | |
<div data-middle-ellipsis>The quick brown fox jumps over the lazy dog</div> |
This file contains 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
<html> | |
<head> | |
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> | |
</head> | |
<body> | |
<main> | |
<section data-in-view> | |
<h3>consectetur</h3> | |
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Amet consequatur consequuntur dolores praesentium quisquam saepe, ut. Adipisci alias commodi consequuntur enim, expedita iusto magni officiis pariatur repellat, sequi temporibus totam.</p> | |
</section> |
This file contains 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 querySelectorParents(elm,selector){ | |
var result; | |
while ((elm=elm.parentNode)&&elm!==document) { | |
if (elm.matches(selector)) { | |
result = elm; | |
break; | |
} | |
} | |
return result; | |
} |
This file contains 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
/** | |
* Get a random lorem ipsum string | |
* Set prng by using getLorem.setPrng(lcg) | |
* @param words | |
* @param sentences | |
* @param paragraphs | |
* @returns {string} | |
*/ | |
var getLorem = (function(){ | |
var loremList = 'a et at in mi ac id eu ut non dis cum sem dui nam sed est nec sit mus vel leo urna duis quam cras nibh enim quis arcu orci diam nisi nisl nunc elit odio amet eget ante erat eros ipsum morbi nulla neque vitae purus felis justo massa donec metus risus curae dolor etiam fusce lorem augue magna proin mauris nullam rutrum mattis libero tellus cursus lectus varius auctor sociis ornare magnis turpis tortor semper dictum primis ligula mollis luctus congue montes vivamus aliquam integer quisque feugiat viverra sodales gravida laoreet pretium natoque iaculis euismod posuere blandit egestas dapibus cubilia pulvinar bibendum faucibus lobortis ultrices interdum maecenas accumsan vehicula nascetur molestie sagittis eleifend facilisi suscipit volutpat venenatis fringilla elementum tristique penatibus porttitor imperdi |
This file contains 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
/** | |
* An example of protected methods and prototypal inheritance | |
* @requires lodash | |
* @param {string} name Call it something | |
* @param {object} extend An object with functions to override | |
* @returns {object} | |
*/ | |
var baseFoo = (function(){ | |
var basePrototype = { | |
protectedMethod: protectedMethod |
This file contains 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
/** | |
* Implementation of a linear congruential generator.<br/> | |
* The linear congruential generator follows this formula: x=(a*x+c)%n where a=multiplier, c=increment and m=modulus.<br/> | |
* Multiplier, increment and modulus can be set separately or via one of the presets.<br/> | |
* By default the Lehmer prng is used. | |
* @summary Linear congruential generator | |
*/ | |
var lcg = (function(){ | |
'use strict'; | |
var iMultiplier = 48271 |
This file contains 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
/*global requestAnimFrame*/ | |
/**! | |
* Krpano simplexIdle plugin | |
* The simplexIdle plugin uses Simplex noise to look around and zoom when the panorama is idle. The movement is random but not as random as Brownian motion. Simplex noise, like Perlin noise, interpolates between random numbers. The result is a motion that could be perceived as life-like. | |
* Additional copyrights and acknowlegdements: | |
* - Simplex noise: Stefan Gustavson, Sean McCullough, Karsten Schmidt, Ron Valstar | |
* - requestAnimFrame: Paul Irish, mr Doob | |
* @summary Idle panoramas move around randomly. | |
* @name simplexIdle | |
* @version 1.1.4 |
This file contains 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
/*global signals, CSSMediaRule*/ | |
window.breakPoints = (function(signal){ | |
'use strict'; | |
window.addEventListener('load',function(){ | |
var forEach = Array.prototype.forEach | |
,aSizes = [Number.MAX_VALUE] | |
,iSizes | |
,iCurrent = -1 | |
; | |
// loop styleSheets, then cssRules, then media |
This file contains 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
/** | |
* Manipulate existing stylesheets. | |
* @name rootStyle | |
*/ | |
window.rootStyle = (function() { | |
'use strict'; | |
// StyleSheet.addRule shim | |
if (document.styleSheets[0].addRule===undefined) { | |
window.StyleSheet.prototype.addRule = function(selector,value){ |
This file contains 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
if (!window.myObj) { | |
myObj = (function(){ | |
var aPool = []; | |
function obj(x,y) { | |
var fX,fY | |
,oObj = { | |
set:set | |
,drop:drop | |
} | |
; |
NewerOlder