mirror of
https://github.com/janeczku/calibre-web
synced 2025-10-27 21:37:40 +00:00
Initial Fork from https://bitbucket.org/raphaelmutschler/calibreserver/
This commit is contained in:
1999
cps/static/js/bootstrap.js
vendored
Normal file
1999
cps/static/js/bootstrap.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
6
cps/static/js/bootstrap.min.js
vendored
Normal file
6
cps/static/js/bootstrap.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
147
cps/static/js/context.js
Normal file
147
cps/static/js/context.js
Normal file
@@ -0,0 +1,147 @@
|
||||
/*!
|
||||
* context.js Library associated with > v0.9.6.2 of intention.js
|
||||
* http://intentionjs.com/
|
||||
*
|
||||
* Copyright 2011, 2013 Dowjones and other contributors
|
||||
* Released under the MIT license
|
||||
*
|
||||
*/
|
||||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
var context = function($, Intention){
|
||||
|
||||
// create a brand spankin new intention object
|
||||
var intent=new Intention(),
|
||||
// placeholder for the horizontal axis
|
||||
horizontal_axis,
|
||||
orientation_axis;
|
||||
|
||||
// throttle funtion used for keeping calls to the resize responive
|
||||
// callback to a minimum
|
||||
function throttle(callback, interval){
|
||||
var lastExec = new Date(),
|
||||
timer = null;
|
||||
|
||||
return function(e){
|
||||
var d = new Date();
|
||||
if (d-lastExec < interval) {
|
||||
if (timer) {
|
||||
window.clearTimeout(timer);
|
||||
}
|
||||
var callbackWrapper = function(event){
|
||||
return function(){
|
||||
callback(event);
|
||||
};
|
||||
};
|
||||
timer = window.setTimeout(callbackWrapper(e), interval);
|
||||
return false;
|
||||
}
|
||||
callback(e);
|
||||
lastExec = d;
|
||||
};
|
||||
}
|
||||
|
||||
// catchall
|
||||
// =======================================================================
|
||||
intent.responsive([{name:'base'}]).respond('base');
|
||||
|
||||
// width context?
|
||||
// =======================================================================
|
||||
horizontal_axis = intent.responsive({
|
||||
ID:'width',
|
||||
contexts: [
|
||||
{name:'standard', min:840},
|
||||
{name:'tablet', min:510},
|
||||
{name:'mobile', min:0}],
|
||||
// compare the return value of the callback to each context
|
||||
// return true for a match
|
||||
matcher: function(test, context){
|
||||
if(typeof test === 'string'){
|
||||
|
||||
return test === context.name;
|
||||
}
|
||||
return test>=context.min;
|
||||
},
|
||||
// callback, return value is passed to matcher()
|
||||
// to compare against current context
|
||||
measure: function(arg){
|
||||
|
||||
if(typeof arg === 'string'){
|
||||
return arg;
|
||||
}
|
||||
|
||||
return $(window).width();
|
||||
}});
|
||||
|
||||
// orientation context?
|
||||
// =======================================================================
|
||||
orientation_axis = intent.responsive({
|
||||
ID:'orientation',
|
||||
contexts: [{name:'portrait', rotation: 0},
|
||||
{name:'landscape', rotation:90}],
|
||||
matcher: function(measure, ctx){
|
||||
return measure === ctx.rotation;
|
||||
},
|
||||
measure: function(){
|
||||
var test = Math.abs(window.orientation);
|
||||
if(test > 0) {
|
||||
test = 180 - test;
|
||||
}
|
||||
return test;
|
||||
}
|
||||
});
|
||||
|
||||
// ONE TIME CHECK AXES:
|
||||
// touch device?
|
||||
// =======================================================================
|
||||
intent.responsive({
|
||||
ID:'touch',
|
||||
contexts:[{name:'touch'}],
|
||||
matcher: function() {
|
||||
return "ontouchstart" in window;
|
||||
}}).respond();
|
||||
|
||||
// retina display?
|
||||
// =======================================================================
|
||||
intent.responsive({
|
||||
ID: 'highres',
|
||||
// contexts
|
||||
contexts:[{name:'highres'}],
|
||||
// matching:
|
||||
matcher: function(){
|
||||
return window.devicePixelRatio > 1;
|
||||
}}).respond();
|
||||
|
||||
// bind events to the window
|
||||
$(window).on('resize', throttle(horizontal_axis.respond, 100))
|
||||
.on('orientationchange', horizontal_axis.respond)
|
||||
.on('orientationchange', orientation_axis.respond);
|
||||
|
||||
// register the current width and orientation without waiting for a window
|
||||
// resize
|
||||
horizontal_axis.respond();
|
||||
orientation_axis.respond();
|
||||
|
||||
$(function(){
|
||||
// at doc ready grab all of the elements in the doc
|
||||
intent.elements(document);
|
||||
});
|
||||
|
||||
// return the intention object so that it can be extended by other plugins
|
||||
return intent;
|
||||
};
|
||||
|
||||
(function (root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define('context', ['jquery', 'intention'], factory);
|
||||
} else {
|
||||
// Browser globals
|
||||
root.intent = factory(root.jQuery, root.Intention);
|
||||
}
|
||||
}(this, function ($, Intention) {
|
||||
return context($, Intention);
|
||||
}));
|
||||
}).call(this);
|
||||
2
cps/static/js/epub.min.js
vendored
Normal file
2
cps/static/js/epub.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
cps/static/js/hooks.min.js
vendored
Normal file
1
cps/static/js/hooks.min.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
EPUBJS.Hooks.register("beforeChapterDisplay").endnotes=function(a,b){var c=b.doc.querySelectorAll("a[href]"),d=Array.prototype.slice.call(c),e="epub:type",f="noteref",g=EPUBJS.core.folder(location.pathname),h=g+EPUBJS.cssPath||g,i={};EPUBJS.core.addCss(h+"popup.css",!1,b.doc.head),d.forEach(function(a){function c(){var c,e=b.iframe.height,f=b.iframe.width,j=225;o||(c=l.cloneNode(!0),o=c.querySelector("p")),b.replaceLinks.bind(this),i[k]||(i[k]=document.createElement("div"),i[k].setAttribute("class","popup"),pop_content=document.createElement("div"),i[k].appendChild(pop_content),pop_content.appendChild(o),pop_content.setAttribute("class","pop_content"),b.bodyEl.appendChild(i[k]),i[k].addEventListener("mouseover",d,!1),i[k].addEventListener("mouseout",g,!1),b.book.on("renderer:pageChanged",h,this),b.book.on("renderer:pageChanged",g,this)),c=i[k],itemRect=a.getBoundingClientRect(),m=itemRect.left,n=itemRect.top,c.classList.add("show"),popRect=c.getBoundingClientRect(),c.style.left=m-popRect.width/2+"px",c.style.top=n+"px",j>e/2.5&&(j=e/2.5,pop_content.style.maxHeight=j+"px"),popRect.height+n>=e-25?(c.style.top=n-popRect.height+"px",c.classList.add("above")):c.classList.remove("above"),m-popRect.width<=0?(c.style.left=m+"px",c.classList.add("left")):c.classList.remove("left"),m+popRect.width/2>=f?(c.style.left=m-300+"px",popRect=c.getBoundingClientRect(),c.style.left=m-popRect.width+"px",popRect.height+n>=e-25?(c.style.top=n-popRect.height+"px",c.classList.add("above")):c.classList.remove("above"),c.classList.add("right")):c.classList.remove("right")}function d(){i[k].classList.add("on")}function g(){i[k].classList.remove("on")}function h(){setTimeout(function(){i[k].classList.remove("show")},100)}var j,k,l,m,n,o,p=a.getAttribute(e);p==f&&(j=a.getAttribute("href"),k=j.replace("#",""),l=b.doc.getElementById(k),a.addEventListener("mouseover",c,!1),a.addEventListener("mouseout",h,!1))}),a&&a()},EPUBJS.Hooks.register("beforeChapterDisplay").mathml=function(a,b){if(-1!==b.currentChapter.properties.indexOf("mathml")){b.iframe.contentWindow.mathmlCallback=a;var c=document.createElement("script");c.type="text/x-mathjax-config",c.innerHTML=' MathJax.Hub.Register.StartupHook("End",function () { window.mathmlCallback(); }); MathJax.Hub.Config({jax: ["input/TeX","input/MathML","output/SVG"],extensions: ["tex2jax.js","mml2jax.js","MathEvents.js"],TeX: {extensions: ["noErrors.js","noUndefined.js","autoload-all.js"]},MathMenu: {showRenderer: false},menuSettings: {zoom: "Click"},messageStyle: "none"}); ',b.doc.body.appendChild(c),EPUBJS.core.addScript("http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML",null,b.doc.head)}else a&&a()},EPUBJS.Hooks.register("beforeChapterDisplay").smartimages=function(a,b){var c=b.doc.querySelectorAll("img"),d=Array.prototype.slice.call(c),e=b.bodyEl.clientHeight;d.forEach(function(a){function c(){var c,d=a.getBoundingClientRect(),f=d.height,g=d.top,h=a.getAttribute("data-height"),i=h||f;e=b.docEl.clientHeight,0>g&&(g=0),i+g>=e?(e/2>g?(c=e-g,a.style.maxHeight=c+"px",a.style.width="auto"):(c=e>i?i:e,a.style.maxHeight=c+"px",a.style.marginTop=e-g+"px",a.style.width="auto",console.log(c)),a.setAttribute("data-height",c)):(a.style.removeProperty("max-height"),a.style.removeProperty("margin-top"))}a.addEventListener("load",c,!1),b.on("renderer:resized",c),b.on("renderer:chapterUnloaded",function(){a.removeEventListener("load",c),b.off("renderer:resized",c)}),c()}),a&&a()},EPUBJS.Hooks.register("beforeChapterDisplay").transculsions=function(a,b){var c=b.doc.querySelectorAll("[transclusion]"),d=Array.prototype.slice.call(c);d.forEach(function(a){function c(){j=g,k=h,j>b.colWidth&&(d=b.colWidth/j,j=b.colWidth,k*=d),f.width=j,f.height=k}var d,e=a.getAttribute("ref"),f=document.createElement("iframe"),g=a.getAttribute("width"),h=a.getAttribute("height"),i=a.parentNode,j=g,k=h;c(),b.book.listenUntil("book:resized","book:chapterDestroy",c),f.src=e,i.replaceChild(f,a)}),a&&a()};
|
||||
1
cps/static/js/inflate.js
Normal file
1
cps/static/js/inflate.js
Normal file
File diff suppressed because one or more lines are too long
564
cps/static/js/intention.js
Normal file
564
cps/static/js/intention.js
Normal file
@@ -0,0 +1,564 @@
|
||||
/*!
|
||||
* intention.js Library v0.9.7.2
|
||||
* http://intentionjs.com/
|
||||
*
|
||||
* Copyright 2011, 2013 Dowjones and other contributors
|
||||
* Released under the MIT license
|
||||
*
|
||||
*/
|
||||
|
||||
(function(root, factory) {
|
||||
|
||||
'use strict';
|
||||
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
define('intention', ['jquery', 'underscore'], factory);
|
||||
} else {
|
||||
root.Intention = factory(root.jQuery, root._);
|
||||
}
|
||||
}(this, function($, _) {
|
||||
'use strict';
|
||||
|
||||
var Intention = function(params){
|
||||
var intent = _.extend(this, params,
|
||||
{_listeners:{}, contexts:[], elms:$(), axes:{}, priority:[]});
|
||||
|
||||
return intent;
|
||||
};
|
||||
|
||||
Intention.prototype = {
|
||||
|
||||
// public methods
|
||||
responsive:function responsive(contexts, options){
|
||||
// for generating random ids for axis when not specified
|
||||
var idChars = 'abcdefghijklmnopqrstuvwxyz0123456789',
|
||||
id='', i;
|
||||
|
||||
// create a random id for the axis
|
||||
for(i=0; i<5; i++){
|
||||
id += idChars[Math.floor(Math.random() * idChars.length)];
|
||||
}
|
||||
var defaults = {
|
||||
// if no matcher function is specified expect to compare a
|
||||
// string to the ctx.name property
|
||||
matcher: function(measure, ctx){
|
||||
return measure === ctx.name;
|
||||
},
|
||||
// function takes one arg and returns it
|
||||
measure: _.identity,
|
||||
ID: id
|
||||
};
|
||||
|
||||
if(_.isObject(options) === false) {
|
||||
options = {};
|
||||
}
|
||||
|
||||
if((_.isArray(contexts)) && (_.isArray(contexts[0].contexts))){
|
||||
_.each(contexts, function(axis){
|
||||
responsive.apply(this, axis);
|
||||
}, this);
|
||||
return;
|
||||
}
|
||||
|
||||
if((_.isArray(contexts) === false) && _.isObject(contexts)){
|
||||
options = contexts;
|
||||
} else {
|
||||
options.contexts = contexts;
|
||||
}
|
||||
|
||||
// fill in the options
|
||||
options = _.extend({}, defaults, options);
|
||||
|
||||
// bind an the respond function to the axis ID and prefix it
|
||||
// with an underscore so that it does not get whomped accidentally
|
||||
this.on('_' + options.ID + ':', _.bind(
|
||||
function(e){
|
||||
this.axes = this._contextualize(
|
||||
options.ID, e.context, this.axes);
|
||||
this._respond(this.axes, this.elms);
|
||||
|
||||
}, this));
|
||||
|
||||
var axis = {
|
||||
ID:options.ID,
|
||||
current:null,
|
||||
contexts:options.contexts,
|
||||
respond:_.bind(this._responder(options.ID, options.contexts,
|
||||
options.matcher, options.measure), this)
|
||||
};
|
||||
|
||||
this.axes[options.ID] = axis;
|
||||
|
||||
this.axes.__keys__ = this.priority;
|
||||
|
||||
this.priority.unshift(options.ID);
|
||||
|
||||
return axis;
|
||||
},
|
||||
|
||||
elements: function(scope){
|
||||
|
||||
// find all responsive elms in a specific dom scope
|
||||
if(!scope){
|
||||
scope = document;
|
||||
}
|
||||
|
||||
$('[data-intent],[intent],[data-in],[in]',
|
||||
scope).each(_.bind(function(i, elm){
|
||||
this.add($(elm));
|
||||
}, this));
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
add: function(elms, options){
|
||||
|
||||
var spec;
|
||||
|
||||
if(!options) {
|
||||
options = {};
|
||||
}
|
||||
|
||||
// is expecting a jquery object
|
||||
elms.each(_.bind(function(i, elm){
|
||||
var exists = false;
|
||||
this.elms.each(function(i, respElm){
|
||||
if(elm === respElm) {
|
||||
exists=true;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
if(exists === false){
|
||||
// create the elements responsive data
|
||||
spec = this._fillSpec(
|
||||
_.extend(options, this._attrsToSpec(elm.attributes, this.axes)));
|
||||
// make any appropriate changes based on the current contexts
|
||||
this._makeChanges($(elm), spec, this.axes);
|
||||
|
||||
this.elms.push({
|
||||
elm: elm,
|
||||
spec: spec
|
||||
});
|
||||
}
|
||||
|
||||
}, this));
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
remove: function(elms){
|
||||
// is expecting a jquery object
|
||||
var respElms = this.elms;
|
||||
// elms to remove
|
||||
elms.each(function(i, elm){
|
||||
// elms to check against
|
||||
respElms.each(function(i, candidate){
|
||||
if(elm === candidate.elm){
|
||||
respElms.splice(i, 1);
|
||||
// found the match, break the loop
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
});
|
||||
return this;
|
||||
},
|
||||
|
||||
is: function(ctxName){
|
||||
var axes = this.axes;
|
||||
return _.some(axes.__keys__, function(key){
|
||||
return ctxName === axes[key].current;
|
||||
});
|
||||
},
|
||||
|
||||
current: function(axisName){
|
||||
if(this.axes.hasOwnProperty(axisName)){
|
||||
return this.axes[axisName].current;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
|
||||
// code and concept taken from simple implementation of
|
||||
// observer pattern outlined here:
|
||||
// http://www.nczonline.net/blog/2010/03/09/custom-events-in-javascript/
|
||||
on: function(type, listener){
|
||||
|
||||
var events = type.split(' '),
|
||||
i=0;
|
||||
|
||||
for(i;i<events.length;i++){
|
||||
if(this._listeners[events[i]] === undefined) {
|
||||
this._listeners[events[i]]=[];
|
||||
}
|
||||
this._listeners[events[i]].push(listener);
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
off: function(type, listener){
|
||||
if(_.isArray(this._listeners[type])){
|
||||
var listeners = this._listeners[type],
|
||||
i;
|
||||
for(i=0;listeners.length; i++){
|
||||
if(listeners[i] === listener){
|
||||
listeners.splice(i,1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return this;
|
||||
},
|
||||
|
||||
// privates
|
||||
_responder: function(axisID, contexts, matcher, measure){
|
||||
|
||||
var currentContext;
|
||||
|
||||
// called to perform a check
|
||||
return function(){
|
||||
|
||||
var measurement = measure.apply(this, arguments);
|
||||
|
||||
_.every(contexts, function(ctx){
|
||||
if( matcher(measurement, ctx)) {
|
||||
// first time, or different than last context
|
||||
if( (currentContext===undefined) ||
|
||||
(ctx.name !== currentContext.name)){
|
||||
|
||||
currentContext = ctx;
|
||||
|
||||
// event emitting!
|
||||
// emit the private axis event
|
||||
this._emitter(
|
||||
{_type: '_' + axisID + ':', context:currentContext.name},
|
||||
currentContext, this)
|
||||
|
||||
// emit the public axis event
|
||||
._emitter({_type: axisID + ':', context:currentContext.name},
|
||||
currentContext, this)
|
||||
|
||||
// attempt to trigger the axis to context pair
|
||||
._emitter(_.extend({},
|
||||
{_type: axisID + ':' + currentContext.name},
|
||||
currentContext), currentContext, this)
|
||||
|
||||
// then emit the context event (second ensures the context
|
||||
// changes happen after all dom manipulations)
|
||||
._emitter(_.extend({}, {_type:currentContext.name},
|
||||
currentContext), currentContext, this);
|
||||
|
||||
// done, break the loop
|
||||
return false;
|
||||
}
|
||||
// same context, break the loop
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}, this);
|
||||
|
||||
// return the intention object for chaining
|
||||
return this;
|
||||
};
|
||||
},
|
||||
|
||||
_emitter: function(event){
|
||||
if(typeof event === 'string') {
|
||||
event={_type:event};
|
||||
}
|
||||
if(!event.target){
|
||||
event.target=this;
|
||||
}
|
||||
if(!event._type){
|
||||
throw new Error(event._type + ' is not a supported event.');
|
||||
}
|
||||
if(_.isArray(this._listeners[event._type])){
|
||||
var listeners = this._listeners[event._type],
|
||||
i;
|
||||
for(i=0; i<listeners.length; i++){
|
||||
listeners[i].apply(this, arguments);
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
_fillSpec: function(spec){
|
||||
|
||||
var applySpec = function(fn){
|
||||
_.each(spec, function(axisOptions, axis){
|
||||
_.each(axisOptions, function(ctxOptions, ctx){
|
||||
fn(ctxOptions, ctx, axis);
|
||||
});
|
||||
});
|
||||
}, filler={};
|
||||
|
||||
applySpec(function(options){
|
||||
// check to see if the ctx val is an object, could be a string
|
||||
if(_.isObject(options)){
|
||||
_.each(options, function(val, func){
|
||||
filler[func] = '';
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
applySpec(function(options, ctx, axis){
|
||||
if(_.isObject(options)){
|
||||
spec[axis][ctx] = _.extend({}, filler, options);
|
||||
}
|
||||
});
|
||||
|
||||
return spec;
|
||||
},
|
||||
|
||||
_assocAxis: function(ctx, axes){
|
||||
|
||||
var match=false;
|
||||
|
||||
_.every(axes.__keys__, function(axis){
|
||||
|
||||
if(match === false){
|
||||
_.every(axes[axis].contexts, function(ctxCandidate){
|
||||
if(ctxCandidate.name === ctx){
|
||||
match = axis;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
return true;
|
||||
}else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
return match;
|
||||
},
|
||||
|
||||
_makeSpec: function(axis, ctx, sAttr, value, spec){
|
||||
var axisObj,
|
||||
ctxObj;
|
||||
|
||||
if(spec[axis] !== undefined){
|
||||
axisObj = spec[axis];
|
||||
|
||||
if(axisObj[ctx] === undefined) {
|
||||
axisObj[ctx] = {};
|
||||
}
|
||||
} else {
|
||||
axisObj = {};
|
||||
axisObj[ctx] = {};
|
||||
spec[axis] = axisObj;
|
||||
}
|
||||
axisObj[ctx][sAttr] = value;
|
||||
|
||||
return spec;
|
||||
},
|
||||
|
||||
_attrsToSpec: function(attrs, axes){
|
||||
|
||||
var spec={},
|
||||
fullPattern = new RegExp(
|
||||
'^(data-)?(in|intent)-(([a-zA-Z0-9][a-zA-Z0-9]*:)?([a-zA-Z0-9]*))-([A-Za-z:-]+)'),
|
||||
axisPattern = new RegExp(
|
||||
'^(data-)?(in|intent)-([a-zA-Z0-9][_a-zA-Z0-9]*):$');
|
||||
|
||||
_.each(attrs, function(attr){
|
||||
|
||||
var specMatch = attr.name.match(fullPattern),
|
||||
axisName;
|
||||
|
||||
if(specMatch !== null) {
|
||||
|
||||
specMatch = specMatch.slice(-3);
|
||||
axisName = specMatch[0];
|
||||
|
||||
if(specMatch[0] === undefined){
|
||||
|
||||
// if there is no axis find one:
|
||||
specMatch[0] = this._assocAxis(specMatch[1], axes);
|
||||
|
||||
if(specMatch[0] === false) {
|
||||
// there is no context, so get outa here
|
||||
return; // skipt the attr
|
||||
}
|
||||
} else {
|
||||
specMatch[0] = specMatch[0].replace(/:$/, '');}
|
||||
|
||||
specMatch.push(attr.value);
|
||||
specMatch.push(spec);
|
||||
|
||||
spec = this._makeSpec.apply(this, specMatch);
|
||||
|
||||
} else if(axisPattern.test(attr.name)){
|
||||
|
||||
axisName = attr.name.match(axisPattern)[3];
|
||||
|
||||
_.each(axes[axisName].contexts,
|
||||
function(context){
|
||||
this._makeSpec(axisName, context.name, 'class', context.name +
|
||||
' ' + attr.value, spec);
|
||||
},
|
||||
this);}},
|
||||
this);
|
||||
|
||||
return spec;
|
||||
},
|
||||
|
||||
_contextSpec: function(ctxObj, specs){
|
||||
if(specs.hasOwnProperty(ctxObj.axis) &&
|
||||
specs[ctxObj.axis].hasOwnProperty(ctxObj.ctx)){
|
||||
return specs[ctxObj.axis][ctxObj.ctx];
|
||||
}
|
||||
return {};
|
||||
},
|
||||
_resolveSpecs: function(currentContexts, specs){
|
||||
|
||||
var changes={},
|
||||
moveFuncs=['append', 'prepend', 'before', 'after'];
|
||||
|
||||
_.each(currentContexts, function(ctxObj){
|
||||
// if the axis or the context to not exist in the specs object
|
||||
// skip to the next one
|
||||
_.each(this._contextSpec(ctxObj, specs), function(val, func){
|
||||
|
||||
if(func==='class'){
|
||||
if(!changes[func]){
|
||||
changes[func] = [];
|
||||
}
|
||||
changes[func] = _.union(changes[func], val.split(' '));
|
||||
|
||||
} else if(((changes.move === undefined) ||
|
||||
(changes.move.value === '')) &&
|
||||
($.inArray(func, moveFuncs) !== -1)){
|
||||
|
||||
changes.move = {value:val, placement:func};
|
||||
|
||||
} else {
|
||||
if((changes[func] === undefined) || (changes[func] === '')){
|
||||
changes[func]=val;
|
||||
}
|
||||
}
|
||||
}, this);
|
||||
}, this);
|
||||
return changes;
|
||||
},
|
||||
|
||||
_currentContexts: function(axes) {
|
||||
var contexts = [];
|
||||
|
||||
_.each(axes.__keys__, function(ID){
|
||||
if(axes[ID].current !== null) {
|
||||
contexts.push({ctx:axes[ID].current, axis:ID});
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
return contexts;
|
||||
},
|
||||
|
||||
_removeClasses: function(specs, axes) {
|
||||
|
||||
var toRemove = [];
|
||||
|
||||
_.each(axes.__keys__, function(key){
|
||||
|
||||
var axis = axes[key];
|
||||
|
||||
_.each(axis.contexts, function(ctx){
|
||||
|
||||
// ignore the current context, those classes SHOULD be applied
|
||||
if(ctx.name === axis.current) {
|
||||
return;
|
||||
}
|
||||
var contextSpec = this._contextSpec(
|
||||
{axis:axis.ID, ctx:ctx.name}, specs),
|
||||
classes;
|
||||
|
||||
if(contextSpec !== undefined) {
|
||||
if(contextSpec['class'] !== undefined) {
|
||||
classes = contextSpec['class'].split(' ');
|
||||
if(classes !== undefined){
|
||||
toRemove = _.union(toRemove, classes);
|
||||
}
|
||||
}
|
||||
}
|
||||
}, this);
|
||||
|
||||
}, this);
|
||||
|
||||
return toRemove;
|
||||
},
|
||||
|
||||
_contextConfig: function(specs, axes){
|
||||
|
||||
return this._resolveSpecs(this._currentContexts(axes), specs, axes);
|
||||
},
|
||||
|
||||
_makeChanges: function(elm, specs, axes){
|
||||
|
||||
if(_.isEmpty(axes)===false){
|
||||
var ctxConfig = this._contextConfig(specs, axes);
|
||||
|
||||
_.each(ctxConfig, function(change, func){
|
||||
if(func==='move'){
|
||||
if( (specs.__placement__ !== change.placement) ||
|
||||
(specs.__move__ !== change.value)){
|
||||
|
||||
$(change.value)[change.placement](elm);
|
||||
|
||||
// save the last placement of the element so
|
||||
// we're not moving it around for no good reason
|
||||
specs.__placement__ = change.placement;
|
||||
specs.__move__ = change.value;
|
||||
}
|
||||
} else if(func === 'class') {
|
||||
|
||||
var classes = elm.attr('class') || '';
|
||||
|
||||
// the class add/remove formula
|
||||
classes = _.union(change,
|
||||
_.difference(classes.split(' '),
|
||||
this._removeClasses(specs, axes)));
|
||||
|
||||
elm.attr('class', classes.join(' '));
|
||||
|
||||
} else {
|
||||
elm.attr(func, change);
|
||||
}
|
||||
}, this);
|
||||
}
|
||||
return elm;
|
||||
},
|
||||
|
||||
_respond: function(axes, elms){
|
||||
// go through all of the responsive elms
|
||||
elms.each(_.bind(function(i, elm){
|
||||
var $elm = $(elm.elm);
|
||||
this._makeChanges($elm, elm.spec, axes);
|
||||
$elm.trigger('intent', this);
|
||||
}, this));
|
||||
},
|
||||
|
||||
_contextualize: function(axisID, context, axes){
|
||||
axes[axisID].current = context;
|
||||
return axes;
|
||||
},
|
||||
|
||||
// private props
|
||||
|
||||
// axis test, does it begin with an underscore? for testing inside
|
||||
// spec objects
|
||||
_axis_test_pattern: new RegExp("^_[a-zA-Z0-9]"),
|
||||
|
||||
// match a group after the underscore:
|
||||
_axis_match_pattern: new RegExp("^_([a-zA-Z0-9][_a-zA-Z0-9]*)"),
|
||||
|
||||
// simple trim
|
||||
_trim_pattern:new RegExp( "^\s+|\s+$", "g" )
|
||||
};
|
||||
|
||||
return Intention;
|
||||
}));
|
||||
4
cps/static/js/jquery.magnific-popup.min.js
vendored
Normal file
4
cps/static/js/jquery.magnific-popup.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
11
cps/static/js/jquery.vegas.min.js
vendored
Normal file
11
cps/static/js/jquery.vegas.min.js
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// Vegas – Fullscreen Backgrounds and Slideshows with jQuery.
|
||||
// v1.3.3 - released 2013-09-03 13:27
|
||||
// Licensed under the MIT license.
|
||||
// http://vegas.jaysalvat.com/
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright (C) 2010-2013 Jay Salvat
|
||||
// http://jaysalvat.com/
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
(function(e){function t(a,n){var r={align:"center",valign:"center"};if(e.extend(r,n),0===a.height())return a.load(function(){t(e(this),n)}),void 0;var i,s,g,d=o(),l=d.width,u=d.height,v=a.width(),c=a.height(),p=u/l,f=c/v;p>f?(i=u/f,s=u):(i=l,s=l*f),g={width:i+"px",height:s+"px",top:"auto",bottom:"auto",left:"auto",right:"auto"},isNaN(parseInt(r.valign,10))?"top"==r.valign?g.top=0:"bottom"==r.valign?g.bottom=0:g.top=(u-s)/2:g.top=0-(s-u)/100*parseInt(r.valign,10)+"px",isNaN(parseInt(r.align,10))?"left"==r.align?g.left=0:"right"==r.align?g.right=0:g.left=(l-i)/2:g.left=0-(i-l)/100*parseInt(r.align,10)+"px",a.css(g)}function a(){d.prependTo("body").fadeIn()}function n(){d.fadeOut("fast",function(){e(this).remove()})}function r(){return e("body").css("backgroundImage")?e("body").css("backgroundImage").replace(/url\("?(.*?)"?\)/i,"$1"):void 0}function o(){var e=window,t="inner";return"innerWidth"in window||(e=document.documentElement||document.body,t="client"),{width:e[t+"Width"],height:e[t+"Height"]}}var i,s=e("<img />").addClass("vegas-background"),g=e("<div />").addClass("vegas-overlay"),d=e("<div />").addClass("vegas-loading"),l=e(),u=null,v=[],c=0,p=5e3,f=function(){},h={init:function(o){var i={src:r(),align:"center",valign:"center",fade:0,loading:!0,load:function(){},complete:function(){}};e.extend(i,e.vegas.defaults.background,o),i.loading&&a();var g=s.clone();return g.css({position:"fixed",left:"0px",top:"0px"}).bind("load",function(){g!=l&&(e(window).bind("load resize.vegas",function(){t(g,i)}),l.is("img")?(l.stop(),g.hide().insertAfter(l).fadeIn(i.fade,function(){e(".vegas-background").not(this).remove(),e("body").trigger("vegascomplete",[this,c-1]),i.complete.apply(g,[c-1])})):g.hide().prependTo("body").fadeIn(i.fade,function(){e("body").trigger("vegascomplete",[this,c-1]),i.complete.apply(this,[c-1])}),l=g,t(l,i),i.loading&&n(),e("body").trigger("vegasload",[l.get(0),c-1]),i.load.apply(l.get(0),[c-1]),c&&(e("body").trigger("vegaswalk",[l.get(0),c-1]),i.walk.apply(l.get(0),[c-1])))}).attr("src",i.src),e.vegas},destroy:function(t){return t&&"background"!=t||(e(".vegas-background, .vegas-loading").remove(),e(window).unbind("*.vegas"),l=e()),t&&"overlay"!=t||e(".vegas-overlay").remove(),clearInterval(i),e.vegas},overlay:function(t){var a={src:null,opacity:null};return e.extend(a,e.vegas.defaults.overlay,t),g.remove(),g.css({margin:"0",padding:"0",position:"fixed",left:"0px",top:"0px",width:"100%",height:"100%"}),a.src&&g.css("backgroundImage","url("+a.src+")"),a.opacity&&g.css("opacity",a.opacity),g.prependTo("body"),e.vegas},slideshow:function(t,a){var n={step:c,delay:p,preload:!1,backgrounds:v,walk:f};if(e.extend(n,e.vegas.defaults.slideshow,t),n.backgrounds!=v&&(t.step||(n.step=0),t.walk||(n.walk=function(){}),n.preload&&e.vegas("preload",n.backgrounds)),v=n.backgrounds,p=n.delay,c=n.step,f=n.walk,clearInterval(i),!v.length)return e.vegas;var r=function(){0>c&&(c=v.length-1),(c>=v.length||!v[c-1])&&(c=0);var t=v[c++];t.walk=n.walk,t.fade===void 0&&(t.fade=n.fade),t.fade>n.delay&&(t.fade=n.delay),e.vegas(t)};return r(),a||(u=!1,e("body").trigger("vegasstart",[l.get(0),c-1])),u||(i=setInterval(r,n.delay)),e.vegas},next:function(){var t=c;return c&&(e.vegas("slideshow",{step:c},!0),e("body").trigger("vegasnext",[l.get(0),c-1,t-1])),e.vegas},previous:function(){var t=c;return c&&(e.vegas("slideshow",{step:c-2},!0),e("body").trigger("vegasprevious",[l.get(0),c-1,t-1])),e.vegas},jump:function(t){var a=c;return c&&(e.vegas("slideshow",{step:t},!0),e("body").trigger("vegasjump",[l.get(0),c-1,a-1])),e.vegas},stop:function(){var t=c;return c=0,u=null,clearInterval(i),e("body").trigger("vegasstop",[l.get(0),t-1]),e.vegas},pause:function(){return u=!0,clearInterval(i),e("body").trigger("vegaspause",[l.get(0),c-1]),e.vegas},get:function(e){return null===e||"background"==e?l.get(0):"overlay"==e?g.get(0):"step"==e?c-1:"paused"==e?u:void 0},preload:function(t){var a=[];for(var n in t)if(t[n].src){var r=document.createElement("img");r.src=t[n].src,a.push(r)}return e.vegas}};e.vegas=function(t){return h[t]?h[t].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof t&&t?(e.error("Method "+t+" does not exist"),void 0):h.init.apply(this,arguments)},e.vegas.defaults={background:{},slideshow:{},overlay:{}}})(jQuery);
|
||||
27
cps/static/js/main.js
Executable file
27
cps/static/js/main.js
Executable file
@@ -0,0 +1,27 @@
|
||||
|
||||
|
||||
$(function() {
|
||||
$('.discover .row').isotope({
|
||||
// options
|
||||
itemSelector : '.book',
|
||||
layoutMode : 'fitRows'
|
||||
});
|
||||
|
||||
$('.load-more .row').infinitescroll({
|
||||
debug: false,
|
||||
navSelector : ".pagination",
|
||||
// selector for the paged navigation (it will be hidden)
|
||||
nextSelector : ".pagination a:last",
|
||||
// selector for the NEXT link (to page 2)
|
||||
itemSelector : ".load-more .book",
|
||||
animate : true,
|
||||
extraScrollPx: 300,
|
||||
// selector for all items you'll retrieve
|
||||
}, function(data){
|
||||
$('.load-more .row').isotope( 'appended', $(data), null );
|
||||
});
|
||||
});
|
||||
|
||||
$(window).resize(function(event) {
|
||||
$('.discover .row').isotope('reLayout');
|
||||
});
|
||||
31
cps/static/js/plugins.js
Executable file
31
cps/static/js/plugins.js
Executable file
File diff suppressed because one or more lines are too long
7
cps/static/js/screenfull.min.js
vendored
Normal file
7
cps/static/js/screenfull.min.js
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
/*!
|
||||
* screenfull
|
||||
* v1.1.0 - 2013-09-06
|
||||
* https://github.com/sindresorhus/screenfull.js
|
||||
* (c) Sindre Sorhus; MIT License
|
||||
*/
|
||||
!function(a,b){"use strict";var c="undefined"!=typeof Element&&"ALLOW_KEYBOARD_INPUT"in Element,d=function(){for(var a,c,d=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenchange","MSFullscreenerror"]],e=0,f=d.length,g={};f>e;e++)if(a=d[e],a&&a[1]in b){for(e=0,c=a.length;c>e;e++)g[d[0][e]]=a[e];return g}return!1}(),e={request:function(a){var e=d.requestFullscreen;a=a||b.documentElement,/5\.1[\.\d]* Safari/.test(navigator.userAgent)?a[e]():a[e](c&&Element.ALLOW_KEYBOARD_INPUT)},exit:function(){b[d.exitFullscreen]()},toggle:function(a){this.isFullscreen?this.exit():this.request(a)},onchange:function(){},onerror:function(){},raw:d};return d?(Object.defineProperties(e,{isFullscreen:{get:function(){return!!b[d.fullscreenElement]}},element:{enumerable:!0,get:function(){return b[d.fullscreenElement]}},enabled:{enumerable:!0,get:function(){return!!b[d.fullscreenEnabled]}}}),b.addEventListener(d.fullscreenchange,function(a){e.onchange.call(e,a)}),b.addEventListener(d.fullscreenerror,function(a){e.onerror.call(e,a)}),a.screenfull=e,void 0):(a.screenfull=!1,void 0)}(window,document);
|
||||
6
cps/static/js/underscore.min.js
vendored
Executable file
6
cps/static/js/underscore.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
6
cps/static/js/vendor/jquery-1.10.1.min.js
vendored
Normal file
6
cps/static/js/vendor/jquery-1.10.1.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
11
cps/static/js/vendor/modernizr-2.6.2-respond-1.1.0.min.js
vendored
Normal file
11
cps/static/js/vendor/modernizr-2.6.2-respond-1.1.0.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
29
cps/static/js/zip.min.js
vendored
Normal file
29
cps/static/js/zip.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user