zprogress and updates tech.js

This commit is contained in:
unknown 2015-07-30 16:51:53 +01:00
parent 443c95a135
commit 874de79656
13 changed files with 303 additions and 7 deletions

16
bower.json Normal file
View File

@ -0,0 +1,16 @@
{
"name": "rinser",
"version": "0.0.0",
"main": "app.js",
"moduleType": [
"node"
],
"license": "MIT",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
]
}

View File

@ -67,7 +67,9 @@
<script type="text/javascript" src="js/moment.js"></script>
<script type="text/javascript" src="js/ejs.js"></script>-->
<script type="text/javascript" src="js/output.min.js"></script>
<script type="text/javascript" src="js/nprogress.js"></script>
<script type="text/javascript" src="js/fx.js"></script>
<script type="text/javascript" src="js/fx_methods.js"></script>
<script type="text/javascript" src="js/zprogress.js"></script>
<script type="text/javascript" src="js/app.prod.js"></script>
</body>

View File

@ -45,7 +45,7 @@ var APP = {
console.log(this);
console.log('get ' + this.feeds[this.refreshStep]);
$('#lastupdate').empty().append('Refreshing...');
NProgress.start();
$.zprogress.start();
this.doRefresh();
},
@ -61,7 +61,7 @@ var APP = {
});
} else {
console.log('Done');
NProgress.inc(0.2);
$.zprogress.inc(0.2);
this.doSave();
}
},
@ -72,7 +72,7 @@ var APP = {
console.log(this._storage);
this.refreshStep++;
NProgress.inc(0.2);
$.zprogress.inc(0.2);
this.doRefresh();
},
doSave: function() {
@ -82,7 +82,7 @@ var APP = {
localStorage.setItem('lastUpdated', this.lastUpdated);
localStorage.setItem('_storage', JSON.stringify(this._storage));
this.getLastUpdateDate();
NProgress.done(true);
$.zprogress.done(true);
},
doLoad: function() {

View File

@ -1,2 +1,2 @@
var APP={refreshStep:0,preUrl:"/",_storage:{lastupdated:null,feeds:{}},_list:null,_feed:null,feeds:["paleo","lifestyle"],lastUpdated:null,preCache:function(){this._list=new EJS({url:"ejs/list.ejs"}),this._feed=new EJS({url:"ejs/test.ejs"})},init:function(){$("#refresh").on("click",$.proxy(this.refresh,this)),console.log("app starting..."),this.preCache(),this.doLoad(),this.getLastUpdateDate(),console.log("Last updated: "+this.lastUpdated)},getLastUpdateDate:function(){var e,t;null==this.lastUpdated?$("#lastupdate").empty().append("Never"):(t=new Date(this.lastUpdated),e=moment(t).startOf("minute").fromNow(),console.log(e),$("#lastupdate").empty().append(e))},refresh:function(){this.refreshStep=0,console.log("refresh"),console.log(this),console.log("get "+this.feeds[this.refreshStep]),$("#lastupdate").empty().append("Refreshing..."),NProgress.start(),this.doRefresh()},doRefresh:function(){var e=this;if(this.refreshStep<this.feeds.length){var t=this.preUrl+this.feeds[this.refreshStep]+".json";$("#lastupdate").empty().append("Refreshing: "+this.feeds[this.refreshStep]),$.getJSON(t,function(t){console.log(e),e.doUpdate(t)})}else console.log("Done"),NProgress.inc(.2),this.doSave()},doUpdate:function(e){console.log(this),console.log(e),this._storage.feeds[this.feeds[this.refreshStep]]=e,console.log(this._storage),this.refreshStep++,NProgress.inc(.2),this.doRefresh()},doSave:function(){console.log("Saving..."),this.lastUpdated=new Date,this._storage.lastupdated=this.lastUpdated,localStorage.setItem("lastUpdated",this.lastUpdated),localStorage.setItem("_storage",JSON.stringify(this._storage)),this.getLastUpdateDate(),NProgress.done(!0)},doLoad:function(){var e=localStorage.getItem("_storage");$("#lastupdate").empty().append("Loading..."),this._storage=null!=e?JSON.parse(e):{lastupdated:null,feeds:{}},this.lastUpdated=this._storage.lastupdated||null,this.showList()},showList:function(){var e,t={},s=[];for(var o in this._storage.feeds)console.log(o),s.push({name:o});t.list=s;var e=this._list.render(t);$("#list").empty().append(e);for(var o in this._storage.feeds)$("#"+o).on("click",$.proxy(this.showFeed,this,o))},showFeed:function(e){var t,s;console.log("show feed "+e),$("#feedcontent").empty(),s={d:this._storage.feeds[e]};var t=this._feed.render(s);$("#feedcontent").append(t)}};Zepto(function(){console.log("Start app"),"undefined"!=typeof Storage?APP.init():alert("No local storage")});
var APP={refreshStep:0,preUrl:"/",_storage:{lastupdated:null,feeds:{}},_list:null,_feed:null,feeds:["paleo","lifestyle"],lastUpdated:null,preCache:function(){this._list=new EJS({url:"ejs/list.ejs"}),this._feed=new EJS({url:"ejs/test.ejs"})},init:function(){$("#refresh").on("click",$.proxy(this.refresh,this)),console.log("app starting..."),this.preCache(),this.doLoad(),this.getLastUpdateDate(),console.log("Last updated: "+this.lastUpdated)},getLastUpdateDate:function(){var e,t;null==this.lastUpdated?$("#lastupdate").empty().append("Never"):(t=new Date(this.lastUpdated),e=moment(t).startOf("minute").fromNow(),console.log(e),$("#lastupdate").empty().append(e))},refresh:function(){this.refreshStep=0,console.log("refresh"),console.log(this),console.log("get "+this.feeds[this.refreshStep]),$("#lastupdate").empty().append("Refreshing..."),$.zprogress.start(),this.doRefresh()},doRefresh:function(){var e=this;if(this.refreshStep<this.feeds.length){var t=this.preUrl+this.feeds[this.refreshStep]+".json";$("#lastupdate").empty().append("Refreshing: "+this.feeds[this.refreshStep]),$.getJSON(t,function(t){console.log(e),e.doUpdate(t)})}else console.log("Done"),$.zprogress.inc(.2),this.doSave()},doUpdate:function(e){console.log(this),console.log(e),this._storage.feeds[this.feeds[this.refreshStep]]=e,console.log(this._storage),this.refreshStep++,$.zprogress.inc(.2),this.doRefresh()},doSave:function(){console.log("Saving..."),this.lastUpdated=new Date,this._storage.lastupdated=this.lastUpdated,localStorage.setItem("lastUpdated",this.lastUpdated),localStorage.setItem("_storage",JSON.stringify(this._storage)),this.getLastUpdateDate(),$.zprogress.done(!0)},doLoad:function(){var e=localStorage.getItem("_storage");$("#lastupdate").empty().append("Loading..."),this._storage=null!=e?JSON.parse(e):{lastupdated:null,feeds:{}},this.lastUpdated=this._storage.lastupdated||null,this.showList()},showList:function(){var e,t={},s=[];for(var o in this._storage.feeds)console.log(o),s.push({name:o});t.list=s;var e=this._list.render(t);$("#list").empty().append(e);for(var o in this._storage.feeds)$("#"+o).on("click",$.proxy(this.showFeed,this,o))},showFeed:function(e){var t,s;console.log("show feed "+e),$("#feedcontent").empty(),s={d:this._storage.feeds[e]};var t=this._feed.render(s);$("#feedcontent").append(t)}};Zepto(function(){console.log("Start app"),"undefined"!=typeof Storage?APP.init():alert("No local storage")});
//# sourceMappingURL=app.prod.min.js.map

View File

@ -1 +1 @@
{"version":3,"sources":["app.prod.js"],"names":["APP","refreshStep","preUrl","_storage","lastupdated","feeds","_list","_feed","lastUpdated","preCache","this","EJS","url","init","$","on","proxy","refresh","console","log","doLoad","getLastUpdateDate","formatted","dt","empty","append","Date","moment","startOf","fromNow","NProgress","start","doRefresh","self","length","feedUrl","getJSON","data","doUpdate","inc","doSave","localStorage","setItem","JSON","stringify","done","_load","getItem","parse","showList","output","d","list","key","push","name","render","showFeed","opt","Zepto","alert"],"mappings":"AAAA,GAAIA,MACAC,YAAa,EACbC,OAAQ,IAERC,UACIC,YAAa,KACbC,UAEJC,MAAQ,KACRC,MAAQ,KAERF,OAAQ,QAAS,aACjBG,YAAa,KACbC,SAAU,WACNC,KAAKJ,MAAQ,GAAIK,MAAKC,IAAK,iBAC3BF,KAAKH,MAAQ,GAAII,MACbC,IAAK,kBAGbC,KAAM,WACFC,EAAE,YAAYC,GAAG,QAASD,EAAEE,MAAMN,KAAKO,QAASP,OAChDQ,QAAQC,IAAI,mBACZT,KAAKD,WACLC,KAAKU,SACLV,KAAKW,oBACLH,QAAQC,IAAI,iBAAmBT,KAAKF,cAExCa,kBAAmB,WACf,GAAIC,GAAWC,CAGS,OAApBb,KAAKF,YACLM,EAAE,eAAeU,QAAQC,OAAO,UAEhCF,EAAK,GAAIG,MAAKhB,KAAKF,aACnBc,EAAYK,OAAOJ,GAAIK,QAAQ,UAAUC,UACzCX,QAAQC,IAAIG,GACZR,EAAE,eAAeU,QAAQC,OAAOH,KAIxCL,QAAS,WACLP,KAAKT,YAAc,EACnBiB,QAAQC,IAAI,WACZD,QAAQC,IAAIT,MACZQ,QAAQC,IAAI,OAAST,KAAKL,MAAMK,KAAKT,cACrCa,EAAE,eAAeU,QAAQC,OAAO,iBAChCK,UAAUC,QACVrB,KAAKsB,aAGTA,UAAW,WACP,GAAIC,GAAOvB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AASE,MAC1BS,EAAE,IAAMuC,GAAKtC,GAAG,QAASD,EAAEE,MAAMN,KAAK+C,SAAU/C,KAAM2C,KAK9DI,SAAU,SAASC,GACf,GAAIR,GAAQC,CACZjC,SAAQC,IAAI,aAAeuC,GAC3B5C,EAAE,gBAAgBU,QAClB2B,GACIA,EAAGzC,KAAKP,SAASE,MAAMqD,GAE3B,IAAIR,GAASxC,KAAKH,MAAMiD,OAAOL,EAE/BrC,GAAE,gBAAgBW,OAAOyB,IAMjCS,OAAM,WACFzC,QAAQC,IAAI,aACY,mBAAd,SACNnB,IAAIa,OAGJ+C,MAAM"}
{"version":3,"sources":["app.prod.js"],"names":["APP","refreshStep","preUrl","_storage","lastupdated","feeds","_list","_feed","lastUpdated","preCache","this","EJS","url","init","$","on","proxy","refresh","console","log","doLoad","getLastUpdateDate","formatted","dt","empty","append","Date","moment","startOf","fromNow","zprogress","start","doRefresh","self","length","feedUrl","getJSON","data","doUpdate","inc","doSave","localStorage","setItem","JSON","stringify","done","_load","getItem","parse","showList","output","d","list","key","push","name","render","showFeed","opt","Zepto","alert"],"mappings":"AAAA,GAAIA,MACAC,YAAa,EACbC,OAAQ,IAERC,UACIC,YAAa,KACbC,UAEJC,MAAQ,KACRC,MAAQ,KAERF,OAAQ,QAAS,aACjBG,YAAa,KACbC,SAAU,WACNC,KAAKJ,MAAQ,GAAIK,MAAKC,IAAK,iBAC3BF,KAAKH,MAAQ,GAAII,MACbC,IAAK,kBAGbC,KAAM,WACFC,EAAE,YAAYC,GAAG,QAASD,EAAEE,MAAMN,KAAKO,QAASP,OAChDQ,QAAQC,IAAI,mBACZT,KAAKD,WACLC,KAAKU,SACLV,KAAKW,oBACLH,QAAQC,IAAI,iBAAmBT,KAAKF,cAExCa,kBAAmB,WACf,GAAIC,GAAWC,CAGS,OAApBb,KAAKF,YACLM,EAAE,eAAeU,QAAQC,OAAO,UAEhCF,EAAK,GAAIG,MAAKhB,KAAKF,aACnBc,EAAYK,OAAOJ,GAAIK,Q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AERK,KAAKF,YAAcE,KAAKP,SAASC,aAAe,KAChDM,KAAKuC,YAETA,SAAU,WACN,GAAIC,GAAQC,KACRC,IACJ,KAAK,GAAIC,KAAO3C,MAAKP,SAASE,MAC1Ba,QAAQC,IAAIkC,GACZD,EAAKE,MACDC,KAAMF,GAIdF,GAAEC,KAAOA,CAET,IAAIF,GAASxC,KAAKJ,MAAMkD,OAAOL,EAC/BrC,GAAE,SAASU,QAAQC,OAAOyB,EAE1B,KAAK,GAAIG,KAAO3C,MAAKP,SAASE,MAC1BS,EAAE,IAAMuC,GAAKtC,GAAG,QAASD,EAAEE,MAAMN,KAAK+C,SAAU/C,KAAM2C,KAK9DI,SAAU,SAASC,GACf,GAAIR,GAAQC,CACZjC,SAAQC,IAAI,aAAeuC,GAC3B5C,EAAE,gBAAgBU,QAClB2B,GACIA,EAAGzC,KAAKP,SAASE,MAAMqD,GAE3B,IAAIR,GAASxC,KAAKH,MAAMiD,OAAOL,EAE/BrC,GAAE,gBAAgBW,OAAOyB,IAMjCS,OAAM,WACFzC,QAAQC,IAAI,aACY,mBAAd,SACNnB,IAAIa,OAGJ+C,MAAM"}

123
html/js/fx.js Normal file
View File

@ -0,0 +1,123 @@
// Zepto.js
// (c) 2010-2015 Thomas Fuchs
// Zepto.js may be freely distributed under the MIT license.
;(function($, undefined){
var prefix = '', eventPrefix,
vendors = { Webkit: 'webkit', Moz: '', O: 'o' },
testEl = document.createElement('div'),
supportedTransforms = /^((translate|rotate|scale)(X|Y|Z|3d)?|matrix(3d)?|perspective|skew(X|Y)?)$/i,
transform,
transitionProperty, transitionDuration, transitionTiming, transitionDelay,
animationName, animationDuration, animationTiming, animationDelay,
cssReset = {}
function dasherize(str) { return str.replace(/([a-z])([A-Z])/, '$1-$2').toLowerCase() }
function normalizeEvent(name) { return eventPrefix ? eventPrefix + name : name.toLowerCase() }
$.each(vendors, function(vendor, event){
if (testEl.style[vendor + 'TransitionProperty'] !== undefined) {
prefix = '-' + vendor.toLowerCase() + '-'
eventPrefix = event
return false
}
})
transform = prefix + 'transform'
cssReset[transitionProperty = prefix + 'transition-property'] =
cssReset[transitionDuration = prefix + 'transition-duration'] =
cssReset[transitionDelay = prefix + 'transition-delay'] =
cssReset[transitionTiming = prefix + 'transition-timing-function'] =
cssReset[animationName = prefix + 'animation-name'] =
cssReset[animationDuration = prefix + 'animation-duration'] =
cssReset[animationDelay = prefix + 'animation-delay'] =
cssReset[animationTiming = prefix + 'animation-timing-function'] = ''
$.fx = {
off: (eventPrefix === undefined && testEl.style.transitionProperty === undefined),
speeds: { _default: 400, fast: 200, slow: 600 },
cssPrefix: prefix,
transitionEnd: normalizeEvent('TransitionEnd'),
animationEnd: normalizeEvent('AnimationEnd')
}
$.fn.animate = function(properties, duration, ease, callback, delay){
if ($.isFunction(duration))
callback = duration, ease = undefined, duration = undefined
if ($.isFunction(ease))
callback = ease, ease = undefined
if ($.isPlainObject(duration))
ease = duration.easing, callback = duration.complete, delay = duration.delay, duration = duration.duration
if (duration) duration = (typeof duration == 'number' ? duration :
($.fx.speeds[duration] || $.fx.speeds._default)) / 1000
if (delay) delay = parseFloat(delay) / 1000
return this.anim(properties, duration, ease, callback, delay)
}
$.fn.anim = function(properties, duration, ease, callback, delay){
var key, cssValues = {}, cssProperties, transforms = '',
that = this, wrappedCallback, endEvent = $.fx.transitionEnd,
fired = false
if (duration === undefined) duration = $.fx.speeds._default / 1000
if (delay === undefined) delay = 0
if ($.fx.off) duration = 0
if (typeof properties == 'string') {
// keyframe animation
cssValues[animationName] = properties
cssValues[animationDuration] = duration + 's'
cssValues[animationDelay] = delay + 's'
cssValues[animationTiming] = (ease || 'linear')
endEvent = $.fx.animationEnd
} else {
cssProperties = []
// CSS transitions
for (key in properties)
if (supportedTransforms.test(key)) transforms += key + '(' + properties[key] + ') '
else cssValues[key] = properties[key], cssProperties.push(dasherize(key))
if (transforms) cssValues[transform] = transforms, cssProperties.push(transform)
if (duration > 0 && typeof properties === 'object') {
cssValues[transitionProperty] = cssProperties.join(', ')
cssValues[transitionDuration] = duration + 's'
cssValues[transitionDelay] = delay + 's'
cssValues[transitionTiming] = (ease || 'linear')
}
}
wrappedCallback = function(event){
if (typeof event !== 'undefined') {
if (event.target !== event.currentTarget) return // makes sure the event didn't bubble from "below"
$(event.target).unbind(endEvent, wrappedCallback)
} else
$(this).unbind(endEvent, wrappedCallback) // triggered by setTimeout
fired = true
$(this).css(cssReset)
callback && callback.call(this)
}
if (duration > 0){
this.bind(endEvent, wrappedCallback)
// transitionEnd is not always firing on older Android phones
// so make sure it gets fired
setTimeout(function(){
if (fired) return
wrappedCallback.call(that)
}, ((duration + delay) * 1000) + 25)
}
// trigger page reflow so new elements can animate
this.size() && this.get(0).clientLeft
this.css(cssValues)
if (duration <= 0) setTimeout(function() {
that.each(function(){ wrappedCallback.call(this) })
}, 0)
return this
}
testEl = null
})(Zepto)

71
html/js/fx_methods.js Normal file
View File

@ -0,0 +1,71 @@
// Zepto.js
// (c) 2010-2015 Thomas Fuchs
// Zepto.js may be freely distributed under the MIT license.
;(function($, undefined){
var document = window.document, docElem = document.documentElement,
origShow = $.fn.show, origHide = $.fn.hide, origToggle = $.fn.toggle
function anim(el, speed, opacity, scale, callback) {
if (typeof speed == 'function' && !callback) callback = speed, speed = undefined
var props = { opacity: opacity }
if (scale) {
props.scale = scale
el.css($.fx.cssPrefix + 'transform-origin', '0 0')
}
return el.animate(props, speed, null, callback)
}
function hide(el, speed, scale, callback) {
return anim(el, speed, 0, scale, function(){
origHide.call($(this))
callback && callback.call(this)
})
}
$.fn.show = function(speed, callback) {
origShow.call(this)
if (speed === undefined) speed = 0
else this.css('opacity', 0)
return anim(this, speed, 1, '1,1', callback)
}
$.fn.hide = function(speed, callback) {
if (speed === undefined) return origHide.call(this)
else return hide(this, speed, '0,0', callback)
}
$.fn.toggle = function(speed, callback) {
if (speed === undefined || typeof speed == 'boolean')
return origToggle.call(this, speed)
else return this.each(function(){
var el = $(this)
el[el.css('display') == 'none' ? 'show' : 'hide'](speed, callback)
})
}
$.fn.fadeTo = function(speed, opacity, callback) {
return anim(this, speed, opacity, null, callback)
}
$.fn.fadeIn = function(speed, callback) {
var target = this.css('opacity')
if (target > 0) this.css('opacity', 0)
else target = 1
return origShow.call(this).fadeTo(speed, target, callback)
}
$.fn.fadeOut = function(speed, callback) {
return hide(this, speed, null, callback)
}
$.fn.fadeToggle = function(speed, callback) {
return this.each(function(){
var el = $(this)
el[
(el.css('opacity') == 0 || el.css('display') == 'none') ? 'fadeIn' : 'fadeOut'
](speed, callback)
})
}
})(Zepto)

74
html/js/zprogress.js Normal file
View File

@ -0,0 +1,74 @@
// zprogress (c) 2013 Thomas Fuchs
// MIT-licensed - https://github.com/madrobby/zprogress
;(function($){
var html =
'<style>#zprogress{position:fixed;top:0;left:0;width:100%;height:3px;opacity:0;pointer-events:none;-webkit-pointer-events:none;z-index:1000}'+
'#zprogress_indicator{width:100%;margin-left:-100%;height:100%;background:#1c88ff}'+
'</style>'+
'<div id=zprogress><div id=zprogress_indicator></div></div>',
$wrapper, $indicator, value, timeout,
MARGIN = 12.5,
LMARGIN = MARGIN/100,
RMARGIN = 1 - LMARGIN
function init(){
if($wrapper) return
$('body').append(html)
$wrapper = $('#zprogress')
$indicator = $('#zprogress_indicator')
}
function anim(){
$indicator.animate({ translateX: value*100+'%' }, 200)
}
function clear(){
if(timeout) clearTimeout(timeout)
timeout = undefined
}
function trickle(){
timeout = setTimeout(function(){
$.zprogress.inc((RMARGIN-value)*.035*Math.random())
trickle()
}, 350+(400*Math.random()))
}
$.zprogress = {
start: function(){
init()
clear()
value = LMARGIN
$wrapper.animate({ opacity: 1 })
$indicator.animate({ translateX: '0%' }, 0)
setTimeout(function(){
anim()
trickle()
},0)
},
inc: function(delta){
if(value<RMARGIN) value+=delta||.05
anim()
},
set: function(newValue){
init()
clear()
value = newValue
anim()
trickle()
},
done: function(){
init()
clear()
value = 1
anim()
setTimeout(function(){$wrapper.animate({ opacity: 0 })}, 100)
},
color: function(color){
init()
$indicator.css({ backgroundColor: color })
}
}
})(Zepto)

2
html/js/zprogress.min.js vendored Normal file
View File

@ -0,0 +1,2 @@
!function(e){function t(){i||(e("body").append(d),i=e("#zprogress"),n=e("#zprogress_indicator"))}function s(){n.animate({translateX:100*r+"%"},200)}function o(){l&&clearTimeout(l),l=void 0}function a(){l=setTimeout(function(){e.zprogress.inc(.035*(f-r)*Math.random()),a()},350+400*Math.random())}var i,n,r,l,d="<style>#zprogress{position:fixed;top:0;left:0;width:100%;height:3px;opacity:0;pointer-events:none;-webkit-pointer-events:none;z-index:1000}#zprogress_indicator{width:100%;margin-left:-100%;height:100%;background:#1c88ff}</style><div id=zprogress><div id=zprogress_indicator></div></div>",h=12.5,p=h/100,f=1-p;e.zprogress={start:function(){t(),o(),r=p,i.animate({opacity:1}),n.animate({translateX:"0%"},0),setTimeout(function(){s(),a()},0)},inc:function(e){f>r&&(r+=e||.05),s()},set:function(e){t(),o(),r=e,s(),a()},done:function(){t(),o(),r=1,s(),setTimeout(function(){i.animate({opacity:0})},100)},color:function(e){t(),n.css({backgroundColor:e})}}}(Zepto);
//# sourceMappingURL=zprogress.min.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["zprogress.js"],"names":["$","init","$wrapper","append","html","$indicator","anim","animate","translateX","value","clear","timeout","clearTimeout","undefined","trickle","setTimeout","zprogress","inc","RMARGIN","Math","random","MARGIN","LMARGIN","start","opacity","delta","set","newValue","done","color","css","backgroundColor","Zepto"],"mappings":"CAGC,SAAUA,GAWT,QAASC,KACJC,IAEHF,EAAE,QAAQG,OAAOC,GACjBF,EAAWF,EAAE,cACbK,EAAaL,EAAE,yBAGjB,QAASM,KACPD,EAAWE,SAAUC,WAAkB,IAANC,EAAU,KAAO,KAGpD,QAASC,KACJC,GAASC,aAAaD,GACzBA,EAAUE,OAGZ,QAASC,KACPH,EAAUI,WAAW,WACnBf,EAAEgB,UAAUC,IAAoB,MAAfC,EAAQT,GAAYU,KAAKC,UAC1CN,KACC,IAAK,IAAIK,KAAKC,UA/BnB,GAKElB,GAAUG,EAAYI,EAAOE,EAL3BP,EACF,iSAKAiB,EAAS,KACTC,EAAUD,EAAO,IACjBH,EAAU,EAAII,CA0BhBtB,GAAEgB,WACAO,MAAO,WACLtB,IACAS,IACAD,EAAQa,EACRpB,EAASK,SAAUiB,QAAS,IAC5BnB,EAAWE,SAAUC,WAAY,MAAQ,GACzCO,WAAW,WACTT,IACAQ,KACA,IAEJG,IAAK,SAASQ,GACHP,EAANT,IAAeA,GAAOgB,GAAO,KAChCnB,KAEFoB,IAAK,SAASC,GACZ1B,IACAS,IACAD,EAAQkB,EACRrB,IACAQ,KAEFc,KAAM,WACJ3B,IACAS,IACAD,EAAQ,EACRH,IACAS,WAAW,WAAWb,EAASK,SAAUiB,QAAS,KAAO,MAE3DK,MAAO,SAASA,GACd5B,IACAI,EAAWyB,KAAMC,gBAAiBF,OAGrCG"}

View File

@ -69,6 +69,10 @@ feeds.simple_test_feed = {
{
"count": 100,
"feed_url": "http://feed.androidauthority.com/"
},
{
"count": 100,
"feed_url": "https://feeds.feedburner.com/codinghorror"
}
]
};

2
tech.min.js vendored Normal file
View File

@ -0,0 +1,2 @@
var outputFile="tech",RssBraider=require("rss-braider"),fs=require("fs"),ejs=require("ejs"),read=require("fs").readFileSync,join=require("path").join,str=read(join(__dirname,"/templates/rss.ejs"),"utf8"),feeds={};feeds.simple_test_feed={feed_name:"feed",default_count:1,no_cdata_fields:[],meta:{title:"Technology",description:"Combined Tech Feed",site_url:"http://pipes.silvrtree.co.uk/tech.xml"},sources:[{count:100,feed_url:"http://feeds.feedburner.com/lenovoblogs/designmatters"},{count:100,feed_url:"http://www.engadget.com/rss.xml"},{count:100,feed_url:"http://www.computerweekly.com/rss/All-Computer-Weekly-content.xml"},{count:100,feed_url:"http://winsupersite.com/rss.xml"},{count:100,feed_url:"https://feeds.feedburner.com/TheGadgeteer"},{count:100,feed_url:"http://www.wired.com/category/gear/feed/"},{count:100,feed_url:"https://feeds2.feedburner.com/AndroidCommunity"},{count:100,feed_url:"https://feeds.feedburner.com/AndroidPolice"},{count:100,feed_url:"https://feeds.feedburner.com/AndroidPolice"},{count:100,feed_url:"https://feeds2.feedburner.com/PlanetAndroidCom"},{count:100,feed_url:"http://www.theverge.com/rss/frontpage"},{count:100,feed_url:"http://feed.androidauthority.com/"},{count:100,feed_url:"https://feeds.feedburner.com/codinghorror"}]};var braider_options={feeds:feeds,indent:" ",date_sort_order:"desc",log_level:"warn",dedupe_fields:["link","guid"]},rss_braider=RssBraider.createClient(braider_options);rss_braider.logger.level("off"),rss_braider.processFeed("simple_test_feed","json",function(e,t){if(e)return console.log(e);var s=JSON.parse(t),o=ejs.compile(str)(s);fs.writeFile(__dirname+"/html/"+outputFile+".html",o,function(e){return e?console.log(e):void console.log("The file was saved!")}),fs.writeFile(__dirname+"/html/"+outputFile+".json",t,function(e){return e?console.log(e):void console.log("The file was saved!")})}),rss_braider.processFeed("simple_test_feed","rss",function(e,t){return e?console.log(e):void fs.writeFile(__dirname+"/html/"+outputFile+".xml",t,function(e){return e?console.log(e):void console.log("The file was saved!")})});
//# sourceMappingURL=tech.min.js.map

1
tech.min.js.map Normal file
View File

@ -0,0 +1 @@
{"version":3,"sources":["tech.js"],"names":["outputFile","RssBraider","require","fs","ejs","read","readFileSync","join","str","__dirname","feeds","simple_test_feed","feed_name","default_count","no_cdata_fields","meta","title","description","site_url","sources","count","feed_url","braider_options","indent","date_sort_order","log_level","dedupe_fields","rss_braider","createClient","logger","level","processFeed","err","data","console","log","j","JSON","parse","ejsOutput","compile","writeFile"],"mappings":"AAAA,GAAIA,YAAa,OACbC,WAAaC,QAAQ,eACrBC,GAAKD,QAAQ,MACbE,IAAMF,QAAQ,OACdG,KAAOH,QAAQ,MAAMI,aACrBC,KAAOL,QAAQ,QAAQK,KACvBC,IAAMH,KAAKE,KAAKE,UAAW,sBAAuB,QAClDC,QAMJA,OAAMC,kBACFC,UAAa,OACbC,cAAiB,EACjBC,mBACAC,MACIC,MAAS,aAC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