mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-09-18 21:50:56 +00:00
Fixing remaining broken js files. Collect static command now works as expected.
This commit is contained in:
parent
fd31c534e8
commit
b71f383122
9 changed files with 607 additions and 93 deletions
1
.vscode/settings.json
vendored
1
.vscode/settings.json
vendored
|
@ -16,6 +16,7 @@
|
|||
"ansible/playbooks/*/*": true,
|
||||
"archive/*": true,
|
||||
"logs/*": true,
|
||||
"static/*": true,
|
||||
"media/fonts": true,
|
||||
"static/*.css": true,
|
||||
"static/*.js": true,
|
||||
|
|
|
@ -61,6 +61,7 @@ server {
|
|||
}
|
||||
|
||||
location /static/ {
|
||||
gzip_static on;
|
||||
expires max;
|
||||
keepalive_timeout 1;
|
||||
root /srv/newsblur;
|
||||
|
|
|
@ -64,6 +64,7 @@ server {
|
|||
}
|
||||
|
||||
location /static/ {
|
||||
gzip_static on;
|
||||
expires max;
|
||||
keepalive_timeout 1;
|
||||
root /srv/newsblur;
|
||||
|
|
106
media/js/vendor/audio.js
vendored
106
media/js/vendor/audio.js
vendored
|
@ -7,20 +7,27 @@
|
|||
scripts = document.getElementsByTagName('script');
|
||||
for (var i = 0, ii = scripts.length; i < ii; i++) {
|
||||
var path = scripts[i].getAttribute('src');
|
||||
if(re.test(path)) return path.replace(re, '');
|
||||
if(re.test(path))
|
||||
{
|
||||
var f = path.split ( '/' );
|
||||
f.pop ();
|
||||
return f.join ( '/' ) + '/';
|
||||
}
|
||||
}
|
||||
// when no script found, an empty string causes the least confusion.
|
||||
return '';
|
||||
})();
|
||||
|
||||
|
||||
// ##The audiojs interface
|
||||
// This is the global object which provides an interface for creating new `audiojs` instances.
|
||||
// It also stores all of the construction helper methods and variables.
|
||||
container[audiojs] = {
|
||||
instanceCount: 0,
|
||||
instances: {},
|
||||
// The markup for the swf. It is injected into the page if there is not support for the `<audio>` element. The `$n`s are placeholders.
|
||||
// `$1` The name of the flash movie
|
||||
// `$2` The path to the swf
|
||||
// `$3` Cache invalidation
|
||||
// The markup for the swf. It is injected into the page if there is not support for the `<audio>` element. The `$n`s are placeholders.
|
||||
// `$1` The name of the flash movie
|
||||
// `$2` The path to the swf
|
||||
// `$3` Cache invalidation
|
||||
flashSource: '\
|
||||
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="$1" width="1" height="1" name="$1" style="position: absolute; left: -1px;"> \
|
||||
<param name="movie" value="$2?playerInstance='+audiojs+'.instances[\'$1\']&datetime=$3"> \
|
||||
|
@ -35,6 +42,7 @@
|
|||
loop: false,
|
||||
preload: true,
|
||||
imageLocation: path + 'player-graphics.gif',
|
||||
retinaImageLocation: path + 'player-graphics@2x.gif',
|
||||
swfLocation: path + 'audiojs.swf',
|
||||
useFlash: (function() {
|
||||
var a = document.createElement('audio');
|
||||
|
@ -113,6 +121,20 @@
|
|||
.audiojs .error { background: url("$1") -2px -61px no-repeat; } \
|
||||
.audiojs .pause { background: url("$1") -2px -91px no-repeat; } \
|
||||
\
|
||||
@media only screen and (-webkit-min-device-pixel-ratio: 2), \
|
||||
only screen and (min--moz-device-pixel-ratio: 2), \
|
||||
only screen and (min-moz-device-pixel-ratio: 2), \
|
||||
only screen and (-o-min-device-pixel-ratio: 2/1), \
|
||||
only screen and (min-device-pixel-ratio: 2) { \
|
||||
.audiojs .play, .audiojs .loading, .audiojs .error, .audiojs .pause { \
|
||||
background-image: url("$2"); \
|
||||
-webkit-background-size: 30px 120px; \
|
||||
-moz-background-size: 30px 120px; \
|
||||
-o-background-size: 30px 120px; \
|
||||
background-size: 30px 120px; \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
.playing .play, .playing .loading, .playing .error { display: none; } \
|
||||
.playing .pause { display: block; } \
|
||||
\
|
||||
|
@ -155,9 +177,8 @@
|
|||
},
|
||||
loadProgress: function(percent) {
|
||||
var player = this.settings.createPlayer,
|
||||
scrubber = getByClass(player.scrubberClass, this.wrapper),
|
||||
loaded = getByClass(player.loaderClass, this.wrapper);
|
||||
loaded.style.width = (scrubber.offsetWidth * percent) + 'px';
|
||||
loaded.style.width = Math.round(100 * percent) + '%';
|
||||
},
|
||||
playPause: function() {
|
||||
if (this.playing) this.settings.play();
|
||||
|
@ -165,6 +186,7 @@
|
|||
},
|
||||
play: function() {
|
||||
var player = this.settings.createPlayer;
|
||||
container[audiojs].helpers.removeClass(this.wrapper, player.errorClass);
|
||||
container[audiojs].helpers.addClass(this.wrapper, player.playingClass);
|
||||
},
|
||||
pause: function() {
|
||||
|
@ -173,9 +195,8 @@
|
|||
},
|
||||
updatePlayhead: function(percent) {
|
||||
var player = this.settings.createPlayer,
|
||||
scrubber = getByClass(player.scrubberClass, this.wrapper),
|
||||
progress = getByClass(player.progressClass, this.wrapper);
|
||||
progress.style.width = (scrubber.offsetWidth * percent) + 'px';
|
||||
progress.style.width = Math.round(100 * percent) + '%';
|
||||
|
||||
var played = getByClass(player.playedClass, this.wrapper),
|
||||
p = this.duration * percent,
|
||||
|
@ -187,10 +208,10 @@
|
|||
|
||||
// ### Contructor functions
|
||||
|
||||
// `create()`
|
||||
// Used to create a single `audiojs` instance.
|
||||
// If an array is passed then it calls back to `createAll()`.
|
||||
// Otherwise, it creates a single instance and returns it.
|
||||
// `create()`
|
||||
// Used to create a single `audiojs` instance.
|
||||
// If an array is passed then it calls back to `createAll()`.
|
||||
// Otherwise, it creates a single instance and returns it.
|
||||
create: function(element, options) {
|
||||
var options = options || {}
|
||||
if (element.length) {
|
||||
|
@ -200,14 +221,18 @@
|
|||
}
|
||||
},
|
||||
|
||||
// `createAll()`
|
||||
// Creates multiple `audiojs` instances.
|
||||
// `createAll()`
|
||||
// Creates multiple `audiojs` instances.
|
||||
// If `elements` is `null`, then automatically find any `<audio>` tags on the page and create `audiojs` instances for them.
|
||||
createAll: function(options, elements) {
|
||||
var audioElements = elements || document.getElementsByTagName('audio'),
|
||||
instances = []
|
||||
options = options || {};
|
||||
for (var i = 0, ii = audioElements.length; i < ii; i++) {
|
||||
|
||||
if ((" " + audioElements[i].parentNode.className + " ").replace(/[\n\t]/g, " ").indexOf(" audiojs ") > -1)
|
||||
continue;
|
||||
|
||||
instances.push(this.newInstance(audioElements[i], options));
|
||||
}
|
||||
return instances;
|
||||
|
@ -244,7 +269,7 @@
|
|||
this.injectFlash(audio, id);
|
||||
this.attachFlashEvents(audio.wrapper, audio);
|
||||
} else if (s.useFlash && !s.hasFlash) {
|
||||
this.settings.flashError.apply(audio);
|
||||
s.flashError.apply(audio);
|
||||
}
|
||||
|
||||
// Attach event callbacks to the new audiojs instance.
|
||||
|
@ -284,21 +309,14 @@
|
|||
if (!audio.settings.createPlayer) return;
|
||||
var player = audio.settings.createPlayer,
|
||||
playPause = getByClass(player.playPauseClass, wrapper),
|
||||
scrubber = getByClass(player.scrubberClass, wrapper),
|
||||
leftPos = function(elem) {
|
||||
var curleft = 0;
|
||||
if (elem.offsetParent) {
|
||||
do { curleft += elem.offsetLeft; } while (elem = elem.offsetParent);
|
||||
}
|
||||
return curleft;
|
||||
};
|
||||
scrubber = getByClass(player.scrubberClass, wrapper);
|
||||
|
||||
container[audiojs].events.addListener(playPause, 'click', function(e) {
|
||||
audio.playPause.apply(audio);
|
||||
});
|
||||
|
||||
container[audiojs].events.addListener(scrubber, 'click', function(e) {
|
||||
var relativeLeft = e.clientX - leftPos(this);
|
||||
var relativeLeft = e.clientX - this.getBoundingClientRect().left;
|
||||
audio.skipTo(relativeLeft / scrubber.offsetWidth);
|
||||
});
|
||||
|
||||
|
@ -348,14 +366,14 @@
|
|||
audio.settings.updatePlayhead.apply(audio, [percent]);
|
||||
}
|
||||
audio['play'] = function() {
|
||||
// If the audio hasn't started preloading, then start it now.
|
||||
// If the audio hasn't started preloading, then start it now.
|
||||
// Then set `preload` to `true`, so that any tracks loaded in subsequently are loaded straight away.
|
||||
if (!audio.settings.preload) {
|
||||
audio.settings.preload = true;
|
||||
audio.element.init(audio.mp3);
|
||||
}
|
||||
audio.playing = true;
|
||||
// IE doesn't allow a method named `play()` to be exposed through `ExternalInterface`, so lets go with `pplay()`.
|
||||
// IE doesn't allow a method named `play()` to be exposed through `ExternalInterface`, so lets go with `pplay()`.
|
||||
// <http://dev.nuclearrooster.com/2008/07/27/externalinterfaceaddcallback-can-cause-ie-js-errors-with-certain-keyworkds/>
|
||||
audio.element.pplay();
|
||||
audio.settings.play.apply(audio);
|
||||
|
@ -394,7 +412,7 @@
|
|||
|
||||
// ## Helper functions
|
||||
helpers: {
|
||||
// **Merge two objects, with `obj2` overwriting `obj1`**
|
||||
// **Merge two objects, with `obj2` overwriting `obj1`**
|
||||
// The merge is shallow, but that's all that is required for our purposes.
|
||||
merge: function(obj1, obj2) {
|
||||
for (attr in obj2) {
|
||||
|
@ -407,7 +425,7 @@
|
|||
clone: function(obj){
|
||||
if (obj == null || typeof(obj) !== 'object') return obj;
|
||||
var temp = new obj.constructor();
|
||||
for (var key in obj) temp[key] = arguments.callee(obj[key]);
|
||||
for (var key in obj) temp[key] = this.clone(obj[key]);
|
||||
return temp;
|
||||
},
|
||||
// **Adding/removing classnames from elements**
|
||||
|
@ -420,13 +438,15 @@
|
|||
var re = new RegExp('(\\s|^)'+className+'(\\s|$)');
|
||||
element.className = element.className.replace(re,' ');
|
||||
},
|
||||
// **Dynamic CSS injection**
|
||||
// **Dynamic CSS injection**
|
||||
// Takes a string of css, inserts it into a `<style>`, then injects it in at the very top of the `<head>`. This ensures any user-defined styles will take precedence.
|
||||
injectCss: function(audio, string) {
|
||||
|
||||
// If an `audiojs` `<style>` tag already exists, then append to it rather than creating a whole new `<style>`.
|
||||
var prepend = '',
|
||||
styles = document.getElementsByTagName('style'),
|
||||
css = string.replace(/\$1/g, audio.settings.imageLocation);
|
||||
css = css.replace(/\$2/g, audio.settings.retinaImageLocation);
|
||||
|
||||
for (var i = 0, ii = styles.length; i < ii; i++) {
|
||||
var title = styles[i].getAttribute('title');
|
||||
|
@ -451,9 +471,9 @@
|
|||
else style.appendChild(document.createTextNode(prepend + css));
|
||||
|
||||
if (firstchild) head.insertBefore(style, firstchild);
|
||||
else head.appendChild(styleElement);
|
||||
else head.appendChild(style);
|
||||
},
|
||||
// **Handle all the IE6+7 requirements for cloning `<audio>` nodes**
|
||||
// **Handle all the IE6+7 requirements for cloning `<audio>` nodes**
|
||||
// Create a html5-safe document fragment by injecting an `<audio>` element into the document fragment.
|
||||
cloneHtml5Node: function(audioTag) {
|
||||
var fragment = document.createDocumentFragment(),
|
||||
|
@ -479,7 +499,7 @@
|
|||
// For modern browsers use the standard DOM-compliant `addEventListener`.
|
||||
if (element.addEventListener) {
|
||||
element.addEventListener(eventName, func, false);
|
||||
// For older versions of Internet Explorer, use `attachEvent`.
|
||||
// For older versions of Internet Explorer, use `attachEvent`.
|
||||
// Also provide a fix for scoping `this` to the calling element and register each listener so the containing elements can be purged on page unload.
|
||||
} else if (element.attachEvent) {
|
||||
this.listeners.push(element);
|
||||
|
@ -521,15 +541,15 @@
|
|||
loadTimer = setInterval(function() {
|
||||
audio.loadProgress.apply(audio);
|
||||
if (audio.loadedPercent >= 1) clearInterval(loadTimer);
|
||||
});
|
||||
}, 200);
|
||||
}
|
||||
}, 10);
|
||||
}, 200);
|
||||
audio.readyTimer = readyTimer;
|
||||
audio.loadTimer = loadTimer;
|
||||
},
|
||||
|
||||
// **Douglas Crockford's IE6 memory leak fix**
|
||||
// <http://javascript.crockford.com/memory/leak.html>
|
||||
// **Douglas Crockford's IE6 memory leak fix**
|
||||
// <http://javascript.crockford.com/memory/leak.html>
|
||||
// This is used to release the memory leak created by the circular references created when fixing `this` scoping for IE. It is called on page unload.
|
||||
purge: function(d) {
|
||||
var a = d.attributes, i;
|
||||
|
@ -544,7 +564,7 @@
|
|||
}
|
||||
},
|
||||
|
||||
// **DOMready function**
|
||||
// **DOMready function**
|
||||
// As seen here: <https://github.com/dperini/ContentLoaded/>.
|
||||
ready: (function() { return function(fn) {
|
||||
var win = window, done = false, top = true,
|
||||
|
@ -650,7 +670,7 @@
|
|||
var ios = (/(ipod|iphone|ipad)/i).test(navigator.userAgent);
|
||||
// On iOS this interaction will trigger loading the mp3, so run `init()`.
|
||||
if (ios && this.element.readyState == 0) this.init.apply(this);
|
||||
// If the audio hasn't started preloading, then start it now.
|
||||
// If the audio hasn't started preloading, then start it now.
|
||||
// Then set `preload` to `true`, so that any tracks loaded in subsequently are loaded straight away.
|
||||
if (!this.settings.preload) {
|
||||
this.settings.preload = true;
|
||||
|
@ -676,7 +696,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
// **getElementsByClassName**
|
||||
// **getElementsByClassName**
|
||||
// Having to rely on `getElementsByTagName` is pretty inflexible internally, so a modified version of Dustin Diaz's `getElementsByClassName` has been included.
|
||||
// This version cleans things up and prefers the native DOM method if it's available.
|
||||
var getByClass = function(searchClass, node) {
|
||||
|
@ -686,7 +706,7 @@
|
|||
if (node.getElementsByClassName) {
|
||||
matches = node.getElementsByClassName(searchClass);
|
||||
} else {
|
||||
var i, l,
|
||||
var i, l,
|
||||
els = node.getElementsByTagName("*"),
|
||||
pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
|
||||
|
||||
|
@ -699,4 +719,4 @@
|
|||
return matches.length > 1 ? matches : matches[0];
|
||||
};
|
||||
// The global variable names are passed in here and can be changed if they conflict with anything else.
|
||||
})('audiojs', 'audiojsInstance', this);
|
||||
})('audiojs', 'audiojsInstance', this);
|
||||
|
|
497
media/js/vendor/il.js
vendored
Normal file
497
media/js/vendor/il.js
vendored
Normal file
|
@ -0,0 +1,497 @@
|
|||
/* ILoader
|
||||
* imagesLoaded PACKAGED v4.1.4
|
||||
* JavaScript is all like "You images are done yet or what?"
|
||||
* MIT License
|
||||
*/
|
||||
|
||||
/**
|
||||
* EvEmitter v1.1.0
|
||||
* Lil' event emitter
|
||||
* MIT License
|
||||
*/
|
||||
|
||||
/* jshint unused: true, undef: true, strict: true */
|
||||
|
||||
( function( global, factory ) {
|
||||
// universal module definition
|
||||
/* jshint strict: false */ /* globals define, module, window */
|
||||
if ( typeof define == 'function' && define.amd ) {
|
||||
// AMD - RequireJS
|
||||
define( 'ev-emitter/ev-emitter',factory );
|
||||
} else if ( typeof module == 'object' && module.exports ) {
|
||||
// CommonJS - Browserify, Webpack
|
||||
module.exports = factory();
|
||||
} else {
|
||||
// Browser globals
|
||||
global.EvEmitter = factory();
|
||||
}
|
||||
|
||||
}( typeof window != 'undefined' ? window : this, function() {
|
||||
|
||||
|
||||
|
||||
function EvEmitter() {}
|
||||
|
||||
var proto = EvEmitter.prototype;
|
||||
|
||||
proto.on = function( eventName, listener ) {
|
||||
if ( !eventName || !listener ) {
|
||||
return;
|
||||
}
|
||||
// set events hash
|
||||
var events = this._events = this._events || {};
|
||||
// set listeners array
|
||||
var listeners = events[ eventName ] = events[ eventName ] || [];
|
||||
// only add once
|
||||
if ( listeners.indexOf( listener ) == -1 ) {
|
||||
listeners.push( listener );
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
proto.once = function( eventName, listener ) {
|
||||
if ( !eventName || !listener ) {
|
||||
return;
|
||||
}
|
||||
// add event
|
||||
this.on( eventName, listener );
|
||||
// set once flag
|
||||
// set onceEvents hash
|
||||
var onceEvents = this._onceEvents = this._onceEvents || {};
|
||||
// set onceListeners object
|
||||
var onceListeners = onceEvents[ eventName ] = onceEvents[ eventName ] || {};
|
||||
// set flag
|
||||
onceListeners[ listener ] = true;
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
proto.off = function( eventName, listener ) {
|
||||
var listeners = this._events && this._events[ eventName ];
|
||||
if ( !listeners || !listeners.length ) {
|
||||
return;
|
||||
}
|
||||
var index = listeners.indexOf( listener );
|
||||
if ( index != -1 ) {
|
||||
listeners.splice( index, 1 );
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
proto.emitEvent = function( eventName, args ) {
|
||||
var listeners = this._events && this._events[ eventName ];
|
||||
if ( !listeners || !listeners.length ) {
|
||||
return;
|
||||
}
|
||||
// copy over to avoid interference if .off() in listener
|
||||
listeners = listeners.slice(0);
|
||||
args = args || [];
|
||||
// once stuff
|
||||
var onceListeners = this._onceEvents && this._onceEvents[ eventName ];
|
||||
|
||||
for ( var i=0; i < listeners.length; i++ ) {
|
||||
var listener = listeners[i]
|
||||
var isOnce = onceListeners && onceListeners[ listener ];
|
||||
if ( isOnce ) {
|
||||
// remove listener
|
||||
// remove before trigger to prevent recursion
|
||||
this.off( eventName, listener );
|
||||
// unset once flag
|
||||
delete onceListeners[ listener ];
|
||||
}
|
||||
// trigger listener
|
||||
listener.apply( this, args );
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
proto.allOff = function() {
|
||||
delete this._events;
|
||||
delete this._onceEvents;
|
||||
};
|
||||
|
||||
return EvEmitter;
|
||||
|
||||
}));
|
||||
|
||||
/*!
|
||||
* imagesLoaded v4.1.4
|
||||
* JavaScript is all like "You images are done yet or what?"
|
||||
* MIT License
|
||||
*/
|
||||
|
||||
( function( window, factory ) { 'use strict';
|
||||
// universal module definition
|
||||
|
||||
/*global define: false, module: false, require: false */
|
||||
|
||||
if ( typeof define == 'function' && define.amd ) {
|
||||
// AMD
|
||||
define( [
|
||||
'ev-emitter/ev-emitter'
|
||||
], function( EvEmitter ) {
|
||||
return factory( window, EvEmitter );
|
||||
});
|
||||
} else if ( typeof module == 'object' && module.exports ) {
|
||||
// CommonJS
|
||||
module.exports = factory(
|
||||
window,
|
||||
require('ev-emitter')
|
||||
);
|
||||
} else {
|
||||
// browser global
|
||||
window.imagesLoaded = factory(
|
||||
window,
|
||||
window.EvEmitter
|
||||
);
|
||||
}
|
||||
|
||||
})( typeof window !== 'undefined' ? window : this,
|
||||
|
||||
// -------------------------- factory -------------------------- //
|
||||
|
||||
function factory( window, EvEmitter ) {
|
||||
|
||||
|
||||
|
||||
var $ = window.jQuery;
|
||||
var console = window.console;
|
||||
|
||||
// -------------------------- helpers -------------------------- //
|
||||
|
||||
// extend objects
|
||||
function extend( a, b ) {
|
||||
for ( var prop in b ) {
|
||||
a[ prop ] = b[ prop ];
|
||||
}
|
||||
return a;
|
||||
}
|
||||
|
||||
var arraySlice = Array.prototype.slice;
|
||||
|
||||
// turn element or nodeList into an array
|
||||
function makeArray( obj ) {
|
||||
if ( Array.isArray( obj ) ) {
|
||||
// use object if already an array
|
||||
return obj;
|
||||
}
|
||||
|
||||
var isArrayLike = typeof obj == 'object' && typeof obj.length == 'number';
|
||||
if ( isArrayLike ) {
|
||||
// convert nodeList to array
|
||||
return arraySlice.call( obj );
|
||||
}
|
||||
|
||||
// array of single index
|
||||
return [ obj ];
|
||||
}
|
||||
|
||||
// -------------------------- imagesLoaded -------------------------- //
|
||||
|
||||
/**
|
||||
* @param {Array, Element, NodeList, String} elem
|
||||
* @param {Object or Function} options - if function, use as callback
|
||||
* @param {Function} onAlways - callback function
|
||||
*/
|
||||
function ImagesLoaded( elem, options, onAlways ) {
|
||||
// coerce ImagesLoaded() without new, to be new ImagesLoaded()
|
||||
if ( !( this instanceof ImagesLoaded ) ) {
|
||||
return new ImagesLoaded( elem, options, onAlways );
|
||||
}
|
||||
// use elem as selector string
|
||||
var queryElem = elem;
|
||||
if ( typeof elem == 'string' ) {
|
||||
queryElem = document.querySelectorAll( elem );
|
||||
}
|
||||
// bail if bad element
|
||||
if ( !queryElem ) {
|
||||
console.error( 'Bad element for imagesLoaded ' + ( queryElem || elem ) );
|
||||
return;
|
||||
}
|
||||
|
||||
this.elements = makeArray( queryElem );
|
||||
this.options = extend( {}, this.options );
|
||||
// shift arguments if no options set
|
||||
if ( typeof options == 'function' ) {
|
||||
onAlways = options;
|
||||
} else {
|
||||
extend( this.options, options );
|
||||
}
|
||||
|
||||
if ( onAlways ) {
|
||||
this.on( 'always', onAlways );
|
||||
}
|
||||
|
||||
this.getImages();
|
||||
|
||||
if ( $ ) {
|
||||
// add jQuery Deferred object
|
||||
this.jqDeferred = new $.Deferred();
|
||||
}
|
||||
|
||||
// HACK check async to allow time to bind listeners
|
||||
setTimeout( this.check.bind( this ) );
|
||||
}
|
||||
|
||||
ImagesLoaded.prototype = Object.create( EvEmitter.prototype );
|
||||
|
||||
ImagesLoaded.prototype.options = {};
|
||||
|
||||
ImagesLoaded.prototype.getImages = function() {
|
||||
this.images = [];
|
||||
|
||||
// filter & find items if we have an item selector
|
||||
this.elements.forEach( this.addElementImages, this );
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {Node} element
|
||||
*/
|
||||
ImagesLoaded.prototype.addElementImages = function( elem ) {
|
||||
// filter siblings
|
||||
if ( elem.nodeName == 'IMG' ) {
|
||||
this.addImage( elem );
|
||||
}
|
||||
// get background image on element
|
||||
if ( this.options.background === true ) {
|
||||
this.addElementBackgroundImages( elem );
|
||||
}
|
||||
|
||||
// find children
|
||||
// no non-element nodes, #143
|
||||
var nodeType = elem.nodeType;
|
||||
if ( !nodeType || !elementNodeTypes[ nodeType ] ) {
|
||||
return;
|
||||
}
|
||||
var childImgs = elem.querySelectorAll('img');
|
||||
// concat childElems to filterFound array
|
||||
for ( var i=0; i < childImgs.length; i++ ) {
|
||||
var img = childImgs[i];
|
||||
this.addImage( img );
|
||||
}
|
||||
|
||||
// get child background images
|
||||
if ( typeof this.options.background == 'string' ) {
|
||||
var children = elem.querySelectorAll( this.options.background );
|
||||
for ( i=0; i < children.length; i++ ) {
|
||||
var child = children[i];
|
||||
this.addElementBackgroundImages( child );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var elementNodeTypes = {
|
||||
1: true,
|
||||
9: true,
|
||||
11: true
|
||||
};
|
||||
|
||||
ImagesLoaded.prototype.addElementBackgroundImages = function( elem ) {
|
||||
var style = getComputedStyle( elem );
|
||||
if ( !style ) {
|
||||
// Firefox returns null if in a hidden iframe https://bugzil.la/548397
|
||||
return;
|
||||
}
|
||||
// get url inside url("...")
|
||||
var reURL = /url\((['"])?(.*?)\1\)/gi;
|
||||
var matches = reURL.exec( style.backgroundImage );
|
||||
while ( matches !== null ) {
|
||||
var url = matches && matches[2];
|
||||
if ( url ) {
|
||||
this.addBackground( url, elem );
|
||||
}
|
||||
matches = reURL.exec( style.backgroundImage );
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {Image} img
|
||||
*/
|
||||
ImagesLoaded.prototype.addImage = function( img ) {
|
||||
var loadingImage = new LoadingImage( img );
|
||||
this.images.push( loadingImage );
|
||||
};
|
||||
|
||||
ImagesLoaded.prototype.addBackground = function( url, elem ) {
|
||||
var background = new Background( url, elem );
|
||||
this.images.push( background );
|
||||
};
|
||||
|
||||
ImagesLoaded.prototype.check = function() {
|
||||
var _this = this;
|
||||
this.progressedCount = 0;
|
||||
this.hasAnyBroken = false;
|
||||
// complete if no images
|
||||
if ( !this.images.length ) {
|
||||
this.complete();
|
||||
return;
|
||||
}
|
||||
|
||||
function onProgress( image, elem, message ) {
|
||||
// HACK - Chrome triggers event before object properties have changed. #83
|
||||
setTimeout( function() {
|
||||
_this.progress( image, elem, message );
|
||||
});
|
||||
}
|
||||
|
||||
this.images.forEach( function( loadingImage ) {
|
||||
loadingImage.once( 'progress', onProgress );
|
||||
loadingImage.check();
|
||||
});
|
||||
};
|
||||
|
||||
ImagesLoaded.prototype.progress = function( image, elem, message ) {
|
||||
this.progressedCount++;
|
||||
this.hasAnyBroken = this.hasAnyBroken || !image.isLoaded;
|
||||
// progress event
|
||||
this.emitEvent( 'progress', [ this, image, elem ] );
|
||||
if ( this.jqDeferred && this.jqDeferred.notify ) {
|
||||
this.jqDeferred.notify( this, image );
|
||||
}
|
||||
// check if completed
|
||||
if ( this.progressedCount == this.images.length ) {
|
||||
this.complete();
|
||||
}
|
||||
|
||||
if ( this.options.debug && console ) {
|
||||
console.log( 'progress: ' + message, image, elem );
|
||||
}
|
||||
};
|
||||
|
||||
ImagesLoaded.prototype.complete = function() {
|
||||
var eventName = this.hasAnyBroken ? 'fail' : 'done';
|
||||
this.isComplete = true;
|
||||
this.emitEvent( eventName, [ this ] );
|
||||
this.emitEvent( 'always', [ this ] );
|
||||
if ( this.jqDeferred ) {
|
||||
var jqMethod = this.hasAnyBroken ? 'reject' : 'resolve';
|
||||
this.jqDeferred[ jqMethod ]( this );
|
||||
}
|
||||
};
|
||||
|
||||
// -------------------------- -------------------------- //
|
||||
|
||||
function LoadingImage( img ) {
|
||||
this.img = img;
|
||||
}
|
||||
|
||||
LoadingImage.prototype = Object.create( EvEmitter.prototype );
|
||||
|
||||
LoadingImage.prototype.check = function() {
|
||||
// If complete is true and browser supports natural sizes,
|
||||
// try to check for image status manually.
|
||||
var isComplete = this.getIsImageComplete();
|
||||
if ( isComplete ) {
|
||||
// report based on naturalWidth
|
||||
this.confirm( this.img.naturalWidth !== 0, 'naturalWidth' );
|
||||
return;
|
||||
}
|
||||
|
||||
// If none of the checks above matched, simulate loading on detached element.
|
||||
this.proxyImage = new Image();
|
||||
this.proxyImage.addEventListener( 'load', this );
|
||||
this.proxyImage.addEventListener( 'error', this );
|
||||
// bind to image as well for Firefox. #191
|
||||
this.img.addEventListener( 'load', this );
|
||||
this.img.addEventListener( 'error', this );
|
||||
this.proxyImage.src = this.img.src;
|
||||
};
|
||||
|
||||
LoadingImage.prototype.getIsImageComplete = function() {
|
||||
// check for non-zero, non-undefined naturalWidth
|
||||
// fixes Safari+InfiniteScroll+Masonry bug infinite-scroll#671
|
||||
return this.img.complete && this.img.naturalWidth;
|
||||
};
|
||||
|
||||
LoadingImage.prototype.confirm = function( isLoaded, message ) {
|
||||
this.isLoaded = isLoaded;
|
||||
this.emitEvent( 'progress', [ this, this.img, message ] );
|
||||
};
|
||||
|
||||
// ----- events ----- //
|
||||
|
||||
// trigger specified handler for event type
|
||||
LoadingImage.prototype.handleEvent = function( event ) {
|
||||
var method = 'on' + event.type;
|
||||
if ( this[ method ] ) {
|
||||
this[ method ]( event );
|
||||
}
|
||||
};
|
||||
|
||||
LoadingImage.prototype.onload = function() {
|
||||
this.confirm( true, 'onload' );
|
||||
this.unbindEvents();
|
||||
};
|
||||
|
||||
LoadingImage.prototype.onerror = function() {
|
||||
this.confirm( false, 'onerror' );
|
||||
this.unbindEvents();
|
||||
};
|
||||
|
||||
LoadingImage.prototype.unbindEvents = function() {
|
||||
this.proxyImage.removeEventListener( 'load', this );
|
||||
this.proxyImage.removeEventListener( 'error', this );
|
||||
this.img.removeEventListener( 'load', this );
|
||||
this.img.removeEventListener( 'error', this );
|
||||
};
|
||||
|
||||
// -------------------------- Background -------------------------- //
|
||||
|
||||
function Background( url, element ) {
|
||||
this.url = url;
|
||||
this.element = element;
|
||||
this.img = new Image();
|
||||
}
|
||||
|
||||
// inherit LoadingImage prototype
|
||||
Background.prototype = Object.create( LoadingImage.prototype );
|
||||
|
||||
Background.prototype.check = function() {
|
||||
this.img.addEventListener( 'load', this );
|
||||
this.img.addEventListener( 'error', this );
|
||||
this.img.src = this.url;
|
||||
// check if image is already complete
|
||||
var isComplete = this.getIsImageComplete();
|
||||
if ( isComplete ) {
|
||||
this.confirm( this.img.naturalWidth !== 0, 'naturalWidth' );
|
||||
this.unbindEvents();
|
||||
}
|
||||
};
|
||||
|
||||
Background.prototype.unbindEvents = function() {
|
||||
this.img.removeEventListener( 'load', this );
|
||||
this.img.removeEventListener( 'error', this );
|
||||
};
|
||||
|
||||
Background.prototype.confirm = function( isLoaded, message ) {
|
||||
this.isLoaded = isLoaded;
|
||||
this.emitEvent( 'progress', [ this, this.element, message ] );
|
||||
};
|
||||
|
||||
// -------------------------- jQuery -------------------------- //
|
||||
|
||||
ImagesLoaded.makeJQueryPlugin = function( jQuery ) {
|
||||
jQuery = jQuery || window.jQuery;
|
||||
if ( !jQuery ) {
|
||||
return;
|
||||
}
|
||||
// set local variable
|
||||
$ = jQuery;
|
||||
// $().imagesLoaded()
|
||||
$.fn.imagesLoaded = function( options, callback ) {
|
||||
var instance = new ImagesLoaded( this, options, callback );
|
||||
return instance.jqDeferred.promise( $(this) );
|
||||
};
|
||||
};
|
||||
// try making plugin
|
||||
ImagesLoaded.makeJQueryPlugin();
|
||||
|
||||
// -------------------------- -------------------------- //
|
||||
|
||||
return ImagesLoaded;
|
||||
|
||||
});
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
/*!
|
||||
* imagesLoaded PACKAGED v4.1.0
|
||||
* imagesLoaded PACKAGED v4.1.4
|
||||
* JavaScript is all like "You images are done yet or what?"
|
||||
* MIT License
|
||||
*/
|
||||
|
||||
/**
|
||||
* EvEmitter v1.0.1
|
||||
* EvEmitter v1.1.0
|
||||
* Lil' event emitter
|
||||
* MIT License
|
||||
*/
|
||||
|
@ -14,7 +14,7 @@
|
|||
|
||||
( function( global, factory ) {
|
||||
// universal module definition
|
||||
/* jshint strict: false */ /* globals define, module */
|
||||
/* jshint strict: false */ /* globals define, module, window */
|
||||
if ( typeof define == 'function' && define.amd ) {
|
||||
// AMD - RequireJS
|
||||
define( 'ev-emitter/ev-emitter',factory );
|
||||
|
@ -26,7 +26,7 @@
|
|||
global.EvEmitter = factory();
|
||||
}
|
||||
|
||||
}( this, function() {
|
||||
}( typeof window != 'undefined' ? window : this, function() {
|
||||
|
||||
|
||||
|
||||
|
@ -59,8 +59,8 @@ proto.once = function( eventName, listener ) {
|
|||
// set once flag
|
||||
// set onceEvents hash
|
||||
var onceEvents = this._onceEvents = this._onceEvents || {};
|
||||
// set onceListeners array
|
||||
var onceListeners = onceEvents[ eventName ] = onceEvents[ eventName ] || [];
|
||||
// set onceListeners object
|
||||
var onceListeners = onceEvents[ eventName ] = onceEvents[ eventName ] || {};
|
||||
// set flag
|
||||
onceListeners[ listener ] = true;
|
||||
|
||||
|
@ -85,13 +85,14 @@ proto.emitEvent = function( eventName, args ) {
|
|||
if ( !listeners || !listeners.length ) {
|
||||
return;
|
||||
}
|
||||
var i = 0;
|
||||
var listener = listeners[i];
|
||||
// copy over to avoid interference if .off() in listener
|
||||
listeners = listeners.slice(0);
|
||||
args = args || [];
|
||||
// once stuff
|
||||
var onceListeners = this._onceEvents && this._onceEvents[ eventName ];
|
||||
|
||||
while ( listener ) {
|
||||
for ( var i=0; i < listeners.length; i++ ) {
|
||||
var listener = listeners[i]
|
||||
var isOnce = onceListeners && onceListeners[ listener ];
|
||||
if ( isOnce ) {
|
||||
// remove listener
|
||||
|
@ -102,20 +103,22 @@ proto.emitEvent = function( eventName, args ) {
|
|||
}
|
||||
// trigger listener
|
||||
listener.apply( this, args );
|
||||
// get next listener
|
||||
i += isOnce ? 0 : 1;
|
||||
listener = listeners[i];
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
proto.allOff = function() {
|
||||
delete this._events;
|
||||
delete this._onceEvents;
|
||||
};
|
||||
|
||||
return EvEmitter;
|
||||
|
||||
}));
|
||||
|
||||
/*!
|
||||
* imagesLoaded v4.1.0
|
||||
* imagesLoaded v4.1.4
|
||||
* JavaScript is all like "You images are done yet or what?"
|
||||
* MIT License
|
||||
*/
|
||||
|
@ -146,7 +149,7 @@ return EvEmitter;
|
|||
);
|
||||
}
|
||||
|
||||
})( window,
|
||||
})( typeof window !== 'undefined' ? window : this,
|
||||
|
||||
// -------------------------- factory -------------------------- //
|
||||
|
||||
|
@ -167,22 +170,23 @@ function extend( a, b ) {
|
|||
return a;
|
||||
}
|
||||
|
||||
var arraySlice = Array.prototype.slice;
|
||||
|
||||
// turn element or nodeList into an array
|
||||
function makeArray( obj ) {
|
||||
var ary = [];
|
||||
if ( Array.isArray( obj ) ) {
|
||||
// use object if already an array
|
||||
ary = obj;
|
||||
} else if ( typeof obj.length == 'number' ) {
|
||||
// convert nodeList to array
|
||||
for ( var i=0; i < obj.length; i++ ) {
|
||||
ary.push( obj[i] );
|
||||
}
|
||||
} else {
|
||||
// array of single index
|
||||
ary.push( obj );
|
||||
return obj;
|
||||
}
|
||||
return ary;
|
||||
|
||||
var isArrayLike = typeof obj == 'object' && typeof obj.length == 'number';
|
||||
if ( isArrayLike ) {
|
||||
// convert nodeList to array
|
||||
return arraySlice.call( obj );
|
||||
}
|
||||
|
||||
// array of single index
|
||||
return [ obj ];
|
||||
}
|
||||
|
||||
// -------------------------- imagesLoaded -------------------------- //
|
||||
|
@ -198,13 +202,19 @@ function ImagesLoaded( elem, options, onAlways ) {
|
|||
return new ImagesLoaded( elem, options, onAlways );
|
||||
}
|
||||
// use elem as selector string
|
||||
var queryElem = elem;
|
||||
if ( typeof elem == 'string' ) {
|
||||
elem = document.querySelectorAll( elem );
|
||||
queryElem = document.querySelectorAll( elem );
|
||||
}
|
||||
// bail if bad element
|
||||
if ( !queryElem ) {
|
||||
console.error( 'Bad element for imagesLoaded ' + ( queryElem || elem ) );
|
||||
return;
|
||||
}
|
||||
|
||||
this.elements = makeArray( elem );
|
||||
this.elements = makeArray( queryElem );
|
||||
this.options = extend( {}, this.options );
|
||||
|
||||
// shift arguments if no options set
|
||||
if ( typeof options == 'function' ) {
|
||||
onAlways = options;
|
||||
} else {
|
||||
|
@ -223,9 +233,7 @@ function ImagesLoaded( elem, options, onAlways ) {
|
|||
}
|
||||
|
||||
// HACK check async to allow time to bind listeners
|
||||
setTimeout( function() {
|
||||
this.check();
|
||||
}.bind( this ));
|
||||
setTimeout( this.check.bind( this ) );
|
||||
}
|
||||
|
||||
ImagesLoaded.prototype = Object.create( EvEmitter.prototype );
|
||||
|
@ -393,7 +401,9 @@ LoadingImage.prototype.check = function() {
|
|||
};
|
||||
|
||||
LoadingImage.prototype.getIsImageComplete = function() {
|
||||
return this.img.complete && this.img.naturalWidth !== undefined;
|
||||
// check for non-zero, non-undefined naturalWidth
|
||||
// fixes Safari+InfiniteScroll+Masonry bug infinite-scroll#671
|
||||
return this.img.complete && this.img.naturalWidth;
|
||||
};
|
||||
|
||||
LoadingImage.prototype.confirm = function( isLoaded, message ) {
|
16
media/js/vendor/jquery.newsblur.js
vendored
16
media/js/vendor/jquery.newsblur.js
vendored
|
@ -36,22 +36,6 @@ NEWSBLUR.log = function(msg) {
|
|||
(function($) {
|
||||
|
||||
$.fn.extend({
|
||||
|
||||
textNodes: function() {
|
||||
var ret = [];
|
||||
|
||||
(function(el){
|
||||
if (!el) return;
|
||||
if ((el.nodeType == 3)) {
|
||||
ret.push(el);
|
||||
} else {
|
||||
for (var i=0; i < el.childNodes.length; ++i) {
|
||||
arguments.callee(el.childNodes[i]);
|
||||
}
|
||||
}
|
||||
})(this[0]);
|
||||
return $(ret);
|
||||
},
|
||||
|
||||
isScrollVisible: function($elem, partial) {
|
||||
var docViewTop = 0; // $(this).scrollTop();
|
||||
|
|
|
@ -75,7 +75,7 @@ javascripts:
|
|||
- js/vendor/bootstrap-transition.js
|
||||
- js/vendor/highlight.js
|
||||
- js/vendor/fitvid.js
|
||||
- js/vendor/imagesLoaded-*.js
|
||||
- js/vendor/il.js
|
||||
- js/vendor/mark.js
|
||||
- js/newsblur/reader/reader_utils.js
|
||||
- js/newsblur/reader/reader.js
|
||||
|
|
|
@ -796,7 +796,7 @@ PIPELINE = {
|
|||
# 'CSS_COMPRESSOR': 'pipeline.compressors.NoopCompressor',
|
||||
# 'JS_COMPRESSOR': 'pipeline.compressors.NoopCompressor',
|
||||
'CLOSURE_BINARY': '/usr/bin/env google-closure-compiler',
|
||||
'CLOSURE_ARGUMENTS': '--language_in ECMASCRIPT_2021 --warning_level QUIET',
|
||||
'CLOSURE_ARGUMENTS': '--language_in ECMASCRIPT_2021',# --warning_level QUIET',
|
||||
'JAVASCRIPT': {
|
||||
'common': {
|
||||
'source_filenames': assets['javascripts']['common'],
|
||||
|
|
Loading…
Add table
Reference in a new issue