code
stringlengths 2
1.05M
| repo_name
stringlengths 5
114
| path
stringlengths 4
991
| language
stringclasses 1
value | license
stringclasses 15
values | size
int32 2
1.05M
|
---|---|---|---|---|---|
jsonp({"cep":"05586901","logradouro":"Rua Corinto","bairro":"Vila Indiana","cidade":"S\u00e3o Paulo","uf":"SP","estado":"S\u00e3o Paulo"});
| lfreneda/cepdb | api/v1/05586901.jsonp.js | JavaScript | cc0-1.0 | 140 |
var config = {
type: Phaser.WEBGL,
width: 800,
height: 600,
parent: 'phaser-example',
physics: {
default: 'impact',
impact: {
gravity: 100,
debug: true,
setBounds: {
x: 100,
y: 100,
width: 600,
height: 300,
thickness: 32
},
maxVelocity: 500
}
},
scene: {
preload: preload,
create: create
}
};
var game = new Phaser.Game(config);
function preload ()
{
this.load.image('gem', 'assets/sprites/gem.png');
}
function create ()
{
// The world bounds have been set in the config.
// If you don't set the body as active it won't collide with the world bounds
this.impact.add.image(300, 300, 'gem').setActiveCollision().setVelocity(300, 200).setBounce(1);
// It is your responsibility to ensure that new bodies are spawned within the world bounds.
}
| boniatillo-com/PhaserEditor | source/v2/phasereditor/phasereditor.resources.phaser.examples/phaser3-examples/public/src/physics/impact/small world bounds from config.js | JavaScript | epl-1.0 | 981 |
/*
* Copyright (c) 2015-2016 Codenvy, S.A.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Codenvy, S.A. - initial API and implementation
*/
'use strict';
/**
* This class is handling the controller for the ready-to-go stacks
* @author Florent Benoit
* @author Oleksii Orel
*/
export class ReadyToGoStacksController {
/**
* Default constructor that is using resource
* @ngInject for Dependency injection
*/
constructor($timeout, $rootScope, lodash, cheStack) {
this.$timeout = $timeout;
this.$rootScope = $rootScope;
this.lodash = lodash;
this.cheStack = cheStack;
this.generalStacks = [];
this.stacks = cheStack.getStacks();
if (this.stacks.length) {
this.updateData();
} else {
cheStack.fetchStacks().then(() => {
this.updateData();
});
}
}
/**
* Update stacks' data
*/
updateData() {
this.stacks.forEach((stack) => {
if (stack.scope !== 'general') {
return;
}
let generalStack = angular.copy(stack);
let findLink = this.lodash.find(generalStack.links, (link) => {
return link.rel === 'get icon link';
});
if (findLink) {
generalStack.iconSrc = findLink.href;
}
this.generalStacks.push(generalStack);
});
// broadcast event
this.$rootScope.$broadcast('create-project-stacks:initialized');
}
/**
* Joins the tags into a string
*/
tagsToString(tags) {
return tags.join(', ');
}
/**
* Gets privileged stack position
*/
getPrivilegedSortPosition(item) {
let privilegedNames = ['Java', 'Blank'];
let sortPos = privilegedNames.indexOf(item.name);
if (sortPos > -1) {
return sortPos;
}
return privilegedNames.length;
}
/**
* Select stack
*/
select(stack) {
this.stack = stack;
this.$timeout(() => {
this.onChange();
});
}
/**
* When initializing with the first item, select it
*/
initValue(isFirst, stack) {
if (isFirst) {
this.select(stack);
}
}
}
| slemeur/che | dashboard/src/app/workspaces/create-workspace/select-stack/ready-to-go-stacks/ready-to-go-stacks.controller.js | JavaScript | epl-1.0 | 2,271 |
//
// This file is part of Invenio.
// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 CERN.
//
// Invenio is free software; you can redistribute it and / or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; either version 2 of the
// License, or (at your option) any later version.
//
// Invenio is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Invenio; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111 - 1307, USA.
/**
* Contains all code for the Ticket Box App under the ticketbox namespace
* @type {{module: module}}
*/
var ticketbox = {
// Closure to protect modules.
module: function() {
// Module store.
var modules = {};
// Return shared module reference or create a new one.
return function(name) {
if (modules[name]) {
return modules[name]
}
return modules[name] = { Views : {} }
};
}(),
app: { debug: false }
};
/**
* Module that defines Server boundary
* Immediately-Invoked Function Expression. (IIFE)
*/
(function(ticketbox, Server) {
// Dependencies
var app = ticketbox.app;
Server.dataOn = function(data, on) {
var add = {
user: {"on":"user"},
autoclaim: {"on":"autoclaim"}
};
if (on in add) {
return $.extend({}, data, add[on]);
} else {
app.debug && console.error("[Server Sync] ERROR: No ticket target, using 'user' as default!");
return $.extend({}, data, {"on":'user'});
}
};
Server.process = function(type, on, data) {
// Populate data with ticket target, default is 'user'
var params = {type: 'POST', dataType: 'json'};
params.data = {};
params.data.jsondata = Server.dataOn({}, on);
// Set success and error callbacks
params.success = function() {
app.userops.fetch({success: data.success});
};
params.error = data.error || function() {
app.userops.fetch();
app.debug && console.error("[Server Process] ERROR: Processing Error.");
};
var message = "[Server Process] ";
switch(type) {
case "commit":
params.url = "/author/ticket/commit";
params.data.jsondata = $.extend({}, params.data.jsondata, data.data);
message += "Commit: " + JSON.stringify(params);
break;
case "abort":
params.url = "/author/ticket/abort";
message += "Abort: " + JSON.stringify(params);
break;
case "update":
params.url = "/author/ticket/update_status";
message += "Update: " + JSON.stringify(params);
break;
default:
message += "ERROR: Unknown process type.";
console.log(message);
return;
}
app.debug && console.log(message);
params.data.jsondata = JSON.stringify(params.data.jsondata);
Backbone.ajax(params);
};
Server.sync = function(method, model, options) {
var params = {type: 'POST', dataType: 'json'};
// Populate data with ticket target, default is 'user'
params.data = {};
params.data.jsondata = Server.dataOn({}, options.on);
// Set success and error callbacks
params.success = options.success;
params.error = options.error;
var generateRequest = function(type) {
var requestTypes = {
add: function() {
return {
'pid': model.get('pid'),
'action': model.get('action'),
'bibrefrec': model.bibrefrec(),
'on': model.get('on')
}
},
get_status: function() {
return {
'on': model.get('on')
}
}
};
requestTypes.modify = requestTypes.add;
requestTypes.remove = requestTypes.add;
if (type in requestTypes) {
return requestTypes[type]();
} else {
app.debug && console.error("[Operation Model] ERROR: No request type defined.");
return {};
}
}
switch (method) {
case 'create':
params.url = "/author/ticket/add_operation";
params.data.jsondata = $.extend({}, generateRequest('add'), params.data.jsondata);
break;
case 'update':
params.url = "/author/ticket/modify_operation";
params.data.jsondata = $.extend({}, generateRequest('modify'), params.data.jsondata);
break;
case 'delete':
params.url = "/author/ticket/remove_operation";
params.data.jsondata = $.extend({}, generateRequest('remove'), params.data.jsondata);
break;
case 'read':
params.url = "/author/ticket/get_status";
params.data.jsondata = $.extend({}, generateRequest('get_status'), params.data.jsondata);
break;
}
params.data.jsondata = JSON.stringify(params.data.jsondata);
Backbone.ajax(params);
};
Server.search = function(type, data, options) {
var params = {type: 'POST', dataType: 'json', data: {}};
// Set success and error callbacks and context
params.success = options.success;
params.error = options.error;
params.context = options.context;
var dispatchers = {
pid: function(data) {
if (data.hasOwnProperty("query")) {
params.url = "/author/search_ajax/list/" + _.escape(data["query"]);
Backbone.ajax(params);
} else if (data.hasOwnProperty("pids")) {
params.url = "/author/search_ajax/details";
params.data.jsondata = JSON.stringify({pids: data["pids"]});
Backbone.ajax(params);
} else {
app.debug && console.error("[Server Search] ERROR: No search configuration data.")
}
}
};
if (type in dispatchers) {
dispatchers[type](data);
} else {
app.debug && console.error("[Server Search] Search type unknown");
}
};
})(ticketbox, ticketbox.module("server"));
/**
* Module that defines Router
* Immediately-Invoked Function Expression. (IIFE)
*/
//(function(ticketbox, Router) {
//
// // Dependencies
// var Server = ticketbox.module("server");
//
// // Shorthands
// var app = ticketbox.app;
//
// Router.Model = Backbone.Router.extend({
// routes: {
// "assign/:bibrefrec/:pid": "addAssignOp",
// "reject/:bibrefrec/:pid": "addRejectOp"
// }
// });
//
// // Create global router
// app.router = new Router.Model();
// app.router.on("route:addAssignOp", function(bibrefrec, pid) {app.debug && console.log('Assign Op: ' + bibrefrec + ' ' + pid)});
// app.router.on("route:addRejectOp", function(bibrefrec, pid) {app.debug && console.log('Assign Op: ' + bibrefrec + ' ' + pid)});
// Backbone.history.start();
//
//})(ticketbox, ticketbox.module("router"));
/**
* Module that defines Operation
* Immediately-Invoked Function Expression. (IIFE)
*/
(function(ticketbox, Operation) {
// Dependencies
var Server = ticketbox.module("server");
// Shorthands
var app = ticketbox.app;
var opsource = "<div class=\"row-fluid\">{{#action}}" +
"<div class=\"span2 action {{ classes }}\">{{ action }}</div>" +
"<div class=\"span9\">{{/action}}<div class=\"title\"><a href=\"{{ rec_link }}\" target=\"_blank\">{{rec_title}}</a></div>For profile <a href=\"{{ profile_link }}\">{{ cname }}</a>{{#editable}}, known by: <select>{{#bibrefs}}<option value=\"{{ bibref }}\">{{ sig }}</option>{{/bibrefs}}<option class=\"nobibref\" value=\"\">I don't know</option></select>{{/editable}}</div>" +
"<div class=\"span1\"><div class=\"op-buttons btn-group btn-group-vertical\"><button class=\"btn btn-small op-btn removeOp\" type=\"button\">Discard</button></div></div>" +
"</div>";
var template = Handlebars.compile(opsource);
Operation.Model = Backbone.Model.extend({
idAttribute: "rec",
defaults: {
rec_title: "Loading..",
on: "user",
ignored: false
},
sync: Server.sync,
initialize: function(){
app.debug && console.log("Instance of Operation Model Created.");
this.set({complete: this.isComplete() });
this.listenTo(this, "change", function() { app.debug && console.log(this.id + " has changed!"); this.set({complete: this.isComplete() }); });
},
// validate: function(attrs, options) {
// if (attrs.bibref == null) {
// return "No bibref!"
// }
// },
getTarget: function() {
return this.get('on');
},
setBibref: function(bibref) {
var bibrefRegex = /\d+:\d+/;
if (bibref == "") {
this.set({ignored: true});
this.set({bibref: null});
} else if (bibrefRegex.test(bibref)) {
this.set({bibref: bibref});
}
},
getAction: function() {
if (this.get("action") == "assign") {
return "Assign";
} else if (this.get("action") == "reject") {
return "Reject";
} else if (this.get("action") == "reset") {
return "Forget"
} else {
return "Unknown"
}
},
isComplete: function() {
return (this.has('bibref') && (this.has('rec') || this.has('op_rec')));
},
bibrefrec: function() {
if (this.isComplete()) {
var rec = this.get('rec');
if (this.isNew()) {
rec = this.get('op_rec');
}
return this.get('bibref') + "," + rec;
} else {
if (this.isNew()) {
return this.get('op_rec');
} else {
return this.get('rec');
}
}
}
});
Operation.View = Backbone.View.extend({
tagName: "li",
attributes: {
class: "hidden"
},
events: {
'click .removeOp': 'removeOperation',
'click select': 'bibrefSelected'
},
initialize: function(){
app.debug && console.log("Operation View Created!");
this.listenTo(this.model, "change", this.render);
this.listenTo(this.model, "destroy", this.destroyOp);
this.listenTo(this.model, "removeview", this.destroyOp);
this.listenTo(this.model, "invalid", function() {alert("Did not pass validation!")});
},
destroyOp: function() {
var element = this;
this.$el.hide(400, function() {
element.remove();
});
},
selectBibrefOption: function() {
if (this.model.has("bibrefs")) {
var items = this.$("option");
items.removeAttr("selected");
if (this.model.isComplete()) {
items.filter("[value='" + this.model.get('bibref') + "']").first().attr("selected","selected");
} else {
items.filter(".nobibref").first().attr("selected","selected");
}
}
},
render: function() {
if (this.model.has("execution_result")) {
var operation = this.model.get('execution_result');
if (operation['operation'] == "ticketized") {
this.$el.css("background-color", "#AAFFAA");
} else {
this.$el.css("background-color", "#FFAAAA");
}
}
var context = {
rec_title: this.model.get("rec_title"),
rec_link: document.location.origin + "/record/" + this.model.get("rec"),
cname: this.model.get("cname"),
profile_link: document.location.origin + "/author/profile/" + this.model.get("cname"),
editable: this.model.has("bibrefs"),
bibrefs: this.model.get("bibrefs"),
action: {
action: this.model.getAction(),
classes: this.getActionClasses()
}
};
this.$el.html(template(context));
this.selectBibrefOption();
MathJax.Hub.Queue(["Reprocess", MathJax.Hub, this.$el.get(0)]);
app.debug && console.log("Operation Rendered!");
return this;
},
removeOperation: function() {
app.debug && console.log("Operation Model Destroyed!");
app.debug && console.log("Collection Changed - " + JSON.stringify(app.userops.toJSON()));
this.model.destroy({"on": this.model.getTarget()});
},
getActionClasses: function() {
var action = {
assign: "op-assign",
reject: "op-reject",
reset: "op-reset"
}
var modelAction = this.model.get("action");
if (modelAction in action) {
return action[modelAction];
} else {
app.debug && console.error("[Operation View] ERROR: No class found for action.");
return "";
}
},
bibrefSelected: function(event) {
var value = this.$("select").val();
this.model.setBibref(value);
app.debug && console.log("BIBREF Saved: " + JSON.stringify(value));
app.debug && console.error("Operation Target: " + JSON.stringify({"on": this.model.getTarget()}) );
this.model.save({"on": this.model.getTarget()});
},
save: function() {
var value = this.$("select").val();
this.model.setBibref(value);
app.debug && console.log("BIBREF Saved: " + JSON.stringify(value));
app.debug && console.error("Operation Target: " + JSON.stringify({"on": this.model.getTarget()}) );
this.model.save({"on": this.model.getTarget()});
}
});
})(ticketbox, ticketbox.module("operation"));
/**
* Module that defines Ticket
* Immediately-Invoked Function Expression. (IIFE)
*/
(function(ticketbox, Ticket) {
// Dependencies
var Operation = ticketbox.module("operation");
var Server = ticketbox.module("server");
// Shorthands
var app = ticketbox.app;
// Template
var mainBox = "<div id=\"ticket_status\" class=\"alert alert-info hidden\"></div>";
var add = "<span id=\"add_form\">Testing Feature ONLY: <form class=\"form-inline\" id=\"debug_form\"> <input type=\"text\" class=\"input-small\" name=\"pid\" placeholder=\"pid\"> <input type=\"text\" name=\"bibrefrec\" class=\"input-small\" placeholder=\"bibrefrec\"> <select id=\"action1\" class=\"input-small\"><option selected=\"selected\" value=\"assign\">assign</option><option value=\"reject\">reject</option></select> <select name=\"on\" class=\"input-small\"><option selected=\"selected\" value=\"user\">user</option><option value=\"autoclaim\">autoclaim</option></select> <button id=\"addButton\">Add</button><button id=\"updateButton\">Update Status</button></form></span>";
var stats = "<p id=\"stats\">DEBUG: <b>Total items in collection:</b> {{ total }}, <b>Ignored/Complete:</b> {{ igcom }}, <b>Incomplete:</b> {{ incomplete }}, <b>Committed:</b> {{ committed }}, <b>Outcome:</b> {{ outcome }}</p>";
var buttons = "<button id=\"commitButton\" class=\"btn btn-large btn-primary\" disabled=\"disabled\">Confirm</button><button id=\"abortButton\" class=\"btn btn-large\">Discard All</button>";
var statstemplate = Handlebars.compile(stats);
Ticket.Operations = Backbone.Collection.extend({
model: Operation.Model,
sync: Server.sync,
initialize: function() {
this.listenTo(this, 'change', function(){app.debug && console.log("Collection Changed - " + JSON.stringify(this.toJSON()))});
},
completed: function() {
return this.filter(function(operation) {
return operation.isComplete() || operation.get("ignored");
})
},
incomplete: function() {
return this.without.apply(this, this.completed());
},
committed: function() {
return typeof this.find(function(op) {
return op.has("execution_result");
}) != 'undefined';
},
outcome: function() {
var result = {ticketized: 0, other: 0};
return this.reduce(function(memo, value) {
if (value.has("execution_result")) {
var operation = value.get('execution_result');
if (operation['operation'] == "ticketized") {
memo['ticketized']++;
} else {
memo['other']++;
}
return memo;
}
}, result);
}
});
// Create global user operations collection.
app.userops = new Ticket.Operations();
Ticket.OperationsView = Backbone.View.extend({
tagName: "ul",
attributes: {
id: "complete",
class: "op-list unstyled"
},
initialize: function() {
this.listenTo(app.userops, 'add', this.addOne);
this.listenTo(app.userops, 'reset', this.render);
},
addOne: function(operation) {
var view = new Operation.View({model: operation});
this.$el.append(view.render().el);
view.$el.show(400);
},
render: function() {
this.$el.html('');
app.userops.each(this.addOne, this);
return this;
}
});
Ticket.View = Backbone.View.extend({
tagName: "div",
commitModalTemplate: Handlebars.compile("<div class=\"modal ow-closed\">" +
"<div class=\"modal-header\"><h1>{{ title }}</h1></div>" +
"<div class=\"modal-body\">" +
"<span class=\"confirm-text\"><p>{{#guest}}Please provide your details to submit your suggestions.<br>{{/guest}}If you have any comments, please fill in the comments box below.</p></span>" +
"<form class=\"form-horizontal\" novalidate>" +
"{{#guest}}<div class=\"control-group\"><label class=\"control-label\" for=\"firstName\">First Name</label><div class=\"controls\"><input class=\"input-large\" required=\"true\" data-trigger=\"change keyup focusin focusout\" data-notblank=\"true\" data-required-message=\"This field is required.\" data-validation-minlength=\"1\" data-minlength=\"2\" data-minlength-message=\"Your input is too short.\" type=\"text\" id=\"firstName\" placeholder=\"First Name\" value=\"{{ userDetails.first_name }}\"></div></div>" +
"<div class=\"control-group\"><label class=\"control-label\" for=\"lastName\">Last Name</label><div class=\"controls\"><input class=\"input-large\" required=\"true\" data-trigger=\"change keyup focusin focusout\" data-notblank=\"true\" data-required-message=\"This field is required.\" data-validation-minlength=\"1\" data-minlength=\"2\" data-minlength-message=\"Your input is too short.\" type=\"text\" id=\"lastName\" placeholder=\"Last Name\" value=\"{{ userDetails.last_name }}\"></div></div>" +
"<div class=\"control-group\"><label class=\"control-label\" for=\"email\">Email</label><div class=\"controls\"><input class=\"input-xlarge\" required=\"true\" data-trigger=\"change keyup focusin focusout\" data-notblank=\"true\" data-required-message=\"This field is required.\" data-validation-minlength=\"1\" data-type-email-message=\"Please enter a valid email address.\" type=\"email\" id=\"email\" placeholder=\"Email\" value=\"{{ userDetails.email }}\"></div></div>{{/guest}}" +
"<div class=\"control-group\"><label class=\"control-label\" for=\"comments\">Your Comments</label><div class=\"controls\"><textarea class=\"input-xlarge\" data-trigger=\"change keyup focusin focusout\" data-validation-minlength=\"1\" data-maxlength=\"10000\" rows=\"4\" id=\"comments\" placeholder=\"Comments\">{{ userDetails.comments }}</textarea></div></div>" +
"</form>" +
"</div>" +
"<div class=\"modal-footer\"><a href=\"#\" class=\"btn btn-large back\">Go Back</a><a href=\"#\" class=\"btn btn-large btn-primary continue\">Continue</a></div></div>"),
discardModalTemplate: "<div class=\"modal ow-closed\">" +
"<div class=\"modal-header\"><h1>Are you sure?</h1></div>" +
"<div class=\"modal-body\"><p>You will lose the suggestions you have made so far, are you sure that you want to discard them?</p>" +
"</div>" +
"<div class=\"modal-footer\"><a href=\"#\" class=\"btn btn-large back btn-primary\">No</a><a href=\"#\" class=\"btn btn-large continue\">Yes, discard them</a></div></div>",
attributes: {
id: "ticket_status",
class: "alert alert-info hidden"
},
events: {
"click #addButton": "addOp",
"click #commitButton": "commitModalTriggered",
"click #abortButton": "discardAllTriggered",
"click #updateButton": "updateOp"
},
initialize: function() {
this.initSubViews();
this.hookEvents();
this.initNodes(this.el);
},
initSubViews: function() {
this.complete = new Ticket.OperationsView();
this.$el.append(this.complete.el);
},
hookEvents: function() {
this.listenTo(app.userops, 'change', this.changed);
this.listenTo(app.userops, 'add', this.changed);
this.listenTo(app.userops, 'remove', this.removed);
this.hookTableLinks();
this.hookBodyModel();
},
hookTableLinks: function() {
var view = this;
$("#bai_content").on("click", ".op_action", function(event) {
var href = $(event.target).attr("href");
var add_result = view.handleTableClickOperation(href);
if (add_result) {
event.preventDefault();
return false;
} else {
return true;
}
});
},
handleTableClickOperation: function(url) {
if (url) {
var op_regex = /author\/claim\/action\?(confirm|repeal|reset|to_other_person)=True&selection=(?:(\d+:\d+),)?(?:(\d+))(?:&pid=(\d+))?/;
var data = url.match(op_regex);
var model_data = {};
switch(data[1]) {
case "confirm":
model_data = _.extend(model_data, {action: "assign"});
break;
case "repeal":
model_data = _.extend(model_data, {action: "reject"});
break;
case "reset":
model_data = _.extend(model_data, {action: "reset"});
break;
default:
return false;
}
model_data = _.extend(model_data, {
bibref: data[2],
op_rec: data[3],
pid: data[4],
on: "user"
});
var model_instance = new Operation.Model(model_data);
model_instance.save({on: "user"});
model_instance.set({rec: model_instance.get('op_rec')});
app.userops.add(model_instance);
return true;
} else {
return false;
}
},
hookBodyModel: function() {
this.prompted = false;
this.listenTo(app.userops, 'add', this.handleUserLevel);
this.listenTo(app.bodyModel, 'change', this.handleUserLevel);
},
initNodes: function(el) {
$("<h2>Your Suggested Changes:</h2>").prependTo(el);
this.$buttons = $("<div id=\"ticket-buttons\">" + buttons + "</div>").appendTo(el);
this.$commitbutton = this.$buttons.find("#commitButton");
$("#bai_content").before(this.el);
},
showDebugTools: function(el) {
if (!this.$debugTools) {
var debug = $("<div id=\"debug-dialog\"></div>").appendTo(el);
debug.append(statstemplate({total: 0, igcom: 0, incomplete: 0}));
debug.append(add);
this.$stats = debug.find("#stats");
this.unbindFormSubmitEvents(debug);
this.$debugTools = debug;
}
},
unbindFormSubmitEvents: function($el) {
$el.submit(function() {
$('input[type=submit]', this).attr('disabled', 'disabled');
return false;
});
},
removeDebugTools: function() {
if(this.$debugTools) {
this.$debugTools.remove();
}
},
updateBodyModalUserLevel: function () {
var userLevel = app.bodyModel.get("userLevel");
var guestPrompt = app.bodyModel.get("guestPrompt");
if (userLevel == "guest" && guestPrompt) {
var template = "<div class=\"modal-header\"><h1>Do you want to login?</h1></div>" +
"<div class=\"modal-body\">" +
"<p><strong>Login is strongly recommended but not necessary. You can still continue as a guest.</strong><br><br> That means you can manage your profile but your edits will not be visible right away. It will take time for your changes to appear as they will be managed manually by one of our administrators.</p>" +
"" +
"</div>" +
"<div class=\"modal-footer\"><ul class=\"login-btns\"><li class=\"login-btn\"><a href=\"https://arxiv.org/inspire_login\"><div class=\"arxiv-btn\"><p class=\"headingText\">Login Via</p><span class=\"innerText\">arXiv</span></div></a></li>" +
"<li class=\"login-btn\"><a class=\"guest\" href=\"#\"><div class=\"guest-btn\"><p class=\"headingText\">Continue as a</p><span class=\"innerText\">Guest</span></div></a></li></ul></div>";
app.bodyModel.set({
modal: {
prompt: true,
seen: false,
content: template,
callbacks: null
}
});
this.prompted = true;
}
},
handleUserLevel: function() {
if (! this.prompted) {
if (app.userops.length < 1) {
this.updateBodyModalUserLevel();
}
}
if (app.bodyModel.get("userLevel") == 'admin') {
this.showDebugTools(this.$el);
} else {
this.removeDebugTools();
}
},
render: function() {
if (this.$debugTools) {
this.$stats.html( statstemplate({total: app.userops.length, igcom: _.size(app.userops.completed()), incomplete: _.size(app.userops.incomplete()), committed: app.userops.committed(), outcome: JSON.stringify(app.userops.outcome())}));
}
},
addOne: function(operation) {
var view = new Operation.View({model: operation});
this.$el.append(view.render().el);
this.render();
},
addAll: function() {
this.$el.html('');
app.userops.each(this.addOne, this);
},
toggleCommitBlocking: function() {
if (_.size(app.userops.completed()) > 0) {
this.$commitbutton.removeAttr("disabled");
} else {
this.$commitbutton.attr("disabled", "disabled");
}
},
changed: function() {
app.debug && console.log("Switching triggered");
if (_.size(app.userops.incomplete()) > 0) {
app.debug && console.log("Visible");
this.$("#intervention").toggleClass('hidden', false);
} else {
app.debug && console.log("Hidden");
this.$("#intervention").toggleClass('hidden', true);
}
if (app.userops.length > 0) {
this.$el.show(400);
} else {
this.$el.hide(400);
}
this.toggleCommitBlocking();
this.render();
},
removed: function(operation) {
operation.trigger('removeview');
if (_.size(app.userops.incomplete()) < 1) {
this.$("#intervention").toggleClass('hidden', true);
}
if (app.userops.length > 0) {
this.$el.show(400);
} else {
this.$el.hide(400);
}
this.toggleCommitBlocking();
this.render();
},
addOp: function() {
var form = this.$("#add_op");
var params = {
pid: form.find("[name='pid']").val(),
action: form.find("#action1").val(),
on: form.find("[name='on']").val(),
bibrefrec: form.find("[name=bibrefrec]").val()
};
var options = {
success: function() {
$(this).unbind();
app.debug && console.log("Operation Added!");
app.userops.fetch();
},
error: function() {
app.debug && console.error("[ERROR] Operation could not be added!");
}
}
var model = {
bibrefrec: function() {
return params['bibrefrec'];
}
}
model.get = function(target) {
return params[target];
};
Server.sync("create", model, options);
},
resizeModal: function() {
var modal = this.$commitModal;
var modalBody = modal.find(".modal-body");
var height = $(window).height();
var width = $(window).width();
// Outer box
if ((width * 0.66) > parseInt(modal.css("min-width").match("(\\d+)")[1])) {
modal.width(width * 0.66);
}
// Inner content
var fixedHeight = modal.find(".modal-header").outerHeight() + modal.find(".modal-footer").outerHeight();
},
commitOp: function(event) {
var $form = event.data.form;
if ($form.parsley("isValid")) {
this.immediateCommitOp();
}
event.preventDefault();
return false;
},
immediateCommitOp: function() {
this.commitContinueTriggered();
return false;
},
displayCommitStatus: function(title, message) {
var modal = this.$commitModal;
var headfoot = $(".modal>:not(.modal-body)");
var header = $(".modal-header");
var footer = $(".modal-footer");
var modalBody = modal.find(".modal-body");
this.modalSpinner.stop();
modal.height("auto");
modalBody.height("auto");
header.find("h1").html(title);
footer.find(".back").html("Close")
footer.find(".continue").remove();
headfoot.show();
modalBody.append(message);
this.committing = false;
this.complete = true;
var modal = this.$commitModal;
},
generateCommitErrorMessage: function() {
return "Your changes were not submitted. This might be because of a problem with your connection. However, if this problem persists, please let us know at [email protected].";
},
generateCommitTicketizedMessage: function(connectives) {
if (connectives) {
return "The other changes will require INSPIRE staff to review them before it will take effect. ";
} else {
return "The changes will require INSPIRE staff to review them before it will take effect. ";
}
},
generateCommitOtherMessage: function(connectives) {
if (connectives) {
return "The changes you have proposed were submitted and some will appear immediately."
} else {
return "The changes you have proposed were submitted and will appear immediately.";
}
},
commitSuccess: function() {
var outcome = app.userops.outcome();
var error = (outcome.other < 1) && (outcome.ticketized < 1);
var message = "";
var title = "";
if (error) {
this.commitError();
return;
} else {
var connectives = (outcome.other > 0) && (outcome.ticketized > 0);
if (app.bodyModel.get("userLevel") == "admin") {
title = "Actions Completed";
} else {
title = "Thank you for your suggestions";
}
if (outcome.other > 0) {
message += this.generateCommitOtherMessage(connectives);
message += " ";
}
if (outcome.ticketized > 0) {
message += this.generateCommitTicketizedMessage(connectives);
}
}
this.displayCommitStatus(title, "<p>" + message + "</p>");
Server.process("update", "user", {});
},
commitError: function() {
var title = "There has been a problem";
var message = this.generateCommitErrorMessage();
this.displayCommitStatus(title, "<p>" + message + "</p>");
Server.process("update", "user", {});
},
commitContinueTriggered: function() {
var modal = this.$commitModal;
var headfoot = $(".modal>:not(.modal-body)");
var modalBody = modal.find(".modal-body");
// Indicate committing
this.committing = true;
this.complete = false;
// Preserve modal dimensions.
modal.height(modal.height());
modal.width(modal.width());
// Empty out modal and fix dimensions
modalBody.html('');
headfoot.hide();
modalBody.height("100%");
// Load spinner
var opts = {
lines: 13, // The number of lines to draw
length: 14, // The length of each line
width: 7, // The line thickness
radius: 30, // The radius of the inner circle
corners: 1, // Corner roundness (0..1)
rotate: 0, // The rotation offset
direction: 1, // 1: clockwise, -1: counterclockwise
color: '#000', // #rgb or #rrggbb or array of colors
speed: 2, // Rounds per second
trail: 60, // Afterglow percentage
shadow: false, // Whether to render a shadow
hwaccel: false, // Whether to use hardware acceleration
className: 'spinner', // The CSS class to assign to the spinner
zIndex: 2e9, // The z-index (defaults to 2000000000)
top: 'auto', // Top position relative to parent in px
left: 'auto' // Left position relative to parent in px
};
this.modalSpinner = new Spinner(opts).spin(modalBody.get(0));
var config = {
data: this.userDetails,
success: $.proxy(this.commitSuccess, this),
error: $.proxy(this.commitError, this),
context: this
};
Server.process("commit", "user", config);
},
commitModalTriggered: function() {
var view = this;
var $span = $("<span class=\"bsw\"></span>").appendTo("body");
app.debug && console.dir(this.userDetails);
var validate = ! (this.userDetails == undefined);
this.userDetails = this.userDetails || {
first_name: "",
last_name: "",
email: "",
comments: ""
};
var userDetails = this.userDetails;
var context = { userDetails: userDetails };
var updateUserDetails = function($el) {
this.userDetails = {
first_name: $el.find("#firstName").val(),
last_name: $el.find("#lastName").val(),
email: $el.find("#email").val(),
comments: $el.find("#comments").val()
};
};
var guestCommitModal = function() {
_.extend(context, {title: "Enter Your Details", guest: true});
return $(view.commitModalTemplate(context)).appendTo($span);
};
var userCommitModal = function() {
_.extend(context, {title: "Any Comments?", guest: false});
return $(view.commitModalTemplate(context)).appendTo($span);
};
var adminCommitModal = function() {
_.extend(context, {title: "Please wait", guest: false});
return $(view.commitModalTemplate(context)).appendTo($span);
};
switch (app.bodyModel.get("userLevel")) {
case "user":
this.$commitModal = userCommitModal();
break;
case "admin":
this.$commitModal = adminCommitModal();
break;
default:
this.$commitModal = guestCommitModal();
break;
}
var params = {
callbacks: {
afterShow: function(subjects, internalCallback) {
var $continueButton = subjects.modal.find(".continue");
var $backButton = subjects.modal.find(".back");
var $form = subjects.modal.find("form");
var modal = subjects.modal;
$continueButton.click({ form: $form }, $.proxy(view.commitOp, view));
$backButton.click(function(event) {
modal.trigger("hide");
event.preventDefault();
return false;
});
$form.parsley({
successClass: 'success',
errorClass: 'error',
errors: {
classHandler: function ( elem, isRadioOrCheckbox ) {
return $( elem ).parent().parent();
},
container: function (element, isRadioOrCheckbox) {
var $container = element.parent().find(".help-block");
if ($container.length === 0) {
$container = $("<span class='help-block'></span>").insertAfter(element);
}
return $container;
},
errorsWrapper: '<ul class="unstyled"></ul>'
}
});
// If it is not the first time the form has loaded, validate is true. Display validation status at load.
if (validate) {
$form.parsley("validate");
}
var refreshButtonValidation = function(event) {
var $form = event.data.form;
var $button = event.data.button;
if ($form.parsley('isValid')) {
$button.toggleClass("disabled", false);
$.proxy(updateUserDetails, view)($form);
app.debug && console.dir(view.userDetails);
} else {
$button.toggleClass("disabled", true);
}
};
// Initial validation of form to update the state of the continue button.
refreshButtonValidation({data: { form: $form, button: $continueButton }});
// Bind button validation state to form change event.
$form.keyup({ form: $form, button: $continueButton }, refreshButtonValidation);
if(app.bodyModel.get("userLevel") == "admin") {
$.proxy(view.immediateCommitOp, view) ();
}
return internalCallback(subjects);
},
beforeHide: function(subjects, internalCallback) {
if (view.committing) {
return false;
}
$.proxy(updateUserDetails, view)(subjects.modal);
return internalCallback(subjects);
},
afterHide: function(subjects, internalCallback) {
view.commitModalClose();
if(view.complete) {
document.location.reload(true);
}
return internalCallback(subjects);
}
}
};
this.$commitModal.omniWindow(params).trigger('show');
},
commitModalClose: function() {
this.$commitModal.remove();
},
discardAllOp: function(event) {
event.data.modal.trigger("hide");
Server.process("abort", "user", {});
},
discardAllTriggered: function() {
var view = this;
var $span = $("<span class=\"bsw\"></span>").appendTo("body");
$discardModal = $(view.discardModalTemplate).appendTo($span);
var params = {
callbacks: {
afterShow: function(subjects, internalCallback) {
var $yesButton = subjects.modal.find(".continue");
var $noButton = subjects.modal.find(".back");
var modal = subjects.modal;
$yesButton.click({modal: subjects.modal}, $.proxy(view.discardAllOp, view));
$noButton.click(function(event) {
modal.trigger("hide");
event.preventDefault();
return false;
});
return internalCallback(subjects);
},
afterHide: function(subjects, internalCallback) {
$span.remove();
return internalCallback(subjects);
}
}
};
$discardModal.omniWindow(params).trigger('show');
}
});
})(ticketbox, ticketbox.module("ticket"));
/**
* Body Module
* Handles general changes applied to the body.
*/
(function(ticketbox, Body) {
// Shorthands
var app = ticketbox.app;
Body.Model = Backbone.Model.extend({
defaults: {
userLevel: "unknown",
modal: {
prompt: false,
seen: false,
content: null,
callbacks: null
},
guestPrompt: false
},
validate: function(attrs, options) {
var userLevels = ["guest","user","admin", "unknown"];
if (! _.contains(userLevels, attrs.userLevel)) {
return "Invalid user level!";
}
if (attrs.modal) {
var valid = attrs.modal.hasOwnProperty("prompt") &&
attrs.modal.hasOwnProperty("seen") &&
attrs.modal.hasOwnProperty("content") &&
attrs.modal.hasOwnProperty("callbacks");
if (! valid) {
return "Modal not valid.";
}
}
}
});
// Create global body model
app.bodyModel = new Body.Model();
Body.View = Backbone.View.extend({
el: "body",
modalTemplate: "<div class=\"modal ow-closed\"></div>",
resizeModalHandler: function() {
var modal = this.$modal;
var height = $(window).height();
var width = $(window).width();
// modal.width(width * 0.50);
},
handleModal: function() {
var modalDesc = app.bodyModel.get("modal");
if (!modalDesc.seen && modalDesc.prompt) {
$("div.modal").remove();
this.$modal = $(this.modalTemplate).appendTo(this.$("span.bsw"));
this.$modal.append(modalDesc.content);
var modal = this.$modal;
var params = {
callbacks: {
afterShow: function(subjects, internalCallback) {
subjects.modal.find("a.guest").click(function() {
modal.data("dismissed", true);
modal.trigger("hide");
});
return internalCallback(subjects);
},
beforeHide: function(subjects, internalCallback) {
if (modal.data("dismissed")) {
return internalCallback(subjects);
} else {
return false;
}
},
afterHide: function(subjects, internalCallback) {
modalDesc.seen = true;
return internalCallback(subjects);
}
}
};
params.callbacks = _.extend(params.callbacks, modalDesc.callbacks);
this.resizeModalHandler();
this.$modal.omniWindow(params)
.trigger('show');
} else {
this.destroyModal();
}
},
destroyModal: function() {
this.$modal.remove();
},
hookEvents: function() {
this.listenTo(app.bodyModel, 'change:modal', this.handleModal);
},
initialize: function() {
this.hookEvents();
}
});
})(ticketbox, ticketbox.module("body"));
/**
* Modules for PidSearch
*/
(function(ticketbox, PidSearch) {
// Shorthands
var app = ticketbox.app;
var bodyModel = ticketbox.app.bodyModel;
//Dependencies
var Server = ticketbox.module("server");
PidSearch.Result = Backbone.Model.extend({
idAttribute: "pid",
defaults: {
complete: false
},
isPartial: function() {
return !( this.has("cname") && this.has("name"));
},
updateState: function() {
this.set({complete: ! this.isPartial()});
},
initialize: function() {
this.on("change", this.updateState, this);
}
});
PidSearch.ResultView = Backbone.View.extend({
tagName: 'li',
template: Handlebars.compile("{{#complete}}[{{ pid }}] {{ name }} - {{ cname }}{{/complete}}"),
initialize: function() {
this.listenTo(this.model, "destroy", this.destroyResult);
this.listenTo(this.model, "change:complete", this.render);
},
render: function() {
this.$el.html(this.template(this.model.toJSON()));
return this;
},
destroyResult: function() {
var element = this;
this.$el.hide(400, function() {
element.remove();
});
}
});
PidSearch.Results = Backbone.Collection.extend({
model: PidSearch.Result,
partialResults: function() {
var partialResults = this.filter(function(result) {
return result.isPartial()
}, this);
return partialResults;
},
getPartialsLoadList: function(step) {
var partials = this.partialResults();
var loadList = [];
if (partials.length > 0) {
if (partials.length - step > 0) {
loadList = _.first(partials, step);
} else {
loadList = partials;
}
return _.map(loadList, function(item, key) {
return item.get("pid");
});
} else {
return loadList;
}
}
});
PidSearch.ResultsListView = Backbone.View.extend({
tagName: 'div',
attributes: {
id: "results-frame"
},
initialize: function() {
this.listenTo(this.model, 'add', this.addOne);
this.listenTo(this.model, 'reset', this.render)
this.listenTo(this.model, 'change:complete', this.changed);
this.createNodes();
},
createNodes: function() {
this.$list = $("<ul></ul>").addClass("pid-list unstyled slidee").appendTo(this.el);
this.init();
},
addOne: function(result) {
var view = new PidSearch.ResultView({model: result});
this.$list.append(view.render().el);
this.changed();
},
render: function() {
this.$list.html('');
this.init();
this.model.each(this.addOne, this);
return this;
},
changed: function() {
this.frame.reload();
},
init: function() {
var panel = this.$el;
this.frame = new Sly(this.$el, {
itemNav: 'basic',
itemSelector: 'li',
scrollBy: 20,
scrollSource: panel,
speed: 100,
easing: 'easeOutQuart',
dynamicHandle: 1,
dragHandle: 1,
clickBar: 1,
mouseDragging: 1,
touchDragging: 1,
releaseSwing: 1
}).init();
}
});
PidSearch.SearchModel = Backbone.Model.extend({
defaults: function() {
return {
"results": new PidSearch.Results(),
"incrementStep": 5,
"fullyLoaded": false
};
},
initialize: function() {
},
searchPerson: function(query) {
var options = {
success: this.searchSuccess,
error: this.searchError,
context: this
};
Server.search("pid", { query: query }, options);
},
searchSuccess: function(data, status, jqXHR) {
var resultsColl = this.get("results");
if (data instanceof Array && data.length > 0) {
resultsColl.reset(data);
this.loadPartials();
this.set({ fullyLoaded: false });
app.debug && console.log("[Search Model] Success! Contents of collection: " + JSON.stringify(resultsColl.toJSON()));
}
},
searchError: function(jqXHR, status, error) {
app.debug && console.error("[Search Model] jqXHR: " + JSON.stringify(jqXHR) + ", status: " + status + ", error: " + error);
},
dispatchDetailsRequest: function(loadList) {
var options = {
success: this.loadPartialsSuccess,
error: this.loadPartialsError,
context: this
};
Server.search("pid", { pids: loadList }, options);
},
loadPartials: function() {
var step = this.get("incrementStep");
var loadList = this.get("results").getPartialsLoadList(step);
if (loadList.length > 0) {
this.dispatchDetailsRequest(loadList);
} else {
this.set({ fullyLoaded: true });
}
},
loadPartialsSuccess: function(data, status, jqXHR) {
var resultsColl = this.get("results");
if (data instanceof Array && data.length > 0) {
resultsColl.add(data, {merge: true});
app.debug && console.log("[Search Model] Success, partials loaded: " + JSON.stringify(resultsColl.toJSON()));
}
},
loadPartialsError: function(jqXHR, status, error) {
app.debug && console.error("[Search Model] ERROR: Partials failed to load - jqXHR: " + JSON.stringify(jqXHR) + ", status: " + status + ", error: " + error);
}
});
PidSearch.SearchInterface = Backbone.View.extend({
tagName: 'div',
attributes: {
class: "bsw"
},
template: "<div class=\"modal-header\"><h1>Search for a Person</h1></div><form class='form-search'><input type='text' class='input-medium search-query'><button type='submit' class='btn search'>Search People</button></form><div class=\"modal-body\"></div><div class=\"modal-footer\"><button class=\"btn\" data-dismiss=\"modal\">Close</button><button class=\"btn btn-primary\">Save changes</button></div>",
events: {
"click .btn.search": "performSearch"
},
initialize: function() {
this.resultsListView = new PidSearch.ResultsListView({model: this.model.get("results")});
this.$el.html(this.template);
this.unbindFormSubmitEvents(this.$el);
},
unbindFormSubmitEvents: function($el) {
$el.submit(function() {
$('input[type=submit]', this).attr('disabled', 'disabled');
return false;
});
},
render: function() {
$(".modal-body").html(this.resultsListView.render().el);
return this;
},
performSearch: function(event) {
var query = this.$(".search-query").val();
app.debug && console.log(query);
if(query.length > 1) {
this.model.searchPerson(query);
}
},
displaySearchModal: function() {
this.searchModal = {modal: {
seen: false,
prompt: true,
content: this.render().el,
callbacks: null
}};
bodyModel.set(this.searchModal);
}
});
})(ticketbox, ticketbox.module("PidSearch"));
/**
* On Document Ready
*/
jQuery(function($) {
function jsBootstraper($el) {
// Check if element selected, non-false
if ($el.html()) {
var data = JSON.parse(_.unescape($el.html()));
if (data.hasOwnProperty('backbone')) {
jQuery.globalEval(data.backbone);
}
if (data.hasOwnProperty('other')) {
jQuery.globalEval(data.other);
}
}
}
var disabledHandler = function(event) {
event.preventDefault();
return false;
};
function disableLinks($el) {
$el.attr('disabled', 'disabled');
$el.live("click", disabledHandler);
}
// Dependencies
var Ticket = ticketbox.module("ticket");
var Body = ticketbox.module("body");
// var PidSearch = ticketbox.module("PidSearch");
// Shorthands
var app = ticketbox.app;
// Instantiate
var ticketView = new Ticket.View();
var bodyView = new Body.View();
// Bootstrap data from server
jsBootstraper($("#jsbootstrap"));
disableLinks($("#person_menu").find("li.disabled"));
// Stupid polling
setInterval(function() { app.userops.fetch({"on": 'user'});}, 15000);
// // PidSearch test
// var searchModel = new PidSearch.SearchModel();
// var searchInterface = new PidSearch.SearchInterface({model: searchModel});
// Debugging references
// app.search = searchModel;
// app.searchView = searchInterface;
console.log("Ticketing Loaded.");
var profilePageRegex = /\/author\/profile\//;
var profilePage = profilePageRegex.test(window.location.pathname);
if (profilePage) {
$("#bai_content").prepend("<div class='well'><h4>Welcome to the improved author profiles!</h4><p>We have revised our author page. Please let us know what you think via <a href='mailto:[email protected]?subject=Revised%20Author%20Profiles'>[email protected]</a></p></div>");
}
});
$(document).ready(function() {
$("#hepdata").on("click", "#hepname_connection", function(event) {
var target = $(event.target);
var data = {
cname: target.find(".cname").text(),
hepname: target.find(".hepname").text()
};
var successCallback = function () {
alert("Your suggestion was succesfully sent!");
};
var errorCallback = function () {
alert("Your suggestion was not sent!");
};
$.ajax({
dataType: 'json',
type: 'POST',
url: '/author/manage_profile/connect_author_with_hepname_ajax',
data: {jsondata: JSON.stringify(data)},
success: successCallback,
error: errorCallback,
async: true
});
event.preventDefault();
return false;
});
$("#orcid").on("click", "#orcid_suggestion", function(event) {
var target = $(event.target);
var data = {
pid: target.find(".pid").text(),
orcid: $("#suggested_orcid").val()
};
var successCallback = function () {
alert("Your suggestion was succesfully sent!");
};
var errorCallback = function () {
alert("Your suggestion was not sent! The ORCiD is not valid.");
};
$.ajax({
dataType: 'json',
type: 'POST',
url: '/author/manage_profile/suggest_orcid_ajax',
data: {jsondata: JSON.stringify(data)},
success: successCallback,
error: errorCallback,
async: true
});
event.preventDefault();
return false;
});
// Control 'view more info' behavior in search
$('[class^=more-]').hide();
$('[class^=mpid]').click(function() {
var $this = $(this);
var x = $this.prop("className");
$('.more-' + x).toggle();
var toggleimg = $this.find('img').attr('src');
if (toggleimg == '../img/aid_plus_16.png') {
$this.find('img').attr({src:'../img/aid_minus_16.png'});
$this.closest('td').css('padding-top', '15px');
} else {
$this.find('img').attr({src:'../img/aid_plus_16.png'});
$this.closest('td').css('padding-top', '0px');
}
return false;
});
// Handle Comments
if ( $('#jsonForm').length ) {
$('#jsonForm').ajaxForm({
// dataType identifies the expected content type of the server response
dataType: 'json',
// success identifies the function to invoke when the server response
// has been received
success: processJson
});
$.ajax({
url: '/author/claim/comments',
dataType: 'json',
data: { 'pid': $('span[id^=pid]').attr('id').substring(3), 'action': 'get_comments' },
success: processJson
});
}
// Initialize DataTable
$('.paperstable').dataTable({
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"aoColumns": [
{ "bSortable": false,
"sWidth": "" },
{ "bSortable": false,
"sWidth": "" },
{ "sWidth": "" },
{ "sWidth": "" },
{ "sWidth": "" },
{ "sWidth": "120px" },
{ "sWidth": "320px" }
],
"aLengthMenu": [500],
'iDisplayLength': 500,
"fnDrawCallback": function() {
$('.dataTables_length').css('display','none');
}
});
$('.reviewstable').dataTable({
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"aoColumns": [
{ "bSortable": false,
"sWidth": "" },
{ "bSortable": false,
"sWidth": "" },
{ "bSortable": false,
"sWidth": "120px" }
],
"aLengthMenu": [500],
'iDisplayLength': 500,
"fnDrawCallback": function() {
$('.dataTables_length').css('display','none');
}
});
// search box
if ( $('#personsTable').length ) {
// bind retrieve papers ajax request
$('[class^=mpid]').on('click', function(event){
if ( !$(this).siblings('.retreived_papers').length) {
var pid = $(this).closest('tr').attr('id').substring(3); // e.g pid323
var data = { 'requestType': "getPapers", 'personId': pid.toString()};
var errorCallback = onRetrievePapersError(pid);
$.ajax({
dataType: 'json',
type: 'POST',
url: '/author/claim/search_box_ajax',
data: {jsondata: JSON.stringify(data)},
success: onRetrievePapersSuccess,
error: errorCallback,
async: true
});
event.preventDefault();
}
});
// create ui buttons
var columns = {};
$('#personsTable th').each(function(index) {
columns[$(this).attr('id')] = index;
});
var targets = [columns['IDs'], columns['Papers'], columns['Link']];
if (columns['Action'] !== undefined) {
targets.push(columns['Action']);
}
var pTable = $('#personsTable').dataTable({
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"aoColumnDefs": [
{ "bSortable": false, "aTargets": targets },
{ "bSortable": true, "aTargets": [columns['Number'], columns['Identifier'], columns['Names'], columns['Status']] },
{ "sType": "numeric", "aTargets": [columns['Number']] },
{ "sType": "string", "aTargets": [columns['Identifier'], columns['Names'], columns['Status']] }
],
"aaSorting": [[columns['Number'],'asc']],
"aLengthMenu": [[5, 10, 20, -1], [5, 10, 20 , "All"]],
"iDisplayLength": 5,
"oLanguage": {
"sSearch": "Filter: "
}
});
// draw first page
onPageChange();
// on page change
$(pTable).bind('draw', function() {
onPageChange();
});
}
if ( $('.idsAssociationTable').length ) {
var idTargets = [1,2];
if ( $('#idsAssociationTableClaim').length ) {
idTargets.push(3);
}
$('.idsAssociationTable').dataTable({
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"aoColumnDefs": [
{ "bSortable": true, "aTargets": [0] },
{ "bSortable": false, "aTargets": idTargets },
{ "sType": "string", "aTargets": [0] }
],
"aaSorting": [[0,'asc']],
"iDisplayLength": 5,
"aLengthMenu": [5, 10, 20, 100, 500, 1000],
"oLanguage": {
"sSearch": "Filter: "
}
});
$('.idsAssociationTable').siblings('.ui-toolbar').css({ "width": "45.4%", "font-size": "12px" });
}
if (typeof gMergeProfile !== 'undefined' ) {
// initiate merge list's html from javascript/session
$('#primaryProfile').parent().parent().replaceWith('<tr><td><img src=\"' + isProfileAvailable(gMergeProfile[1]).img_src +
'\" title=\"' + isProfileAvailable(gMergeProfile[1]).message + '\"></td><td><a id=\"primaryProfile\" href=\"profile/' +
gMergeProfile[0] + '\" target=\"_blank\" title=\"' + isProfileAvailable(gMergeProfile[1]).message + '\" >' +
gMergeProfile[0] + '</a></td><td id="primaryProfileTd">primary profile</td><td></td><tr>');
$('.addToMergeButton[name="' + gMergeProfile[0] + '"]').prop('disabled','disabled');
for(var profile in gMergeList) {
createProfilesHtml(gMergeList[profile]);
$('.addToMergeButton[name="' + gMergeList[profile][0] + '"]').prop('disabled','disabled');
}
updateMergeButton();
$('#mergeButton').on('click', function(event){
$(this).before('<input type="hidden" name="primary_profile" value="' + gMergeProfile[0] + '" />');
for(var profile in gMergeList) {
$(this).before('<input type="hidden" name="selection" value="' + gMergeList[profile][0] + '" />');
}
//event.preventDefault();
});
$('.addToMergeButton').on('click', function(event) {
onAddToMergeClick(event, $(this));
});
}
if ($('#autoclaim').length) {
var data = { 'personId': gPID.toString()};
var errorCallback = onRetrieveAutoClaimedPapersError(gPID);
$.ajax({
dataType: 'json',
type: 'POST',
url: '/author/claim/generate_autoclaim_data',
data: {jsondata: JSON.stringify(data)},
success: onRetrieveAutoClaimedPapersSuccess,
error: errorCallback,
async: true
});
}
// Activate Tabs
$("#aid_tabbing").tabs();
// Style buttons in jQuery UI Theme
//$(function() {
// $( "button, input:submit, a", ".aid_person" ).button();
// $( "a", ".demo" ).click(function() { return false; });
//});
// Show Message
$(".ui-alert").fadeIn("slow");
$("a.aid_close-notify").each(function() {
$(this).click(function() {
$(this).parents(".ui-alert").fadeOut("slow");
return false;
} );
});
// Set Focus on last input field w/ class 'focus'
$("input.focus:last").focus();
// Select all
$("A[href='#select_all']").click( function() {
$('input[name=selection]').attr('checked', true);
return false;
});
// Select none
$("A[href='#select_none']").click( function() {
$('input[name=selection]').attr('checked', false);
return false;
});
// Invert selection
$("A[href='#invert_selection']").click( function() {
$('input[name=selection]').each( function() {
$(this).attr('checked', !$(this).attr('checked'));
});
return false;
});
$("#ext_id").keyup(function(event) {
var textbox = $(this);
if (! (event.ctrlKey || event.altKey)) {
textbox.val(function() {
return $(this).val().replace(/\s/g, '');
});
}
var label_text = classifyInput(textbox.val());
var label_changed = labelChanged(label_text);
if (label_changed) {
$("#type-label").fadeOut(500, function() {
$(this).text(label_text).fadeIn(500);
});
}
console.log("Performed Client-Side Sanitation Check")
console.log($(this).val());
console.log("Orcid: " + isORCID($(this).val()));
console.log("Inspire: " + isINSPIRE($(this).val()));
});
// update_action_links();
});
var orcid_regex = /^((?:https?:\/\/)?(?:www.)?orcid.org\/)?((?:\d{4}-){3}\d{3}[\dX]$)/i;
function isORCID(identifier) {
return orcid_regex.test(identifier);
}
function isINSPIRE(identifier) {
var inspire_regex= /^(INSPIRE-)(\d+)$/i;
return inspire_regex.test(identifier);
}
function isValidORCID(identifier) {
}
function classifyInput(identifier) {
if(isORCID(identifier)) {
return "ORCID"
} else if(isINSPIRE(identifier)) {
return "INSPIRE"
} else {
return "?"
}
}
var last_label;
function labelChanged(current) {
if (typeof last_label == 'undefined') {
last_label = current;
return true;
} else if (last_label == current) {
return false;
} else {
last_label = current;
return true;
}
}
function onPageChange() {
$('[class^="emptyName"]').each( function(index){
var pid = $(this).closest('tr').attr('id').substring(3); // e.g pid323
var data = { 'requestType': "getNames", 'personId': pid.toString()};
var errorCallback = onGetNamesError(pid);
$.ajax({
dataType: 'json',
type: 'POST',
url: '/author/claim/search_box_ajax',
data: {jsondata: JSON.stringify(data)},
success: onGetNamesSuccess,
error: errorCallback,
async: true
});
});
$('[class^="emptyIDs"]').each( function(index){
var pid = $(this).closest('tr').attr('id').substring(3); // e.g pid323
var data = { 'requestType': "getIDs", 'personId': pid.toString()};
var errorCallback = onGetIDsError(pid);
$.ajax({
dataType: 'json',
type: 'POST',
url: '/author/claim/search_box_ajax',
data: {jsondata: JSON.stringify(data)},
success: onGetIDsSuccess,
error: errorCallback,
async: true
});
});
if (typeof gMergeProfile != 'undefined') {
$('.addToMergeButton[name="' + gMergeProfile[0] + '"]').prop('disabled','disabled');
$('.addToMergeButton').on('click', function(event) {
onAddToMergeClick(event, $(this));
});
}
// $('.addToMergeButton').each( function(){
// if (-1 !== $.inArray('a', $(this).data('events').click )) {
// $(this).on('click', function(event) {
// onAddToMergeClick(event, $(this));
// });
// }
// });
// $('[class^=uncheckedProfile]').each( function(index){
// var pid = $(this).closest('tr').attr('id').substring(3); // e.g pid323
// var data = { 'requestType': "isProfileClaimed", 'personId': pid.toString()};
// var errorCallback = onIsProfileClaimedError(pid);
// $.ajax({
// dataType: 'json',
// type: 'POST',
// url: '/author/claim/search_box_ajax',
// data: {jsondata: JSON.stringify(data)},
// success: onIsProfileClaimedSuccess,
// error: errorCallback,
// async: true
// });
// });
}
function updateMergeButton() {
if (gMergeList.length)
$('#mergeButton').removeAttr('disabled');
else
$('#mergeButton').attr('disabled','disabled');
}
function onAddToMergeClick(event, button) {
var profile = button.attr('name').toString();
var profile_availability = button.siblings('[name="profile_availability"]').val();
for (var ind in gMergeList) {
if ( profile == gMergeList[ind][0] ) {
event.preventDefault();
return false;
}
}
var data = { 'requestType': "addProfile", 'profile': profile};
$.ajax({
dataType: 'json',
type: 'POST',
url: '/author/claim/merge_profiles_ajax',
data: {jsondata: JSON.stringify(data)},
success: addToMergeList,
// error: errorCallback,
async: true
});
event.preventDefault();
}
function addToMergeList(json) {
if(json['resultCode'] == 1) {
var profile = json['addedPofile'];
var profile_availability = json['addedPofileAvailability'];
var inArray = -1;
for ( var index in gMergeList ){
if (profile == gMergeList[index][0] ) {
inArray = index;
}
}
if ( inArray == -1 && gMergeProfile[0] !== profile) {
gMergeList.push([profile, profile_availability]);
createProfilesHtml([profile, profile_availability]);
$('.addToMergeButton[name="' + profile + '"]').prop('disabled','disabled');
updateMergeButton();
}
}
}
function removeFromMergeList(json) {
if(json['resultCode'] == 1) {
var profile = json['removedProfile'];
var ind = -1;
for ( var index in gMergeList ){
if (profile == gMergeList[index][0] ) {
ind = index;
}
}
if( ind !== -1) {
gMergeList.splice(ind,1);
}
removeProfilesHtml(profile);
$('.addToMergeButton[name="' + profile + '"]').removeAttr('disabled');
updateMergeButton();
}
}
function setAsPrimary(json) {
if(json['resultCode'] == 1) {
var profile = json['primaryProfile'];
var profile_availability = json['primaryPofileAvailability'];
removeFromMergeList({'resultCode' : 1, 'removedProfile' : profile});
var primary = gMergeProfile;
gMergeProfile = [profile, profile_availability];
$('.addToMergeButton[name="' + profile + '"]').prop('disabled','disabled');
addToMergeList({'resultCode' : 1, 'addedPofile' : primary[0], 'addedPofileAvailability': primary[1]});
$('#primaryProfile').parent().parent().replaceWith('<tr><td><img src=\"' + isProfileAvailable(profile_availability).img_src +
'\" title=\"' + isProfileAvailable(profile_availability).message + '\"></td><td><a id=\"primaryProfile\" href=\"profile/' +
profile + '\" target=\"_blank\" title=\"' + isProfileAvailable(profile_availability).message + '\" >' +
profile + '</a></td><td id="primaryProfileTd" >' +
'primary profile</td><td></td></tr>');
}
}
function createProfilesHtml(profile) {
var $profileHtml = $('<tr><td><img src=\"' + isProfileAvailable(profile[1]).img_src + '\" title=\"' +
isProfileAvailable(profile[1]).message + '\"></td><td><a href=\"profile/' + profile[0] + '\" target=\"_blank\" title=\"' +
isProfileAvailable(profile[1]).message + '\">' + profile[0] +
'</a></td><td><a class=\"setPrimaryProfile\" href=\"\" >Set as primary</a></td><td><a class=\"removeProfile\" href=\"\" >'+
'<img src="/img/wb-delete-item.png" title="Remove profile"></a></td></tr>');
$('#mergeList').append($profileHtml);
$profileHtml.find('.setPrimaryProfile').on('click', { pProfile: profile[0]}, function(event){
var data = { 'requestType': "setPrimaryProfile", 'profile': event.data.pProfile};
// var errorCallback = onIsProfileClaimedError(pid);
$.ajax({
dataType: 'json',
type: 'POST',
url: '/author/claim/merge_profiles_ajax',
data: {jsondata: JSON.stringify(data)},
success: setAsPrimary,
// error: errorCallback,
async: true
});
event.preventDefault();
});
$profileHtml.find('.removeProfile').on('click', { pProfile: profile[0]}, function(event){
var data = { 'requestType': "removeProfile", 'profile': event.data.pProfile};
// var errorCallback = onIsProfileClaimedError(pid);
$.ajax({
dataType: 'json',
type: 'POST',
url: '/author/claim/merge_profiles_ajax',
data: {jsondata: JSON.stringify(data)},
success: removeFromMergeList,
// error: errorCallback,
async: true
});
event.preventDefault();
});
}
function isProfileAvailable(availability){
if( availability === "0"){
return { img_src : "/img/circle_orange.png",
message : 'This profile is associated to a user'
};
}
else{
return { img_src : "/img/circle_green.png",
message : 'This profile is not associated to a user'
};
}
}
function removeProfilesHtml(profile) {
$('#mergeList').find('a[href="profile/' + profile + '"][id!="primaryProfile"]').parent().parent().remove();
}
function onGetIDsSuccess(json){
if(json['resultCode'] == 1) {
$('.emptyIDs' + json['pid']).html(json['result']).addClass('retreivedIDs').removeClass('emptyIDs' + json['pid']);
}
else {
$('.emptyIDs' + json['pid']).text(json['result']);
}
}
function onGetIDsError(pid){
/*
* Handle failed 'getIDs' requests.
*/
return function (XHR, textStatus, errorThrown) {
var pID = pid;
$('.emptyIDs' + pID).text('External ids could not be retrieved');
};
}
function onGetNamesSuccess(json){
if(json['resultCode'] == 1) {
$('.emptyName' + json['pid']).html(json['result']).addClass('retreivedName').removeClass('emptyName' + json['pid']);
}
else {
$('.emptyName' + json['pid']).text(json['result']);
}
}
function onGetNamesError(pid){
/*
* Handle failed 'getNames' requests.
*/
return function (XHR, textStatus, errorThrown) {
var pID = pid;
$('.emptyName' + pID).text('Names could not be retrieved');
};
}
function onIsProfileClaimedSuccess(json){
if(json['resultCode'] == 1) {
$('.uncheckedProfile' + json['pid']).html('<span style="color:red;">Profile already claimed</span><br/>' +
'<span>If you think that this is actually your profile bla bla bla</span>')
.addClass('checkedProfile').removeClass('uncheckedProfile' + json['pid']);
}
else {
$('.uncheckedProfile' + json['pid']).addClass('checkedProfile').removeClass('uncheckedProfile' + json['pid']);
}
}
function onIsProfileClaimedError(pid){
/*
* Handle failed 'getNames' requests.
*/
return function (XHR, textStatus, errorThrown) {
var pID = pid;
$('.uncheckedProfile' + pID).text('Temporary not available');
};
}
function onRetrievePapersSuccess(json){
if(json['resultCode'] == 1) {
$('.more-mpid' + json['pid']).html(json['result']).addClass('retreived_papers');
$('.mpid' + json['pid']).append('(' + json['totalPapers'] + ')');
}
else {
$('.more-mpid' + json['pid']).text(json['result']);
}
}
function onRetrievePapersError(pid){
/*
* Handle failed 'getPapers' requests.
*/
return function (XHR, textStatus, errorThrown) {
var pID = pid;
$('.more-mpid' + pID).text('Papers could not be retrieved');
};
}
function onRetrieveAutoClaimedPapersSuccess(json) {
if(json['resultCode'] == 1) {
$('#autoclaim').replaceWith(json['result']);
}
else {
$('#autoclaim').replaceWith(json['result']);
}
}
function onRetrieveAutoClaimedPapersError(pid) {
return function (XHR, textStatus, errorThrown) {
var pID = pid;
$('#autoclaim').replaceWith('<span>Error occured while retrieving papers</span>');
};
}
function showPage(pageNum) {
$(".aid_result:visible").hide();
var results = $(".aid_result");
var resultsNum = results.length;
var start = (pageNum-1) * gResultsPerPage;
results.slice( start, start+gResultsPerPage).show();
var pagesNum = Math.floor(resultsNum/gResultsPerPage) + 1;
$(".paginationInfo").text("Page " + pageNum + " of " + pagesNum);
generateNextPage(pageNum, pagesNum);
generatePreviousPage(pageNum, pagesNum);
}
function generateNextPage(pageNum, pagesNum) {
if (pageNum < pagesNum ) {
$(".nextPage").attr("disabled", false);
$(".nextPage").off("click");
$(".nextPage").on("click", function(event) {
gCurPage = pageNum+1;
showPage(gCurPage);
});
}
else {
$(".nextPage").attr("disabled", true);
}
}
function generatePreviousPage(pageNum, pagesNum) {
if (pageNum > 1 ) {
$(".previousPage").attr("disabled", false);
$(".previousPage").off("click");
$(".previousPage").on("click", function(event) {
gCurPage = pageNum-1;
showPage(gCurPage);
});
}
else {
$(".previousPage").attr("disabled", true);
}
}
function toggle_claimed_rows() {
$('img[alt^="Confirmed."]').parents("tr").toggle()
if ($("#toggle_claimed_rows").attr("alt") == 'hide') {
$("#toggle_claimed_rows").attr("alt", 'show');
$("#toggle_claimed_rows").html("Show successful claims");
} else {
$("#toggle_claimed_rows").attr("alt", 'hide');
$("#toggle_claimed_rows").html("Hide successful claims");
}
}
function confirm_bibref(claimid) {
// Performs the action of confirming a paper through an AJAX request
var cid = claimid.replace(/\,/g, "\\," )
var cid = cid.replace(/\:/g, "\\:")
$('#bibref'+cid).html('<p><img src="../img/loading" style="background: none repeat scroll 0% 0% transparent;"/></p>');
$('#bibref'+cid).load('/author/claim/status', { 'pid': $('span[id^=pid]').attr('id').substring(3),
'bibref': claimid,
'action': 'confirm_status' } );
// update_action_links();
}
function repeal_bibref(claimid) {
// Performs the action of repealing a paper through an AJAX request
var cid = claimid.replace(/\,/g, "\\," )
var cid = cid.replace(/\:/g, "\\:")
$('#bibref'+cid).html('<p><img src="../img/loading" style="background: none repeat scroll 0% 0% transparent;"/></p>');
$('#bibref'+cid).load('/author/claim/status', { 'pid': $('span[id^=pid]').attr('id').substring(3),
'bibref': claimid,
'action': 'repeal_status' } );
// update_action_links();
}
function reset_bibref(claimid) {
var cid = claimid.replace(/\,/g, "\\," )
var cid = cid.replace(/\:/g, "\\:")
$('#bibref'+cid).html('<p><img src="../img/loading.gif" style="background: none repeat scroll 0% 0% transparent;"/></p>');
$('#bibref'+cid).load('/author/claim/status', { 'pid': $('span[id^=pid]').attr('id').substring(3),
'bibref': claimid,
'action': 'reset_status' } );
// update_action_links();
}
function action_request(claimid, action) {
// Performs the action of reseting the choice on a paper through an AJAX request
$.ajax({
url: "/author/claim/status",
dataType: 'json',
data: { 'pid': $('span[id^=pid]').attr('id').substring(3), 'action': 'json_editable', 'bibref': claimid },
success: function(result){
if (result.editable.length > 0) {
if (result.editable[0] == "not_authorized") {
$( "<p title=\"Not Authorized\">Sorry, you are not authorized to perform this action, since this record has been assigned to another user already. Please contact the support to receive assistance</p>" ).dialog({
modal: true,
buttons: {
Ok: function() {
$( this ).dialog( "close" );
// update_action_links();
}
}
});
} else if (result.editable[0] == "touched") {
$( "<p title=\"Transaction Review\">This record has been touched before (possibly by yourself). Perform action and overwrite previous decision?</p>" ).dialog({
resizable: true,
height:250,
modal: true,
buttons: {
"Perform Action!": function() {
if (action == "assign") {
confirm_bibref(claimid);
} else if (action == "reject") {
repeal_bibref(claimid);
} else if (action == "reset") {
reset_bibref(claimid);
}
$( this ).dialog( "close" );
// update_action_links();
},
Cancel: function() {
$( this ).dialog( "close" );
// update_action_links();
}
}
});
} else if (result.editable[0] == "OK") {
if (action == "assign") {
confirm_bibref(claimid);
} else if (action == "reject") {
repeal_bibref(claimid);
} else if (action == "reset") {
reset_bibref(claimid);
}
// update_action_links();
} else {
// update_action_links();
}
} else {
return false;
}
}
});
}
function processJson(data) {
// Callback function of the comment's AJAX request
// 'data' is the json object returned from the server
if (data.comments.length > 0) {
if ($("#comments").text() == "No comments yet.") {
$("#comments").html('<p><strong>Comments:</strong></p>\n');
}
$.each(data.comments, function(i, msg) {
var values = msg.split(";;;")
$("#comments").append('<p><em>' + values[0] + '</em><br />' + values[1] + '</p>\n');
})
} else {
$("#comments").html('No comments yet.');
}
$('#message').val("");
}
//function update_action_links() {
// // Alter claim links in the DOM (ensures following the non-destructive JS paradigm)
// $('div[id^=bibref]').each(function() {
// var claimid = $(this).attr('id').substring(6);
// var cid = claimid.replace(/\,/g, "\\," );
// var cid = cid.replace(/\:/g, "\\:");
// $("#bibref"+ cid +" > #aid_status_details > #aid_confirm").attr("href", "javascript:action_request('"+ claimid +"', 'confirm')");
// $("#bibref"+ cid +" > #aid_status_details > #aid_reset").attr("href", "javascript:action_request('"+ claimid +"', 'reset')");
// $("#bibref"+ cid +" > #aid_status_details > #aid_repeal").attr("href", "javascript:action_request('"+ claimid +"', 'repeal')");
// });
//}
| GRArmstrong/invenio-inspire-ops | modules/bibauthorid/lib/bibauthorid.js | JavaScript | gpl-2.0 | 88,733 |
//DOM-Extension helper
jQuery.webshims.register('dom-extend', function($, webshims, window, document, undefined){
"use strict";
//shortcus
var modules = webshims.modules;
var listReg = /\s*,\s*/;
//proxying attribute
var olds = {};
var havePolyfill = {};
var extendedProps = {};
var extendQ = {};
var modifyProps = {};
var oldVal = $.fn.val;
var singleVal = function(elem, name, val, pass, _argless){
return (_argless) ? oldVal.call($(elem)) : oldVal.call($(elem), val);
};
$.fn.val = function(val){
var elem = this[0];
if(arguments.length && val == null){
val = '';
}
if(!arguments.length){
if(!elem || elem.nodeType !== 1){return oldVal.call(this);}
return $.prop(elem, 'value', val, 'val', true);
}
if($.isArray(val)){
return oldVal.apply(this, arguments);
}
var isFunction = $.isFunction(val);
return this.each(function(i){
elem = this;
if(elem.nodeType === 1){
if(isFunction){
var genVal = val.call( elem, i, $.prop(elem, 'value', undefined, 'val', true));
if(genVal == null){
genVal = '';
}
$.prop(elem, 'value', genVal, 'val') ;
} else {
$.prop(elem, 'value', val, 'val');
}
}
});
};
var dataID = '_webshimsLib'+ (Math.round(Math.random() * 1000));
var elementData = function(elem, key, val){
elem = elem.jquery ? elem[0] : elem;
if(!elem){return val || {};}
var data = $.data(elem, dataID);
if(val !== undefined){
if(!data){
data = $.data(elem, dataID, {});
}
if(key){
data[key] = val;
}
}
return key ? data && data[key] : data;
};
[{name: 'getNativeElement', prop: 'nativeElement'}, {name: 'getShadowElement', prop: 'shadowElement'}, {name: 'getShadowFocusElement', prop: 'shadowFocusElement'}].forEach(function(data){
$.fn[data.name] = function(){
return this.map(function(){
var shadowData = elementData(this, 'shadowData');
return shadowData && shadowData[data.prop] || this;
});
};
});
['removeAttr', 'prop', 'attr'].forEach(function(type){
olds[type] = $[type];
$[type] = function(elem, name, value, pass, _argless){
var isVal = (pass == 'val');
var oldMethod = !isVal ? olds[type] : singleVal;
if( !elem || !havePolyfill[name] || elem.nodeType !== 1 || (!isVal && pass && type == 'attr' && $.attrFn[name]) ){
return oldMethod(elem, name, value, pass, _argless);
}
var nodeName = (elem.nodeName || '').toLowerCase();
var desc = extendedProps[nodeName];
var curType = (type == 'attr' && (value === false || value === null)) ? 'removeAttr' : type;
var propMethod;
var oldValMethod;
var ret;
if(!desc){
desc = extendedProps['*'];
}
if(desc){
desc = desc[name];
}
if(desc){
propMethod = desc[curType];
}
if(propMethod){
if(name == 'value'){
oldValMethod = propMethod.isVal;
propMethod.isVal = isVal;
}
if(curType === 'removeAttr'){
return propMethod.value.call(elem);
} else if(value === undefined){
return (propMethod.get) ?
propMethod.get.call(elem) :
propMethod.value
;
} else if(propMethod.set) {
if(type == 'attr' && value === true){
value = name;
}
ret = propMethod.set.call(elem, value);
}
if(name == 'value'){
propMethod.isVal = oldValMethod;
}
} else {
ret = oldMethod(elem, name, value, pass, _argless);
}
if((value !== undefined || curType === 'removeAttr') && modifyProps[nodeName] && modifyProps[nodeName][name]){
var boolValue;
if(curType == 'removeAttr'){
boolValue = false;
} else if(curType == 'prop'){
boolValue = !!(value);
} else {
boolValue = true;
}
modifyProps[nodeName][name].forEach(function(fn){
if(!fn.only || (fn.only = 'prop' && type == 'prop') || (fn.only == 'attr' && type != 'prop')){
fn.call(elem, value, boolValue, (isVal) ? 'val' : curType, type);
}
});
}
return ret;
};
extendQ[type] = function(nodeName, prop, desc){
if(!extendedProps[nodeName]){
extendedProps[nodeName] = {};
}
if(!extendedProps[nodeName][prop]){
extendedProps[nodeName][prop] = {};
}
var oldDesc = extendedProps[nodeName][prop][type];
var getSup = function(propType, descriptor, oDesc){
if(descriptor && descriptor[propType]){
return descriptor[propType];
}
if(oDesc && oDesc[propType]){
return oDesc[propType];
}
if(type == 'prop' && prop == 'value'){
return function(value){
var elem = this;
return (desc.isVal) ?
singleVal(elem, prop, value, false, (arguments.length === 0)) :
olds[type](elem, prop, value)
;
};
}
if(type == 'prop' && propType == 'value' && desc.value.apply){
return function(value){
var sup = olds[type](this, prop);
if(sup && sup.apply){
sup = sup.apply(this, arguments);
}
return sup;
};
}
return function(value){
return olds[type](this, prop, value);
};
};
extendedProps[nodeName][prop][type] = desc;
if(desc.value === undefined){
if(!desc.set){
desc.set = desc.writeable ?
getSup('set', desc, oldDesc) :
(webshims.cfg.useStrict && prop == 'prop') ?
function(){throw(prop +' is readonly on '+ nodeName);} :
$.noop
;
}
if(!desc.get){
desc.get = getSup('get', desc, oldDesc);
}
}
['value', 'get', 'set'].forEach(function(descProp){
if(desc[descProp]){
desc['_sup'+descProp] = getSup(descProp, oldDesc);
}
});
};
});
//see also: https://github.com/lojjic/PIE/issues/40 | https://prototype.lighthouseapp.com/projects/8886/tickets/1107-ie8-fatal-crash-when-prototypejs-is-loaded-with-rounded-cornershtc
var isExtendNativeSave = (!$.browser.msie || parseInt($.browser.version, 10) > 8);
var extendNativeValue = (function(){
var UNKNOWN = webshims.getPrototypeOf(document.createElement('foobar'));
var has = Object.prototype.hasOwnProperty;
return function(nodeName, prop, desc){
var elem = document.createElement(nodeName);
var elemProto = webshims.getPrototypeOf(elem);
if( isExtendNativeSave && elemProto && UNKNOWN !== elemProto && ( !elem[prop] || !has.call(elem, prop) ) ){
var sup = elem[prop];
desc._supvalue = function(){
if(sup && sup.apply){
return sup.apply(this, arguments);
}
return sup;
};
elemProto[prop] = desc.value;
} else {
desc._supvalue = function(){
var data = elementData(this, 'propValue');
if(data && data[prop] && data[prop].apply){
return data[prop].apply(this, arguments);
}
return data && data[prop];
};
initProp.extendValue(nodeName, prop, desc.value);
}
desc.value._supvalue = desc._supvalue;
};
})();
var initProp = (function(){
var initProps = {};
webshims.addReady(function(context, contextElem){
var nodeNameCache = {};
var getElementsByName = function(name){
if(!nodeNameCache[name]){
nodeNameCache[name] = $(context.getElementsByTagName(name));
if(contextElem[0] && $.nodeName(contextElem[0], name)){
nodeNameCache[name] = nodeNameCache[name].add(contextElem);
}
}
};
$.each(initProps, function(name, fns){
getElementsByName(name);
if(!fns || !fns.forEach){
webshims.warn('Error: with '+ name +'-property. methods: '+ fns);
return;
}
fns.forEach(function(fn){
nodeNameCache[name].each(fn);
});
});
nodeNameCache = null;
});
var tempCache;
var emptyQ = $([]);
var createNodeNameInit = function(nodeName, fn){
if(!initProps[nodeName]){
initProps[nodeName] = [fn];
} else {
initProps[nodeName].push(fn);
}
if($.isDOMReady){
(tempCache || $( document.getElementsByTagName(nodeName) )).each(fn);
}
};
var elementExtends = {};
return {
createTmpCache: function(nodeName){
if($.isDOMReady){
tempCache = tempCache || $( document.getElementsByTagName(nodeName) );
}
return tempCache || emptyQ;
},
flushTmpCache: function(){
tempCache = null;
},
content: function(nodeName, prop){
createNodeNameInit(nodeName, function(){
var val = $.attr(this, prop);
if(val != null){
$.attr(this, prop, val);
}
});
},
createElement: function(nodeName, fn){
createNodeNameInit(nodeName, fn);
},
extendValue: function(nodeName, prop, value){
createNodeNameInit(nodeName, function(){
$(this).each(function(){
var data = elementData(this, 'propValue', {});
data[prop] = this[prop];
this[prop] = value;
});
});
}
};
})();
var createPropDefault = function(descs, removeType){
if(descs.defaultValue === undefined){
descs.defaultValue = '';
}
if(!descs.removeAttr){
descs.removeAttr = {
value: function(){
descs[removeType || 'prop'].set.call(this, descs.defaultValue);
descs.removeAttr._supvalue.call(this);
}
};
}
if(!descs.attr){
descs.attr = {};
}
};
$.extend(webshims, {
getID: (function(){
var ID = new Date().getTime();
return function(elem){
elem = $(elem);
var id = elem.attr('id');
if(!id){
ID++;
id = 'ID-'+ ID;
elem.attr('id', id);
}
return id;
};
})(),
extendUNDEFProp: function(obj, props){
$.each(props, function(name, prop){
if( !(name in obj) ){
obj[name] = prop;
}
});
},
//http://www.w3.org/TR/html5/common-dom-interfaces.html#reflect
createPropDefault: createPropDefault,
data: elementData,
moveToFirstEvent: function(elem, eventType, bindType){
var events = ($._data(elem, 'events') || {})[eventType];
var fn;
if(events && events.length > 1){
fn = events.pop();
if(!bindType){
bindType = 'bind';
}
if(bindType == 'bind' && events.delegateCount){
events.splice( events.delegateCount, 0, fn);
} else {
events.unshift( fn );
}
}
elem = null;
},
addShadowDom: (function(){
var resizeTimer;
var lastHeight;
var lastWidth;
var docObserve = {
init: false,
runs: 0,
test: function(){
var height = docObserve.getHeight();
var width = docObserve.getWidth();
if(height != docObserve.height || width != docObserve.width){
docObserve.height = height;
docObserve.width = width;
docObserve.handler({type: 'docresize'});
docObserve.runs++;
if(docObserve.runs < 30){
setTimeout(docObserve.test, 30);
}
} else {
docObserve.runs = 0;
}
},
handler: function(e){
clearTimeout(resizeTimer);
resizeTimer = setTimeout(function(){
if(e.type == 'resize'){
var width = $(window).width();
var height = $(window).width();
if(height == lastHeight && width == lastWidth){
return;
}
lastHeight = height;
lastWidth = width;
docObserve.height = docObserve.getHeight();
docObserve.width = docObserve.getWidth();
}
$.event.trigger('updateshadowdom');
}, (e.type == 'resize') ? 50 : 9);
},
_create: function(){
$.each({ Height: "getHeight", Width: "getWidth" }, function(name, type){
var body = document.body;
var doc = document.documentElement;
docObserve[type] = function(){
return Math.max(
body[ "scroll" + name ], doc[ "scroll" + name ],
body[ "offset" + name ], doc[ "offset" + name ],
doc[ "client" + name ]
);
};
});
},
start: function(){
if(!this.init && document.body){
this.init = true;
this._create();
this.height = docObserve.getHeight();
this.width = docObserve.getWidth();
setInterval(this.test, 400);
$(this.test);
webshims.ready('WINDOWLOAD', this.test);
$(window).bind('resize', this.handler);
(function(){
var oldAnimate = $.fn.animate;
var animationTimer;
$.fn.animate = function(){
clearTimeout(animationTimer);
animationTimer = setTimeout(function(){
docObserve.test();
}, 19);
return oldAnimate.apply(this, arguments);
};
})();
}
}
};
$.event.customEvent.updateshadowdom = true;
webshims.docObserve = function(){
webshims.ready('DOM', function(){
docObserve.start();
});
};
return function(nativeElem, shadowElem, opts){
opts = opts || {};
if(nativeElem.jquery){
nativeElem = nativeElem[0];
}
if(shadowElem.jquery){
shadowElem = shadowElem[0];
}
var nativeData = $.data(nativeElem, dataID) || $.data(nativeElem, dataID, {});
var shadowData = $.data(shadowElem, dataID) || $.data(shadowElem, dataID, {});
var shadowFocusElementData = {};
if(!opts.shadowFocusElement){
opts.shadowFocusElement = shadowElem;
} else if(opts.shadowFocusElement){
if(opts.shadowFocusElement.jquery){
opts.shadowFocusElement = opts.shadowFocusElement[0];
}
shadowFocusElementData = $.data(opts.shadowFocusElement, dataID) || $.data(opts.shadowFocusElement, dataID, shadowFocusElementData);
}
nativeData.hasShadow = shadowElem;
shadowFocusElementData.nativeElement = shadowData.nativeElement = nativeElem;
shadowFocusElementData.shadowData = shadowData.shadowData = nativeData.shadowData = {
nativeElement: nativeElem,
shadowElement: shadowElem,
shadowFocusElement: opts.shadowFocusElement
};
if(opts.shadowChilds){
opts.shadowChilds.each(function(){
elementData(this, 'shadowData', shadowData.shadowData);
});
}
if(opts.data){
shadowFocusElementData.shadowData.data = shadowData.shadowData.data = nativeData.shadowData.data = opts.data;
}
opts = null;
webshims.docObserve();
};
})(),
propTypes: {
standard: function(descs, name){
createPropDefault(descs);
if(descs.prop){return;}
descs.prop = {
set: function(val){
descs.attr.set.call(this, ''+val);
},
get: function(){
return descs.attr.get.call(this) || descs.defaultValue;
}
};
},
"boolean": function(descs, name){
createPropDefault(descs);
if(descs.prop){return;}
descs.prop = {
set: function(val){
if(val){
descs.attr.set.call(this, "");
} else {
descs.removeAttr.value.call(this);
}
},
get: function(){
return descs.attr.get.call(this) != null;
}
};
},
"src": (function(){
var anchor = document.createElement('a');
anchor.style.display = "none";
return function(descs, name){
createPropDefault(descs);
if(descs.prop){return;}
descs.prop = {
set: function(val){
descs.attr.set.call(this, val);
},
get: function(){
var href = this.getAttribute(name);
var ret;
if(href == null){return '';}
anchor.setAttribute('href', href+'' );
if(!$.support.hrefNormalized){
try {
$(anchor).insertAfter(this);
ret = anchor.getAttribute('href', 4);
} catch(er){
ret = anchor.getAttribute('href', 4);
}
$(anchor).detach();
}
return ret || anchor.href;
}
};
};
})(),
enumarated: function(descs, name){
createPropDefault(descs);
if(descs.prop){return;}
descs.prop = {
set: function(val){
descs.attr.set.call(this, val);
},
get: function(){
var val = (descs.attr.get.call(this) || '').toLowerCase();
if(!val || descs.limitedTo.indexOf(val) == -1){
val = descs.defaultValue;
}
return val;
}
};
}
// ,unsignedLong: $.noop
// ,"doubble": $.noop
// ,"long": $.noop
// ,tokenlist: $.noop
// ,settableTokenlist: $.noop
},
reflectProperties: function(nodeNames, props){
if(typeof props == 'string'){
props = props.split(listReg);
}
props.forEach(function(prop){
webshims.defineNodeNamesProperty(nodeNames, prop, {
prop: {
set: function(val){
$.attr(this, prop, val);
},
get: function(){
return $.attr(this, prop) || '';
}
}
});
});
},
defineNodeNameProperty: function(nodeName, prop, descs){
havePolyfill[prop] = true;
if(descs.reflect){
webshims.propTypes[descs.propType || 'standard'](descs, prop);
}
['prop', 'attr', 'removeAttr'].forEach(function(type){
var desc = descs[type];
if(desc){
if(type === 'prop'){
desc = $.extend({writeable: true}, desc);
} else {
desc = $.extend({}, desc, {writeable: true});
}
extendQ[type](nodeName, prop, desc);
if(nodeName != '*' && webshims.cfg.extendNative && type == 'prop' && desc.value && $.isFunction(desc.value)){
extendNativeValue(nodeName, prop, desc);
}
descs[type] = desc;
}
});
if(descs.initAttr){
initProp.content(nodeName, prop);
}
return descs;
},
defineNodeNameProperties: function(name, descs, propType, _noTmpCache){
var olddesc;
for(var prop in descs){
if(!_noTmpCache && descs[prop].initAttr){
initProp.createTmpCache(name);
}
if(propType){
if(descs[prop][propType]){
//webshims.log('override: '+ name +'['+prop +'] for '+ propType);
} else {
descs[prop][propType] = {};
['value', 'set', 'get'].forEach(function(copyProp){
if(copyProp in descs[prop]){
descs[prop][propType][copyProp] = descs[prop][copyProp];
delete descs[prop][copyProp];
}
});
}
}
descs[prop] = webshims.defineNodeNameProperty(name, prop, descs[prop]);
}
if(!_noTmpCache){
initProp.flushTmpCache();
}
return descs;
},
createElement: function(nodeName, create, descs){
var ret;
if($.isFunction(create)){
create = {
after: create
};
}
initProp.createTmpCache(nodeName);
if(create.before){
initProp.createElement(nodeName, create.before);
}
if(descs){
ret = webshims.defineNodeNameProperties(nodeName, descs, false, true);
}
if(create.after){
initProp.createElement(nodeName, create.after);
}
initProp.flushTmpCache();
return ret;
},
onNodeNamesPropertyModify: function(nodeNames, props, desc, only){
if(typeof nodeNames == 'string'){
nodeNames = nodeNames.split(listReg);
}
if($.isFunction(desc)){
desc = {set: desc};
}
nodeNames.forEach(function(name){
if(!modifyProps[name]){
modifyProps[name] = {};
}
if(typeof props == 'string'){
props = props.split(listReg);
}
if(desc.initAttr){
initProp.createTmpCache(name);
}
props.forEach(function(prop){
if(!modifyProps[name][prop]){
modifyProps[name][prop] = [];
havePolyfill[prop] = true;
}
if(desc.set){
if(only){
desc.set.only = only;
}
modifyProps[name][prop].push(desc.set);
}
if(desc.initAttr){
initProp.content(name, prop);
}
});
initProp.flushTmpCache();
});
},
defineNodeNamesBooleanProperty: function(elementNames, prop, descs){
if(!descs){
descs = {};
}
if($.isFunction(descs)){
descs.set = descs;
}
webshims.defineNodeNamesProperty(elementNames, prop, {
attr: {
set: function(val){
this.setAttribute(prop, val);
if(descs.set){
descs.set.call(this, true);
}
},
get: function(){
var ret = this.getAttribute(prop);
return (ret == null) ? undefined : prop;
}
},
removeAttr: {
value: function(){
this.removeAttribute(prop);
if(descs.set){
descs.set.call(this, false);
}
}
},
reflect: true,
propType: 'boolean',
initAttr: descs.initAttr || false
});
},
contentAttr: function(elem, name, val){
if(!elem.nodeName){return;}
var attr;
if(val === undefined){
attr = (elem.attributes[name] || {});
val = attr.specified ? attr.value : null;
return (val == null) ? undefined : val;
}
if(typeof val == 'boolean'){
if(!val){
elem.removeAttribute(name);
} else {
elem.setAttribute(name, name);
}
} else {
elem.setAttribute(name, val);
}
},
// set current Lang:
// - webshims.activeLang(lang:string);
// get current lang
// - webshims.activeLang();
// get current lang
// webshims.activeLang({
// register: moduleName:string,
// callback: callback:function
// });
// get/set including removeLang
// - webshims.activeLang({
// module: moduleName:string,
// callback: callback:function,
// langObj: languageObj:array/object
// });
activeLang: (function(){
var callbacks = [];
var registeredCallbacks = {};
var currentLang;
var shortLang;
var notLocal = /:\/\/|^\.*\//;
var loadRemoteLang = function(data, lang, options){
var langSrc;
if(lang && options && $.inArray(lang, options.availabeLangs || []) !== -1){
data.loading = true;
langSrc = options.langSrc;
if(!notLocal.test(langSrc)){
langSrc = webshims.cfg.basePath+langSrc;
}
webshims.loader.loadScript(langSrc+lang+'.js', function(){
if(data.langObj[lang]){
data.loading = false;
callLang(data, true);
} else {
$(function(){
if(data.langObj[lang]){
callLang(data, true);
}
data.loading = false;
});
}
});
return true;
}
return false;
};
var callRegister = function(module){
if(registeredCallbacks[module]){
registeredCallbacks[module].forEach(function(data){
data.callback();
});
}
};
var callLang = function(data, _noLoop){
if(data.activeLang != currentLang && data.activeLang !== shortLang){
var options = modules[data.module].options;
if( data.langObj[currentLang] || (shortLang && data.langObj[shortLang]) ){
data.activeLang = currentLang;
data.callback(data.langObj[currentLang] || data.langObj[shortLang], currentLang);
callRegister(data.module);
} else if( !_noLoop &&
!loadRemoteLang(data, currentLang, options) &&
!loadRemoteLang(data, shortLang, options) &&
data.langObj[''] && data.activeLang !== '' ) {
data.activeLang = '';
data.callback(data.langObj[''], currentLang);
callRegister(data.module);
}
}
};
var activeLang = function(lang){
if(typeof lang == 'string' && lang !== currentLang){
currentLang = lang;
shortLang = currentLang.split('-')[0];
if(currentLang == shortLang){
shortLang = false;
}
$.each(callbacks, function(i, data){
callLang(data);
});
} else if(typeof lang == 'object'){
if(lang.register){
if(!registeredCallbacks[lang.register]){
registeredCallbacks[lang.register] = [];
}
registeredCallbacks[lang.register].push(lang);
lang.callback();
} else {
if(!lang.activeLang){
lang.activeLang = '';
}
callbacks.push(lang);
callLang(lang);
}
}
return currentLang;
};
return activeLang;
})()
});
$.each({
defineNodeNamesProperty: 'defineNodeNameProperty',
defineNodeNamesProperties: 'defineNodeNameProperties',
createElements: 'createElement'
}, function(name, baseMethod){
webshims[name] = function(names, a, b, c){
if(typeof names == 'string'){
names = names.split(listReg);
}
var retDesc = {};
names.forEach(function(nodeName){
retDesc[nodeName] = webshims[baseMethod](nodeName, a, b, c);
});
return retDesc;
};
});
webshims.isReady('webshimLocalization', true);
});
//html5a11y
(function($, document){
var browserVersion = $.webshims.browserVersion;
if($.browser.mozilla && browserVersion > 5){return;}
if (!$.browser.msie || (browserVersion < 12 && browserVersion > 7)) {
var elemMappings = {
article: "article",
aside: "complementary",
section: "region",
nav: "navigation",
address: "contentinfo"
};
var addRole = function(elem, role){
var hasRole = elem.getAttribute('role');
if (!hasRole) {
elem.setAttribute('role', role);
}
};
$.webshims.addReady(function(context, contextElem){
$.each(elemMappings, function(name, role){
var elems = $(name, context).add(contextElem.filter(name));
for (var i = 0, len = elems.length; i < len; i++) {
addRole(elems[i], role);
}
});
if (context === document) {
var header = document.getElementsByTagName('header')[0];
var footers = document.getElementsByTagName('footer');
var footerLen = footers.length;
if (header && !$(header).closest('section, article')[0]) {
addRole(header, 'banner');
}
if (!footerLen) {
return;
}
var footer = footers[footerLen - 1];
if (!$(footer).closest('section, article')[0]) {
addRole(footer, 'contentinfo');
}
}
});
}
})(jQuery, document);
(function($, Modernizr, webshims){
"use strict";
var hasNative = Modernizr.audio && Modernizr.video;
var supportsLoop = false;
var bugs = webshims.bugs;
var loadSwf = function(){
webshims.ready(swfType, function(){
if(!webshims.mediaelement.createSWF){
webshims.mediaelement.loadSwf = true;
webshims.reTest([swfType], hasNative);
}
});
};
var options = webshims.cfg.mediaelement;
var swfType = options && options.player == 'jwplayer' ? 'mediaelement-swf' : 'mediaelement-jaris';
var hasSwf;
if(!options){
webshims.error("mediaelement wasn't implemented but loaded");
return;
}
if(hasNative){
var videoElem = document.createElement('video');
Modernizr.videoBuffered = ('buffered' in videoElem);
supportsLoop = ('loop' in videoElem);
webshims.capturingEvents(['play', 'playing', 'waiting', 'paused', 'ended', 'durationchange', 'loadedmetadata', 'canplay', 'volumechange']);
if(!Modernizr.videoBuffered){
webshims.addPolyfill('mediaelement-native-fix', {
f: 'mediaelement',
test: Modernizr.videoBuffered,
d: ['dom-support']
});
webshims.reTest('mediaelement-native-fix');
}
}
if(hasNative && !options.preferFlash){
var switchOptions = function(e){
var parent = e.target.parentNode;
if(!options.preferFlash && ($(e.target).is('audio, video') || (parent && $('source:last', parent)[0] == e.target)) ){
webshims.ready('DOM mediaelement', function(){
if(hasSwf){
loadSwf();
}
webshims.ready('WINDOWLOAD '+swfType, function(){
setTimeout(function(){
if(hasSwf && !options.preferFlash && webshims.mediaelement.createSWF && !$(e.target).closest('audio, video').is('.nonnative-api-active')){
options.preferFlash = true;
document.removeEventListener('error', switchOptions, true);
$('audio, video').mediaLoad();
webshims.info("switching mediaelements option to 'preferFlash', due to an error with native player: "+e.target.src);
} else if(!hasSwf){
document.removeEventListener('error', switchOptions, true);
}
}, 20);
});
});
}
};
document.addEventListener('error', switchOptions, true);
$('audio, video').each(function(){
if(this.error){
switchOptions({target: this});
}
});
}
if(Modernizr.track && !bugs.track){
(function(){
if(!bugs.track){
bugs.track = typeof $('<track />')[0].readyState != 'number';
}
if(!bugs.track){
try {
new TextTrackCue(2, 3, '');
} catch(e){
bugs.track = true;
}
}
var trackOptions = webshims.cfg.track;
var trackListener = function(e){
$(e.target).filter('track').each(changeApi);
};
var changeApi = function(){
if(bugs.track || (!trackOptions.override && $.prop(this, 'readyState') == 3)){
trackOptions.override = true;
webshims.reTest('track');
document.removeEventListener('error', trackListener, true);
if(this && $.nodeName(this, 'track')){
webshims.error("track support was overwritten. Please check your vtt including your vtt mime-type");
} else {
webshims.info("track support was overwritten. due to bad browser support");
}
}
};
var detectTrackError = function(){
document.addEventListener('error', trackListener, true);
if(bugs.track){
changeApi();
} else {
$('track').each(changeApi);
}
};
if(!trackOptions.override){
if(webshims.isReady('track')){
detectTrackError();
} else {
$(detectTrackError);
}
}
})();
}
webshims.register('mediaelement-core', function($, webshims, window, document, undefined){
hasSwf = swfobject.hasFlashPlayerVersion('9.0.115');
var mediaelement = webshims.mediaelement;
var getSrcObj = function(elem, nodeName){
elem = $(elem);
var src = {src: elem.attr('src') || '', elem: elem, srcProp: elem.prop('src')};
if(!src.src){return src;}
var tmp = elem.attr('type');
if(tmp){
src.type = tmp;
src.container = $.trim(tmp.split(';')[0]);
} else {
if(!nodeName){
nodeName = elem[0].nodeName.toLowerCase();
if(nodeName == 'source'){
nodeName = (elem.closest('video, audio')[0] || {nodeName: 'video'}).nodeName.toLowerCase();
}
}
tmp = mediaelement.getTypeForSrc(src.src, nodeName );
if(tmp){
src.type = tmp;
src.container = tmp;
}
}
tmp = elem.attr('media');
if(tmp){
src.media = tmp;
}
return src;
};
var hasYt = !hasSwf && ('postMessage' in window) && hasNative;
var loadTrackUi = function(){
if(loadTrackUi.loaded){return;}
loadTrackUi.loaded = true;
$(function(){
webshims.loader.loadList(['track-ui']);
});
};
var loadYt = (function(){
var loaded;
return function(){
if(loaded || !hasYt){return;}
loaded = true;
webshims.loader.loadScript("https://www.youtube.com/player_api");
$(function(){
webshims.polyfill("mediaelement-yt");
});
};
})();
var loadThird = function(){
if(hasSwf){
loadSwf();
} else {
loadYt();
}
};
webshims.addPolyfill('mediaelement-yt', {
test: !hasYt,
d: ['dom-support']
});
mediaelement.mimeTypes = {
audio: {
//ogm shouldn´t be used!
'audio/ogg': ['ogg','oga', 'ogm'],
'audio/ogg;codecs="opus"': 'opus',
'audio/mpeg': ['mp2','mp3','mpga','mpega'],
'audio/mp4': ['mp4','mpg4', 'm4r', 'm4a', 'm4p', 'm4b', 'aac'],
'audio/wav': ['wav'],
'audio/3gpp': ['3gp','3gpp'],
'audio/webm': ['webm'],
'audio/fla': ['flv', 'f4a', 'fla'],
'application/x-mpegURL': ['m3u8', 'm3u']
},
video: {
//ogm shouldn´t be used!
'video/ogg': ['ogg','ogv', 'ogm'],
'video/mpeg': ['mpg','mpeg','mpe'],
'video/mp4': ['mp4','mpg4', 'm4v'],
'video/quicktime': ['mov','qt'],
'video/x-msvideo': ['avi'],
'video/x-ms-asf': ['asf', 'asx'],
'video/flv': ['flv', 'f4v'],
'video/3gpp': ['3gp','3gpp'],
'video/webm': ['webm'],
'application/x-mpegURL': ['m3u8', 'm3u'],
'video/MP2T': ['ts']
}
}
;
mediaelement.mimeTypes.source = $.extend({}, mediaelement.mimeTypes.audio, mediaelement.mimeTypes.video);
mediaelement.getTypeForSrc = function(src, nodeName){
if(src.indexOf('youtube.com/watch?') != -1 || src.indexOf('youtube.com/v/') != -1){
return 'video/youtube';
}
src = src.split('?')[0].split('.');
src = src[src.length - 1];
var mt;
$.each(mediaelement.mimeTypes[nodeName], function(mimeType, exts){
if(exts.indexOf(src) !== -1){
mt = mimeType;
return false;
}
});
return mt;
};
mediaelement.srces = function(mediaElem, srces){
mediaElem = $(mediaElem);
if(!srces){
srces = [];
var nodeName = mediaElem[0].nodeName.toLowerCase();
var src = getSrcObj(mediaElem, nodeName);
if(!src.src){
$('source', mediaElem).each(function(){
src = getSrcObj(this, nodeName);
if(src.src){srces.push(src);}
});
} else {
srces.push(src);
}
return srces;
} else {
mediaElem.removeAttr('src').removeAttr('type').find('source').remove();
if(!$.isArray(srces)){
srces = [srces];
}
srces.forEach(function(src){
var source = document.createElement('source');
if(typeof src == 'string'){
src = {src: src};
}
source.setAttribute('src', src.src);
if(src.type){
source.setAttribute('type', src.type);
}
if(src.media){
source.setAttribute('media', src.media);
}
mediaElem.append(source);
});
}
};
$.fn.loadMediaSrc = function(srces, poster){
return this.each(function(){
if(poster !== undefined){
$(this).removeAttr('poster');
if(poster){
$.attr(this, 'poster', poster);
}
}
mediaelement.srces(this, srces);
$(this).mediaLoad();
});
};
mediaelement.swfMimeTypes = ['video/3gpp', 'video/x-msvideo', 'video/quicktime', 'video/x-m4v', 'video/mp4', 'video/m4p', 'video/x-flv', 'video/flv', 'audio/mpeg', 'audio/aac', 'audio/mp4', 'audio/x-m4a', 'audio/m4a', 'audio/mp3', 'audio/x-fla', 'audio/fla', 'youtube/flv', 'jwplayer/jwplayer', 'video/youtube'];
mediaelement.canThirdPlaySrces = function(mediaElem, srces){
var ret = '';
if(hasSwf || hasYt){
mediaElem = $(mediaElem);
srces = srces || mediaelement.srces(mediaElem);
$.each(srces, function(i, src){
if(src.container && src.src && ((hasSwf && mediaelement.swfMimeTypes.indexOf(src.container) != -1) || (hasYt && src.container == 'video/youtube'))){
ret = src;
return false;
}
});
}
return ret;
};
var nativeCanPlayType = {};
mediaelement.canNativePlaySrces = function(mediaElem, srces){
var ret = '';
if(hasNative){
mediaElem = $(mediaElem);
var nodeName = (mediaElem[0].nodeName || '').toLowerCase();
if(!nativeCanPlayType[nodeName]){return ret;}
srces = srces || mediaelement.srces(mediaElem);
$.each(srces, function(i, src){
if(src.type && nativeCanPlayType[nodeName].prop._supvalue.call(mediaElem[0], src.type) ){
ret = src;
return false;
}
});
}
return ret;
};
mediaelement.setError = function(elem, message){
if(!message){
message = "can't play sources";
}
$(elem).pause().data('mediaerror', message);
webshims.warn('mediaelementError: '+ message);
setTimeout(function(){
if($(elem).data('mediaerror')){
$(elem).trigger('mediaerror');
}
}, 1);
};
var handleThird = (function(){
var requested;
return function( mediaElem, ret, data ){
if(!requested){
loadTrackUi();
}
webshims.ready(hasSwf ? swfType : 'mediaelement-yt', function(){
if(mediaelement.createSWF){
mediaelement.createSWF( mediaElem, ret, data );
} else if(!requested) {
requested = true;
loadThird();
//readd to ready
handleThird( mediaElem, ret, data );
}
});
if(!requested && hasYt && !mediaelement.createSWF){
loadYt();
}
};
})();
var stepSources = function(elem, data, useSwf, _srces, _noLoop){
var ret;
if(useSwf || (useSwf !== false && data && data.isActive == 'third')){
ret = mediaelement.canThirdPlaySrces(elem, _srces);
if(!ret){
if(_noLoop){
mediaelement.setError(elem, false);
} else {
stepSources(elem, data, false, _srces, true);
}
} else {
handleThird(elem, ret, data);
}
} else {
ret = mediaelement.canNativePlaySrces(elem, _srces);
if(!ret){
if(_noLoop){
mediaelement.setError(elem, false);
if(data && data.isActive == 'third') {
mediaelement.setActive(elem, 'html5', data);
}
} else {
stepSources(elem, data, true, _srces, true);
}
} else if(data && data.isActive == 'third') {
mediaelement.setActive(elem, 'html5', data);
}
}
};
var stopParent = /^(?:embed|object|datalist)$/i;
var selectSource = function(elem, data){
var baseData = webshims.data(elem, 'mediaelementBase') || webshims.data(elem, 'mediaelementBase', {});
var _srces = mediaelement.srces(elem);
var parent = elem.parentNode;
clearTimeout(baseData.loadTimer);
$.data(elem, 'mediaerror', false);
if(!_srces.length || !parent || parent.nodeType != 1 || stopParent.test(parent.nodeName || '')){return;}
data = data || webshims.data(elem, 'mediaelement');
stepSources(elem, data, options.preferFlash || undefined, _srces);
};
$(document).on('ended', function(e){
var data = webshims.data(e.target, 'mediaelement');
if( supportsLoop && (!data || data.isActive == 'html5') && !$.prop(e.target, 'loop')){return;}
setTimeout(function(){
if( $.prop(e.target, 'paused') || !$.prop(e.target, 'loop') ){return;}
$(e.target).prop('currentTime', 0).play();
}, 1);
});
if(!supportsLoop){
webshims.defineNodeNamesBooleanProperty(['audio', 'video'], 'loop');
}
['audio', 'video'].forEach(function(nodeName){
var supLoad = webshims.defineNodeNameProperty(nodeName, 'load', {
prop: {
value: function(){
var data = webshims.data(this, 'mediaelement');
selectSource(this, data);
if(hasNative && (!data || data.isActive == 'html5') && supLoad.prop._supvalue){
supLoad.prop._supvalue.apply(this, arguments);
}
}
}
});
nativeCanPlayType[nodeName] = webshims.defineNodeNameProperty(nodeName, 'canPlayType', {
prop: {
value: function(type){
var ret = '';
if(hasNative && nativeCanPlayType[nodeName].prop._supvalue){
ret = nativeCanPlayType[nodeName].prop._supvalue.call(this, type);
if(ret == 'no'){
ret = '';
}
}
if(!ret && hasSwf){
type = $.trim((type || '').split(';')[0]);
if(mediaelement.swfMimeTypes.indexOf(type) != -1){
ret = 'maybe';
}
}
return ret;
}
}
});
});
webshims.onNodeNamesPropertyModify(['audio', 'video'], ['src', 'poster'], {
set: function(){
var elem = this;
var baseData = webshims.data(elem, 'mediaelementBase') || webshims.data(elem, 'mediaelementBase', {});
clearTimeout(baseData.loadTimer);
baseData.loadTimer = setTimeout(function(){
selectSource(elem);
elem = null;
}, 9);
}
});
var initMediaElements = function(){
webshims.addReady(function(context, insertedElement){
var media = $('video, audio', context)
.add(insertedElement.filter('video, audio'))
.each(function(){
if($.browser.msie && webshims.browserVersion > 8 && $.prop(this, 'paused') && !$.prop(this, 'readyState') && $(this).is('audio[preload="none"][controls]:not([autoplay])')){
$(this).prop('preload', 'metadata').mediaLoad();
} else {
selectSource(this);
}
if(hasNative){
var bufferTimer;
var lastBuffered;
var elem = this;
var getBufferedString = function(){
var buffered = $.prop(elem, 'buffered');
if(!buffered){return;}
var bufferString = "";
for(var i = 0, len = buffered.length; i < len;i++){
bufferString += buffered.end(i);
}
return bufferString;
};
var testBuffer = function(){
var buffered = getBufferedString();
if(buffered != lastBuffered){
lastBuffered = buffered;
$(elem).triggerHandler('progress');
}
};
$(this)
.on({
'play loadstart progress': function(e){
if(e.type == 'progress'){
lastBuffered = getBufferedString();
}
clearTimeout(bufferTimer);
bufferTimer = setTimeout(testBuffer, 999);
},
'emptied stalled mediaerror abort suspend': function(e){
if(e.type == 'emptied'){
lastBuffered = false;
}
clearTimeout(bufferTimer);
}
})
;
}
})
;
if(!loadTrackUi.loaded && $('track', media).length){
loadTrackUi();
}
media = null;
});
};
if(Modernizr.track && !bugs.track){
webshims.defineProperty(TextTrack.prototype, 'shimActiveCues', {
get: function(){
return this._shimActiveCues || this.activeCues;
}
});
}
//set native implementation ready, before swf api is retested
if(hasNative){
webshims.isReady('mediaelement-core', true);
initMediaElements();
webshims.ready('WINDOWLOAD mediaelement', loadThird);
} else {
webshims.ready(swfType, initMediaElements);
}
webshims.ready('WINDOWLOAD mediaelement', loadTrackUi);
});
})(jQuery, Modernizr, jQuery.webshims);
/*
* todos:
* - decouple muted/volume (needs improvement)
* - implement video <-> flashcanvas pro API
* - improve buffered-property with youtube/rtmp
* - use jwplayer5 api instead of old flash4 api
*/
jQuery.webshims.register('mediaelement-swf', function($, webshims, window, document, undefined, options){
"use strict";
var SENDEVENT = 'sendEvent';
var mediaelement = webshims.mediaelement;
var swfobject = window.swfobject;
var hasNative = Modernizr.audio && Modernizr.video;
var hasFlash = swfobject.hasFlashPlayerVersion('9.0.115');
var loadedSwf = 0;
var getProps = {
paused: true,
ended: false,
currentSrc: '',
duration: window.NaN,
readyState: 0,
networkState: 0,
videoHeight: 0,
videoWidth: 0,
error: null,
buffered: {
start: function(index){
if(index){
webshims.error('buffered index size error');
return;
}
return 0;
},
end: function(index){
if(index){
webshims.error('buffered index size error');
return;
}
return 0;
},
length: 0
}
};
var getPropKeys = Object.keys(getProps);
var getSetProps = {
currentTime: 0,
volume: 1,
muted: false
};
var getSetPropKeys = Object.keys(getSetProps);
var playerStateObj = $.extend({
isActive: 'html5',
activating: 'html5',
wasSwfReady: false,
_bufferedEnd: 0,
_bufferedStart: 0,
_metadata: false,
_durationCalcs: -1,
_callMeta: false,
currentTime: 0,
_ppFlag: undefined
}, getProps, getSetProps);
var idRep = /^jwplayer-/;
var getSwfDataFromID = function(id){
var elem = document.getElementById(id.replace(idRep, ''));
if(!elem){return;}
var data = webshims.data(elem, 'mediaelement');
return data.isActive == 'third' ? data : null;
};
var getSwfDataFromElem = function(elem){
try {
(elem.nodeName);
} catch(er){
return null;
}
var data = webshims.data(elem, 'mediaelement');
return (data && data.isActive== 'third') ? data : null;
};
var trigger = function(elem, evt){
evt = $.Event(evt);
evt.preventDefault();
$.event.trigger(evt, undefined, elem);
};
var playerSwfPath = options.playerPath || webshims.cfg.basePath + "jwplayer/" + (options.playerName || "player.swf");
var jwplugin = options.pluginPath || webshims.cfg.basePath +'swf/jwwebshims.swf';
webshims.extendUNDEFProp(options.params, {
allowscriptaccess: 'always',
allowfullscreen: 'true',
wmode: 'transparent'
});
webshims.extendUNDEFProp(options.vars, {
screencolor: 'ffffffff'
});
webshims.extendUNDEFProp(options.attrs, {
bgcolor: '#000000'
});
var getDuration = function(data, obj){
var curDuration = data.duration;
if(curDuration && data._durationCalcs > 0){return;}
try {
data.duration = data.jwapi.getPlaylist()[0].duration;
if(!data.duration || data.duration <= 0 || data.duration === data._lastDuration){
data.duration = curDuration;
}
} catch(er){}
if(data.duration && data.duration != data._lastDuration){
trigger(data._elem, 'durationchange');
if(data._elemNodeName == 'audio' || data._callMeta){
mediaelement.jwEvents.Model.META($.extend({duration: data.duration}, obj), data);
}
data._durationCalcs--;
} else {
data._durationCalcs++;
}
};
var setReadyState = function(readyState, data){
if(readyState < 3){
clearTimeout(data._canplaythroughTimer);
}
if(readyState >= 3 && data.readyState < 3){
data.readyState = readyState;
trigger(data._elem, 'canplay');
clearTimeout(data._canplaythroughTimer);
data._canplaythroughTimer = setTimeout(function(){
setReadyState(4, data);
}, 4000);
}
if(readyState >= 4 && data.readyState < 4){
data.readyState = readyState;
trigger(data._elem, 'canplaythrough');
}
data.readyState = readyState;
};
$.extend($.event.customEvent, {
updatemediaelementdimensions: true,
flashblocker: true,
swfstageresize: true,
mediaelementapichange: true
});
mediaelement.jwEvents = {
View: {
PLAY: function(obj){
var data = getSwfDataFromID(obj.id);
if(!data || data.stopPlayPause){return;}
data._ppFlag = true;
if(data.paused == obj.state){
data.paused = !obj.state;
if(data.ended){
data.ended = false;
}
trigger(data._elem, obj.state ? 'play' : 'pause');
}
}
},
Model: {
BUFFER: function(obj){
var data = getSwfDataFromID(obj.id);
if(!data || !('percentage' in obj) || data._bufferedEnd == obj.percentage){return;}
data.networkState = (obj.percentage == 100) ? 1 : 2;
if(isNaN(data.duration) || (obj.percentage > 5 && obj.percentage < 25) || (obj.percentage === 100)){
getDuration(data, obj);
}
if(data.ended){
data.ended = false;
}
if(!data.duration){
return;
}
if(obj.percentage > 2 && obj.percentage < 20){
setReadyState(3, data);
} else if(obj.percentage > 20){
setReadyState(4, data);
}
if(data._bufferedEnd && (data._bufferedEnd > obj.percentage)){
data._bufferedStart = data.currentTime || 0;
}
data._bufferedEnd = obj.percentage;
data.buffered.length = 1;
if(obj.percentage == 100){
data.networkState = 1;
setReadyState(4, data);
}
$.event.trigger('progress', undefined, data._elem, true);
},
META: function(obj, data){
data = data && data.networkState ? data : getSwfDataFromID(obj.id);
if(!data){return;}
if( !('duration' in obj) ){
data._callMeta = true;
return;
}
if( data._metadata && (!obj.height || data.videoHeight == obj.height) && (obj.duration === data.duration) ){return;}
data._metadata = true;
var oldDur = data.duration;
if(obj.duration){
data.duration = obj.duration;
}
data._lastDuration = data.duration;
if(obj.height || obj.width){
data.videoHeight = obj.height || 0;
data.videoWidth = obj.width || 0;
}
if(!data.networkState){
data.networkState = 2;
}
if(data.readyState < 1){
setReadyState(1, data);
}
if(data.duration && oldDur !== data.duration){
trigger(data._elem, 'durationchange');
}
trigger(data._elem, 'loadedmetadata');
},
TIME: function(obj){
var data = getSwfDataFromID(obj.id);
if(!data || data.currentTime === obj.position){return;}
data.currentTime = obj.position;
if(data.duration && data.duration < data.currentTime){
getDuration(data, obj);
}
if(data.readyState < 2){
setReadyState(2, data);
}
if(data.ended){
data.ended = false;
}
trigger(data._elem, 'timeupdate');
},
STATE: function(obj){
var data = getSwfDataFromID(obj.id);
if(!data){return;}
switch(obj.newstate) {
case 'BUFFERING':
if(data.ended){
data.ended = false;
}
setReadyState(1, data);
trigger(data._elem, 'waiting');
break;
case 'PLAYING':
data.paused = false;
data._ppFlag = true;
if(!data.duration){
getDuration(data, obj);
}
if(data.readyState < 3){
setReadyState(3, data);
}
if(data.ended){
data.ended = false;
}
trigger(data._elem, 'playing');
break;
case 'PAUSED':
if(!data.paused && !data.stopPlayPause){
data.paused = true;
data._ppFlag = true;
trigger(data._elem, 'pause');
}
break;
case 'COMPLETED':
if(data.readyState < 4){
setReadyState(4, data);
}
data.ended = true;
trigger(data._elem, 'ended');
break;
}
}
}
,Controller: {
ERROR: function(obj){
var data = getSwfDataFromID(obj.id);
if(!data){return;}
mediaelement.setError(data._elem, obj.message);
},
SEEK: function(obj){
var data = getSwfDataFromID(obj.id);
if(!data){return;}
if(data.ended){
data.ended = false;
}
if(data.paused){
try {
data.jwapi[SENDEVENT]('play', 'false');
} catch(er){}
}
if(data.currentTime != obj.position){
data.currentTime = obj.position;
trigger(data._elem, 'timeupdate');
}
},
VOLUME: function(obj){
var data = getSwfDataFromID(obj.id);
if(!data){return;}
var newVolume = obj.percentage / 100;
if(data.volume == newVolume){return;}
data.volume = newVolume;
trigger(data._elem, 'volumechange');
},
MUTE: function(obj){
if(obj.state){return;}
var data = getSwfDataFromID(obj.id);
if(!data){return;}
if(data.muted == obj.state){return;}
data.muted = obj.state;
trigger(data._elem, 'volumechange');
}
}
};
var initEvents = function(data){
var passed = true;
$.each(mediaelement.jwEvents, function(mvcName, evts){
$.each(evts, function(evtName){
try {
data.jwapi['add'+ mvcName +'Listener'](evtName, 'jQuery.webshims.mediaelement.jwEvents.'+ mvcName +'.'+ evtName);
} catch(er){
passed = false;
return false;
}
});
});
return passed;
};
var workActionQueue = function(data){
var actionLen = data.actionQueue.length;
var i = 0;
var operation;
if(actionLen && data.isActive == 'third'){
while(data.actionQueue.length && actionLen > i){
i++;
operation = data.actionQueue.shift();
data.jwapi[operation.fn].apply(data.jwapi, operation.args);
}
}
if(data.actionQueue.length){
data.actionQueue = [];
}
};
var startAutoPlay = function(data){
if(!data){return;}
if( (data._ppFlag === undefined && ($.prop(data._elem, 'autoplay')) || !data.paused)){
setTimeout(function(){
if(data.isActive == 'third' && (data._ppFlag === undefined || !data.paused)){
try {
$(data._elem).play();
} catch(er){}
}
}, 1);
}
};
mediaelement.playerResize = function(id){
if(!id){return;}
var elem = document.getElementById(id.replace(idRep, ''));
if(elem){
$(elem).triggerHandler('swfstageresize');
}
elem = null;
};
$(document).on('emptied', function(e){
var data = getSwfDataFromElem(e.target);
startAutoPlay(data);
});
var localConnectionTimer;
mediaelement.jwPlayerReady = function(jwData){
var data = getSwfDataFromID(jwData.id);
var passed = true;
var i = 0;
var doneFn = function(){
if(i > 9){return;}
i++;
if(initEvents(data)){
if(!data.wasSwfReady){
var version = parseFloat( jwData.version, 10);
if(version < 5.1 || version >= 6){
webshims.warn('mediaelement-swf is only testet with jwplayer 5.6+');
}
} else {
$(data._elem).mediaLoad();
}
data.wasSwfReady = true;
data.tryedReframeing = 0;
workActionQueue(data);
startAutoPlay(data);
} else {
clearTimeout(data.reframeTimer);
data.reframeTimer = setTimeout(doneFn, 9 * i);
if(i > 2 && data.tryedReframeing < 9){
data.tryedReframeing++;
data.shadowElem.css({overflow: 'visible'});
setTimeout(function(){
data.shadowElem.css({overflow: 'hidden'});
}, 16);
}
}
};
if(!data || !data.jwapi){return;}
if(!data.tryedReframeing){
data.tryedReframeing = 0;
}
clearTimeout(localConnectionTimer);
data.jwData = jwData;
data.shadowElem.removeClass('flashblocker-assumed');
$.prop(data._elem, 'volume', data.volume);
$.prop(data._elem, 'muted', data.muted);
doneFn();
};
var addMediaToStopEvents = $.noop;
if(hasNative){
var stopEvents = {
play: 1,
playing: 1
};
var hideEvtArray = ['play', 'pause', 'playing', 'canplay', 'progress', 'waiting', 'ended', 'loadedmetadata', 'durationchange', 'emptied'];
var hidevents = hideEvtArray.map(function(evt){
return evt +'.webshimspolyfill';
}).join(' ');
var hidePlayerEvents = function(event){
var data = webshims.data(event.target, 'mediaelement');
if(!data){return;}
var isNativeHTML5 = ( event.originalEvent && event.originalEvent.type === event.type );
if( isNativeHTML5 == (data.activating == 'third') ){
event.stopImmediatePropagation();
if(stopEvents[event.type] && data.isActive != data.activating){
$(event.target).pause();
}
}
};
addMediaToStopEvents = function(elem){
$(elem)
.off(hidevents)
.on(hidevents, hidePlayerEvents)
;
hideEvtArray.forEach(function(evt){
webshims.moveToFirstEvent(elem, evt);
});
};
addMediaToStopEvents(document);
}
mediaelement.setActive = function(elem, type, data){
if(!data){
data = webshims.data(elem, 'mediaelement');
}
if(!data || data.isActive == type){return;}
if(type != 'html5' && type != 'third'){
webshims.warn('wrong type for mediaelement activating: '+ type);
}
var shadowData = webshims.data(elem, 'shadowData');
data.activating = type;
$(elem).pause();
data.isActive = type;
if(type == 'third'){
shadowData.shadowElement = shadowData.shadowFocusElement = data.shadowElem[0];
$(elem).addClass('swf-api-active nonnative-api-active').hide().getShadowElement().show();
} else {
$(elem).removeClass('swf-api-active nonnative-api-active').show().getShadowElement().hide();
shadowData.shadowElement = shadowData.shadowFocusElement = false;
}
$(elem).trigger('mediaelementapichange');
};
var resetSwfProps = (function(){
var resetProtoProps = ['_bufferedEnd', '_bufferedStart', '_metadata', '_ppFlag', 'currentSrc', 'currentTime', 'duration', 'ended', 'networkState', 'paused', 'videoHeight', 'videoWidth', '_callMeta', '_durationCalcs'];
var len = resetProtoProps.length;
return function(data){
if(!data){return;}
var lenI = len;
var networkState = data.networkState;
setReadyState(0, data);
while(--lenI){
delete data[resetProtoProps[lenI]];
}
data.actionQueue = [];
data.buffered.length = 0;
if(networkState){
trigger(data._elem, 'emptied');
}
};
})();
var setElementDimension = function(data, hasControls){
var elem = data._elem;
var box = data.shadowElem;
$(elem)[hasControls ? 'addClass' : 'removeClass']('webshims-controls');
if(data._elemNodeName == 'audio' && !hasControls){
box.css({width: 0, height: 0});
} else {
box.css({
width: elem.style.width || $(elem).width(),
height: elem.style.height || $(elem).height()
});
}
};
mediaelement.createSWF = function( elem, canPlaySrc, data ){
if(!hasFlash){
setTimeout(function(){
$(elem).mediaLoad(); //<- this should produce a mediaerror
}, 1);
return;
}
if(loadedSwf < 1){
loadedSwf = 1;
} else {
loadedSwf++;
}
var vars = $.extend({}, options.vars, {
image: $.prop(elem, 'poster') || '',
file: canPlaySrc.srcProp
});
var elemVars = $(elem).data('vars') || {};
if(!data){
data = webshims.data(elem, 'mediaelement');
}
if(data && data.swfCreated){
mediaelement.setActive(elem, 'third', data);
resetSwfProps(data);
data.currentSrc = canPlaySrc.srcProp;
$.extend(vars, elemVars);
options.changeSWF(vars, elem, canPlaySrc, data, 'load');
queueSwfMethod(elem, SENDEVENT, ['LOAD', vars]);
return;
}
var hasControls = $.prop(elem, 'controls');
var elemId = 'jwplayer-'+ webshims.getID(elem);
var params = $.extend(
{},
options.params,
$(elem).data('params')
);
var elemNodeName = elem.nodeName.toLowerCase();
var attrs = $.extend(
{},
options.attrs,
{
name: elemId,
id: elemId
},
$(elem).data('attrs')
);
var box = $('<div class="polyfill-'+ (elemNodeName) +' polyfill-mediaelement" id="wrapper-'+ elemId +'"><div id="'+ elemId +'"></div>')
.css({
position: 'relative',
overflow: 'hidden'
})
;
data = webshims.data(elem, 'mediaelement', webshims.objectCreate(playerStateObj, {
actionQueue: {
value: []
},
shadowElem: {
value: box
},
_elemNodeName: {
value: elemNodeName
},
_elem: {
value: elem
},
currentSrc: {
value: canPlaySrc.srcProp
},
swfCreated: {
value: true
},
buffered: {
value: {
start: function(index){
if(index >= data.buffered.length){
webshims.error('buffered index size error');
return;
}
return 0;
},
end: function(index){
if(index >= data.buffered.length){
webshims.error('buffered index size error');
return;
}
return ( (data.duration - data._bufferedStart) * data._bufferedEnd / 100) + data._bufferedStart;
},
length: 0
}
}
}));
setElementDimension(data, hasControls);
box.insertBefore(elem);
if(hasNative){
$.extend(data, {volume: $.prop(elem, 'volume'), muted: $.prop(elem, 'muted')});
}
$.extend(vars,
{
id: elemId,
controlbar: hasControls ? options.vars.controlbar || (elemNodeName == 'video' ? 'over' : 'bottom') : (elemNodeName == 'video') ? 'none' : 'bottom',
icons: ''+ (hasControls && elemNodeName == 'video')
},
elemVars,
{playerready: 'jQuery.webshims.mediaelement.jwPlayerReady'}
);
if(vars.plugins){
vars.plugins += ','+jwplugin;
} else {
vars.plugins = jwplugin;
}
webshims.addShadowDom(elem, box);
addMediaToStopEvents(elem);
mediaelement.setActive(elem, 'third', data);
options.changeSWF(vars, elem, canPlaySrc, data, 'embed');
$(elem).on('updatemediaelementdimensions updateshadowdom', function(){
setElementDimension(data, $.prop(elem, 'controls'));
});
swfobject.embedSWF(playerSwfPath, elemId, "100%", "100%", "9.0.0", false, vars, params, attrs, function(swfData){
if(swfData.success){
data.jwapi = swfData.ref;
if(!hasControls){
$(swfData.ref).attr('tabindex', '-1').css('outline', 'none');
}
setTimeout(function(){
if((!swfData.ref.parentNode && box[0].parentNode) || swfData.ref.style.display == "none"){
box.addClass('flashblocker-assumed');
$(elem).trigger('flashblocker');
webshims.warn("flashblocker assumed");
}
$(swfData.ref).css({'minHeight': '2px', 'minWidth': '2px', display: 'block'});
}, 9);
if(!localConnectionTimer){
clearTimeout(localConnectionTimer);
localConnectionTimer = setTimeout(function(){
var flash = $(swfData.ref);
if(flash[0].offsetWidth > 1 && flash[0].offsetHeight > 1 && location.protocol.indexOf('file:') === 0){
webshims.error("Add your local development-directory to the local-trusted security sandbox: http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html");
} else if(flash[0].offsetWidth < 2 || flash[0].offsetHeight < 2) {
webshims.warn("JS-SWF connection can't be established on hidden or unconnected flash objects");
}
flash = null;
}, 8000);
}
}
});
};
var queueSwfMethod = function(elem, fn, args, data){
data = data || getSwfDataFromElem(elem);
if(data){
if(data.jwapi && data.jwapi[fn]){
data.jwapi[fn].apply(data.jwapi, args || []);
} else {
//todo add to queue
data.actionQueue.push({fn: fn, args: args});
if(data.actionQueue.length > 10){
setTimeout(function(){
if(data.actionQueue.length > 5){
data.actionQueue.shift();
}
}, 99);
}
}
return data;
}
return false;
};
['audio', 'video'].forEach(function(nodeName){
var descs = {};
var mediaSup;
var createGetProp = function(key){
if(nodeName == 'audio' && (key == 'videoHeight' || key == 'videoWidth')){return;}
descs[key] = {
get: function(){
var data = getSwfDataFromElem(this);
if(data){
return data[key];
} else if(hasNative && mediaSup[key].prop._supget) {
return mediaSup[key].prop._supget.apply(this);
} else {
return playerStateObj[key];
}
},
writeable: false
};
};
var createGetSetProp = function(key, setFn){
createGetProp(key);
delete descs[key].writeable;
descs[key].set = setFn;
};
createGetSetProp('volume', function(v){
var data = getSwfDataFromElem(this);
if(data){
v *= 100;
if(!isNaN(v)){
var muted = data.muted;
if(v < 0 || v > 100){
webshims.error('volume greater or less than allowed '+ (v / 100));
}
queueSwfMethod(this, SENDEVENT, ['VOLUME', v], data);
if(muted){
try {
data.jwapi.sendEvent('mute', 'true');
} catch(er){}
}
v /= 100;
if(data.volume == v || data.isActive != 'third'){return;}
data.volume = v;
trigger(data._elem, 'volumechange');
data = null;
}
} else if(mediaSup.volume.prop._supset) {
return mediaSup.volume.prop._supset.apply(this, arguments);
}
});
createGetSetProp('muted', function(m){
var data = getSwfDataFromElem(this);
if(data){
m = !!m;
queueSwfMethod(this, SENDEVENT, ['mute', ''+m], data);
if(data.muted == m || data.isActive != 'third'){return;}
data.muted = m;
trigger(data._elem, 'volumechange');
data = null;
} else if(mediaSup.muted.prop._supset) {
return mediaSup.muted.prop._supset.apply(this, arguments);
}
});
createGetSetProp('currentTime', function(t){
var data = getSwfDataFromElem(this);
if(data){
t *= 1;
if (!isNaN(t)) {
if(data.paused){
clearTimeout(data.stopPlayPause);
data.stopPlayPause = setTimeout(function(){
data.paused = true;
data.stopPlayPause = false;
}, 50);
}
queueSwfMethod(this, SENDEVENT, ['SEEK', '' + t], data);
if(data.paused){
if(data.readyState > 0){
data.currentTime = t;
trigger(data._elem, 'timeupdate');
}
try {
data.jwapi[SENDEVENT]('play', 'false');
} catch(er){}
}
}
} else if(mediaSup.currentTime.prop._supset) {
return mediaSup.currentTime.prop._supset.apply(this, arguments);
}
});
['play', 'pause'].forEach(function(fn){
descs[fn] = {
value: function(){
var data = getSwfDataFromElem(this);
if(data){
if(data.stopPlayPause){
clearTimeout(data.stopPlayPause);
}
queueSwfMethod(this, SENDEVENT, ['play', fn == 'play'], data);
setTimeout(function(){
if(data.isActive == 'third'){
data._ppFlag = true;
if(data.paused != (fn != 'play')){
data.paused = fn != 'play';
trigger(data._elem, fn);
}
}
}, 1);
} else if(mediaSup[fn].prop._supvalue) {
return mediaSup[fn].prop._supvalue.apply(this, arguments);
}
}
};
});
getPropKeys.forEach(createGetProp);
webshims.onNodeNamesPropertyModify(nodeName, 'controls', function(val, boolProp){
var data = getSwfDataFromElem(this);
$(this)[boolProp ? 'addClass' : 'removeClass']('webshims-controls');
if(data){
try {
queueSwfMethod(this, boolProp ? 'showControls' : 'hideControls', [nodeName], data);
} catch(er){
webshims.warn("you need to generate a crossdomain.xml");
}
if(nodeName == 'audio'){
setElementDimension(data, boolProp);
}
$(data.jwapi).attr('tabindex', boolProp ? '0' : '-1');
}
});
mediaSup = webshims.defineNodeNameProperties(nodeName, descs, 'prop');
});
if(hasFlash){
var oldClean = $.cleanData;
var gcBrowser = $.browser.msie && webshims.browserVersion < 9;
var flashNames = {
object: 1,
OBJECT: 1
};
$.cleanData = function(elems){
var i, len, prop;
if(elems && (len = elems.length) && loadedSwf){
for(i = 0; i < len; i++){
if(flashNames[elems[i].nodeName]){
if(SENDEVENT in elems[i]){
loadedSwf--;
try {
elems[i][SENDEVENT]('play', false);
} catch(er){}
}
if(gcBrowser){
try {
for (prop in elems[i]) {
if (typeof elems[i][prop] == "function") {
elems[i][prop] = null;
}
}
} catch(er){}
}
}
}
}
return oldClean.apply(this, arguments);
};
}
if(!hasNative){
['poster', 'src'].forEach(function(prop){
webshims.defineNodeNamesProperty(prop == 'src' ? ['audio', 'video', 'source'] : ['video'], prop, {
//attr: {},
reflect: true,
propType: 'src'
});
});
['autoplay', 'controls'].forEach(function(name){
webshims.defineNodeNamesBooleanProperty(['audio', 'video'], name);
});
webshims.defineNodeNamesProperties(['audio', 'video'], {
HAVE_CURRENT_DATA: {
value: 2
},
HAVE_ENOUGH_DATA: {
value: 4
},
HAVE_FUTURE_DATA: {
value: 3
},
HAVE_METADATA: {
value: 1
},
HAVE_NOTHING: {
value: 0
},
NETWORK_EMPTY: {
value: 0
},
NETWORK_IDLE: {
value: 1
},
NETWORK_LOADING: {
value: 2
},
NETWORK_NO_SOURCE: {
value: 3
}
}, 'prop');
}
}); | fitzryland/collectiveagencyco | wp-content/themes/caTesting/js-webshim/dev/shims/combos/9.js | JavaScript | gpl-2.0 | 65,053 |
angular.module('app.directives.topBarMe', ['ngRoute'])
.directive('topBarMe', [function() {
var directive = {};
directive.restrict = 'E'; /* restrict this directive to elements */
directive.templateUrl = "app/templates/topBar.html";
directive.transclude= true;
return directive;
}]);
| DazzleWorks/Premi | public/app/directives/main/topBar.js | JavaScript | gpl-2.0 | 328 |
var class_q_c_p_axis_rect =
[
[ "QCPAxisRect", "class_q_c_p_axis_rect.html#a60b31dece805462c1b82eea2e69ba042", null ],
[ "~QCPAxisRect", "class_q_c_p_axis_rect.html#a463c44b1856ddbf82eb3f7b582839cd0", null ],
[ "addAxes", "class_q_c_p_axis_rect.html#a792e1f3d9cb1591fca135bb0de9b81fc", null ],
[ "addAxis", "class_q_c_p_axis_rect.html#acbc382cc7715d23310d65d91f50a4bde", null ],
[ "applyDefaultAntialiasingHint", "class_q_c_p_axis_rect.html#a9a6dd0763701cbc7d01f899bcbb3f9ca", null ],
[ "axes", "class_q_c_p_axis_rect.html#a66654d51ca611ef036ded36250cd2518", null ],
[ "axes", "class_q_c_p_axis_rect.html#a18dcdc0dd6c7520bc9f3d15a7a3feec2", null ],
[ "axis", "class_q_c_p_axis_rect.html#a560de44e47a4af0f86c59102a094b1e4", null ],
[ "axisCount", "class_q_c_p_axis_rect.html#a16e3e4646e52e4b5d5b865076c29ae58", null ],
[ "background", "class_q_c_p_axis_rect.html#a0daa1dadd2a62dbfa37b7f742edd0059", null ],
[ "backgroundScaled", "class_q_c_p_axis_rect.html#a67c18777b88fe9c81dee3dd2b5f50e5c", null ],
[ "backgroundScaledMode", "class_q_c_p_axis_rect.html#a3d0f42d6be11a0b3d4576402a2b0032d", null ],
[ "bottom", "class_q_c_p_axis_rect.html#af2b5982ebe7e6f781b9bf1cc371a60d8", null ],
[ "bottomLeft", "class_q_c_p_axis_rect.html#a724b0333971ea6a338f0dbd814dc97ae", null ],
[ "bottomRight", "class_q_c_p_axis_rect.html#a49ea3c7dff834b47e266cbf3d79f78b9", null ],
[ "calculateAutoMargin", "class_q_c_p_axis_rect.html#ae79f18302e6507586aa8c032a5f9ed1c", null ],
[ "center", "class_q_c_p_axis_rect.html#aea5e6042bca198424fa1bc02fc282e59", null ],
[ "draw", "class_q_c_p_axis_rect.html#afb1bbbbda8345cd2710d92ee48440b53", null ],
[ "drawBackground", "class_q_c_p_axis_rect.html#ab49d338d1ce74b476fcead5b32cf06dc", null ],
[ "elements", "class_q_c_p_axis_rect.html#a2bda6bf2b5b5797f92583cecd01c8949", null ],
[ "graphs", "class_q_c_p_axis_rect.html#afa4ff90901d9275f670e24b40e3c1b25", null ],
[ "height", "class_q_c_p_axis_rect.html#a1c55c4f3bef40cf01b21820316c8469e", null ],
[ "insetLayout", "class_q_c_p_axis_rect.html#a4114887c7141b59650b7488f930993e5", null ],
[ "items", "class_q_c_p_axis_rect.html#a0f17ed539962cfcbaca8ce0b1776c840", null ],
[ "left", "class_q_c_p_axis_rect.html#a55b3ecf72a3a65b053f7651b88db458d", null ],
[ "mouseMoveEvent", "class_q_c_p_axis_rect.html#a4baf3d5dd69166788f6ceda0ea182c6e", null ],
[ "mousePressEvent", "class_q_c_p_axis_rect.html#a77501dbeccdac7256f7979b05077c04e", null ],
[ "mouseReleaseEvent", "class_q_c_p_axis_rect.html#adf6c99780cea55ab39459a6eaad3a94a", null ],
[ "plottables", "class_q_c_p_axis_rect.html#a5b0d629c8de5572945eeae79a142296e", null ],
[ "rangeDrag", "class_q_c_p_axis_rect.html#af24b46954ce27a26b23770cdb8319080", null ],
[ "rangeDragAxis", "class_q_c_p_axis_rect.html#a6d7c22cfc54fac7a3d6ef80b133a8574", null ],
[ "rangeZoom", "class_q_c_p_axis_rect.html#a3397fc60e5df29089090bc236e9f05f6", null ],
[ "rangeZoomAxis", "class_q_c_p_axis_rect.html#a679c63f2b8daccfe6ec5110dce3dd3b6", null ],
[ "rangeZoomFactor", "class_q_c_p_axis_rect.html#ae4e6c4d143aacc88d2d3c56f117c2fe1", null ],
[ "removeAxis", "class_q_c_p_axis_rect.html#a03c39cd9704f0d36fb6cf980cdddcbaa", null ],
[ "right", "class_q_c_p_axis_rect.html#a6d0f989fc552aa2b563cf82f8fc81e61", null ],
[ "setBackground", "class_q_c_p_axis_rect.html#af615ab5e52b8e0a9a0eff415b6559db5", null ],
[ "setBackground", "class_q_c_p_axis_rect.html#ac48a2d5d9b7732e73b86605c69c5e4c1", null ],
[ "setBackground", "class_q_c_p_axis_rect.html#a22a22b8668735438dc06f9a55fe46b33", null ],
[ "setBackgroundScaled", "class_q_c_p_axis_rect.html#ae6d36c3e0e968ffb991170a018e7b503", null ],
[ "setBackgroundScaledMode", "class_q_c_p_axis_rect.html#a5ef77ea829c9de7ba248e473f48f7305", null ],
[ "setRangeDrag", "class_q_c_p_axis_rect.html#ae6aef2f7211ba6097c925dcd26008418", null ],
[ "setRangeDragAxes", "class_q_c_p_axis_rect.html#a648cce336bd99daac4a5ca3e5743775d", null ],
[ "setRangeZoom", "class_q_c_p_axis_rect.html#a7960a9d222f1c31d558b064b60f86a31", null ],
[ "setRangeZoomAxes", "class_q_c_p_axis_rect.html#a9442cca2aa358405f39a64d51eca13d2", null ],
[ "setRangeZoomFactor", "class_q_c_p_axis_rect.html#a895d7ac745ea614e04056244b3c138ac", null ],
[ "setRangeZoomFactor", "class_q_c_p_axis_rect.html#ae83d187b03fc6fa4f00765ad50cd3fc3", null ],
[ "setupFullAxesBox", "class_q_c_p_axis_rect.html#a5fa906175447b14206954f77fc7f1ef4", null ],
[ "size", "class_q_c_p_axis_rect.html#a871b9fe49e92b39a3cbe29a59e458536", null ],
[ "top", "class_q_c_p_axis_rect.html#ac45aef1eb75cea46b241b6303028a607", null ],
[ "topLeft", "class_q_c_p_axis_rect.html#a88acbe716bcf5072790a6f95637c40d8", null ],
[ "topRight", "class_q_c_p_axis_rect.html#a232409546394c23b59407bc62fa460a8", null ],
[ "update", "class_q_c_p_axis_rect.html#a8bdf6f76baa7b6c464706bce9b975a27", null ],
[ "updateAxesOffset", "class_q_c_p_axis_rect.html#a6024ccdc74f5dc0e8a0fe482e5b28a20", null ],
[ "wheelEvent", "class_q_c_p_axis_rect.html#a5acf41fc30aa68ea263246ecfad85c31", null ],
[ "width", "class_q_c_p_axis_rect.html#a45bf5c17f4ca29131b7eb0db06efc259", null ],
[ "QCustomPlot", "class_q_c_p_axis_rect.html#a1cdf9df76adcfae45261690aa0ca2198", null ],
[ "mAADragBackup", "class_q_c_p_axis_rect.html#aa4a24f76360cfebe1bcf17a77fa7521b", null ],
[ "mAxes", "class_q_c_p_axis_rect.html#afe7a24d2a2bea98fc552fa826350ba81", null ],
[ "mBackgroundBrush", "class_q_c_p_axis_rect.html#a5748e1a37f63c428e38b0a7724b46259", null ],
[ "mBackgroundPixmap", "class_q_c_p_axis_rect.html#a38fb1a15f43228a0c124553649303722", null ],
[ "mBackgroundScaled", "class_q_c_p_axis_rect.html#a5ad835f0fae5d7cc5ada9e063641dbf1", null ],
[ "mBackgroundScaledMode", "class_q_c_p_axis_rect.html#a859fd368e794663e346b4f53f35078e9", null ],
[ "mDragging", "class_q_c_p_axis_rect.html#ab49a6698194cf0e9e38a1d734c0888a8", null ],
[ "mDragStart", "class_q_c_p_axis_rect.html#a032896b28f83a58010d8d533b78c49df", null ],
[ "mDragStartHorzRange", "class_q_c_p_axis_rect.html#a41936cf473ec638bec382f5a40cdb1f3", null ],
[ "mDragStartVertRange", "class_q_c_p_axis_rect.html#a1a5ae4c74b8bd46baf91bf4e4f4165f0", null ],
[ "mInsetLayout", "class_q_c_p_axis_rect.html#a255240399e0fd24baad80cbbe46f698a", null ],
[ "mNotAADragBackup", "class_q_c_p_axis_rect.html#a6fcb12e052e276d57efbb128be31d6f5", null ],
[ "mRangeDrag", "class_q_c_p_axis_rect.html#aa9f107f66ca3469ad50ee6cea7c9e237", null ],
[ "mRangeDragHorzAxis", "class_q_c_p_axis_rect.html#ad968e82c00bed35250f2fa1394e2434f", null ],
[ "mRangeDragVertAxis", "class_q_c_p_axis_rect.html#a50a38866ae73cbec970ef89550d4df7b", null ],
[ "mRangeZoom", "class_q_c_p_axis_rect.html#a215eff671d48df2edccc36e7f976f28c", null ],
[ "mRangeZoomFactorHorz", "class_q_c_p_axis_rect.html#ad08d0250ed7b99de387d0ea6c7fd4dc1", null ],
[ "mRangeZoomFactorVert", "class_q_c_p_axis_rect.html#a32f063629581d5bf82b12769940b34ad", null ],
[ "mRangeZoomHorzAxis", "class_q_c_p_axis_rect.html#aa1ed50c92e235aef88112ce7eef7d252", null ],
[ "mRangeZoomVertAxis", "class_q_c_p_axis_rect.html#a5ea4480ad5c816cc3c2eed2cd9ed1f4e", null ],
[ "mScaledBackgroundPixmap", "class_q_c_p_axis_rect.html#aa74b9415598d59b49290e41e42d7ee27", null ]
]; | AeroQuad/AeroQuadCommunicator | Documentation/html/class_q_c_p_axis_rect.js | JavaScript | gpl-2.0 | 7,387 |
/*
* File: app/view/DomainContainer.js
*
* This file was generated by Sencha Architect version 3.2.0.
* http://www.sencha.com/products/architect/
*
* This file requires use of the Ext JS 4.2.x library, under independent license.
* License of Sencha Architect does not include license for Ext JS 4.2.x. For more
* details see http://www.sencha.com/license or contact [email protected].
*
* This file will be auto-generated each and everytime you save your project.
*
* Do NOT hand edit this file.
*/
Ext.define('webapp.view.DomainContainer', {
extend: 'Ext.container.Container',
alias: 'widget.domaincontainer',
requires: [
'Ext.form.field.Display',
'Ext.tab.Panel',
'Ext.tab.Tab',
'Ext.toolbar.Separator',
'Ext.form.field.ComboBox',
'Ext.grid.Panel',
'Ext.grid.View',
'Ext.grid.column.Number',
'Ext.grid.column.Date',
'Ext.toolbar.Paging',
'Ext.grid.plugin.RowEditing'
],
itemId: 'mycontainer37',
layout: 'border',
initComponent: function() {
var me = this;
Ext.applyIf(me, {
items: [
{
xtype: 'panel',
flex: 1.5,
region: 'north',
height: 150,
layout: 'column',
title: 'Overview',
items: [
{
xtype: 'displayfield',
id: 'domainNameField',
width: 164,
fieldLabel: 'Name',
labelWidth: 50,
name: 'DomainNameField',
value: 'Domain 1'
},
{
xtype: 'displayfield',
id: 'tomcatInstancesField',
width: 150,
fieldLabel: 'Tomcat instances:',
labelWidth: 70,
name: 'TomcatInstanceQuantityField',
value: '4'
},
{
xtype: 'displayfield',
id: 'domainTypeField',
width: 249,
fieldLabel: 'Type',
labelWidth: 50,
name: 'DomainTypeField',
value: 'Clustering'
},
{
xtype: 'displayfield',
id: 'datagridServerGroupField',
style: '{text-align:right;font-weight:bold;}',
width: 218,
fieldLabel: 'Data grid server group:',
name: 'DataGridServerGroupField',
value: 'Group 1'
}
],
dockedItems: [
{
xtype: 'panel',
dock: 'right',
items: [
{
xtype: 'button',
itemId: 'mybutton68',
margin: '50 5 0 0',
text: 'Edit'
}
]
}
]
},
{
xtype: 'tabpanel',
flex: 8,
region: 'center',
split: true,
id: 'domainTabs',
itemId: 'domainTabs',
activeTab: 0,
items: [
{
xtype: 'panel',
id: 'domainTomcatTab',
itemId: 'domainTomcatTab',
layout: 'fit',
title: 'Tomcat instances',
tabConfig: {
xtype: 'tab',
id: 'tomcatTabConfig'
},
dockedItems: [
{
xtype: 'toolbar',
dock: 'top',
items: [
{
xtype: 'button',
id: 'btnNewTomcat',
itemId: 'btnNewTomcat',
text: 'New'
},
{
xtype: 'tbseparator'
},
{
xtype: 'textfield',
fieldLabel: 'Filtering'
},
{
xtype: 'tbseparator'
},
{
xtype: 'combobox',
fieldLabel: 'Version'
}
]
}
],
items: [
{
xtype: 'gridpanel',
id: 'associatedTomcatGridView',
title: '',
forceFit: true,
store: 'TomcatInstanceListStore',
columns: [
{
xtype: 'gridcolumn',
dataIndex: 'name',
text: 'Name'
},
{
xtype: 'gridcolumn',
dataIndex: 'ipaddress',
text: 'IP Address'
},
{
xtype: 'gridcolumn',
dataIndex: 'hostName',
text: 'Host Name'
},
{
xtype: 'gridcolumn',
dataIndex: 'statusString',
text: 'Status'
}
],
viewConfig: {
id: 'associatedTomcatListView'
}
}
]
},
{
xtype: 'panel',
layout: 'fit',
title: 'Applications',
items: [
{
xtype: 'gridpanel',
id: 'associatedApplicationListView',
title: '',
forceFit: true,
store: 'ApplicationStore',
columns: [
{
xtype: 'gridcolumn',
dataIndex: 'contextPath',
text: 'Context path'
},
{
xtype: 'gridcolumn',
dataIndex: 'displayName',
text: 'Name'
},
{
xtype: 'gridcolumn',
dataIndex: 'warPath',
text: '*.war path'
},
{
xtype: 'gridcolumn',
dataIndex: 'version',
text: 'Version'
},
{
xtype: 'gridcolumn',
dataIndex: 'state',
text: 'State'
}
],
viewConfig: {
listeners: {
itemclick: {
fn: me.onViewItemClick,
scope: me
}
}
},
dockedItems: [
{
xtype: 'toolbar',
dock: 'top',
items: [
{
xtype: 'button',
id: 'btnApplicationDeploy',
text: 'Deploy'
},
{
xtype: 'button',
disabled: true,
id: 'btnApplicationStart',
text: 'Start'
},
{
xtype: 'button',
disabled: true,
id: 'btnApplicationRestart',
text: 'Restart'
},
{
xtype: 'button',
disabled: true,
id: 'btnApplicationStop',
text: 'Stop'
},
{
xtype: 'button',
disabled: true,
id: 'btnApplicationUndeploy',
text: 'Undeploy'
}
]
}
]
}
]
},
{
xtype: 'panel',
layout: 'fit',
title: 'Sessions',
dockedItems: [
{
xtype: 'gridpanel',
dock: 'top',
id: 'domainSessionGridView',
title: '',
forceFit: true,
store: 'TempoStore',
columns: [
{
xtype: 'gridcolumn',
dataIndex: 'string',
text: 'Key'
},
{
xtype: 'numbercolumn',
dataIndex: 'number',
text: 'Value'
},
{
xtype: 'datecolumn',
dataIndex: 'date',
text: 'Location'
}
],
dockedItems: [
{
xtype: 'toolbar',
dock: 'top',
items: [
{
xtype: 'textfield',
fieldLabel: 'Filtering'
}
]
}
]
},
{
xtype: 'pagingtoolbar',
dock: 'top',
width: 360,
displayInfo: true
}
]
},
{
xtype: 'panel',
id: 'clusteringConfigTab',
itemId: 'clusteringConfigTab',
layout: 'fit',
title: 'Clustering configuration',
tabConfig: {
xtype: 'tab',
id: 'clusteringConfigHeader'
},
dockedItems: [
{
xtype: 'toolbar',
dock: 'top',
items: [
{
xtype: 'button',
itemId: 'btnNewClutersingConfiguration',
text: 'New'
},
{
xtype: 'tbseparator'
},
{
xtype: 'textfield',
itemId: 'mytextfield3',
fieldLabel: 'Filtering'
},
{
xtype: 'tbseparator'
},
{
xtype: 'combobox',
fieldLabel: 'Version'
},
{
xtype: 'button',
text: 'Set active'
}
]
},
{
xtype: 'toolbar',
dock: 'bottom',
height: 42,
items: [
{
xtype: 'combobox',
fieldLabel: 'Compare to'
},
{
xtype: 'button',
itemId: 'btnComparingClusteringConfiguration',
text: 'Compare'
}
]
},
{
xtype: 'gridpanel',
dock: 'top',
id: 'clusteringConfigurationGridView',
title: '',
forceFit: true,
store: 'ClusteringConfigurationStore',
columns: [
{
xtype: 'gridcolumn',
dataIndex: 'name',
text: 'Name'
},
{
xtype: 'gridcolumn',
dataIndex: 'value',
text: 'Value'
}
],
listeners: {
itemcontextmenu: {
fn: me.onClusteringConfigurationGridViewItemContextMenu,
scope: me
}
},
plugins: [
Ext.create('Ext.grid.plugin.RowEditing', {
})
]
}
]
}
]
}
]
});
me.callParent(arguments);
},
onViewItemClick: function(dataview, record, item, index, e, eOpts) {
var status = record.get("state");
if(status === 1) { //started
Ext.getCmp("btnApplicationStart").disable();
Ext.getCmp("btnApplicationStop").enable();
Ext.getCmp("btnApplicationRestart").enable();
Ext.getCmp("btnApplicationUndeploy").disable();
} else if(status === 2) { //stopped
Ext.getCmp("btnApplicationStart").enable();
Ext.getCmp("btnApplicationStop").disable();
Ext.getCmp("btnApplicationRestart").disable();
Ext.getCmp("btnApplicationUndeploy").enable();
}
},
onClusteringConfigurationGridViewItemContextMenu: function(dataview, record, item, index, e, eOpts) {
var mnuContext = Ext.create("Ext.menu.Menu",{
items: [{
id: 'edit-clustering-config',
text: 'Edit'
},
{
id: 'delete-clustering-config',
text: 'Delete'
}
],
listeners: {
click: function( _menu, _item, _e, _eOpts ) {
switch (_item.id) {
case 'edit-clustering-config':
webapp.app.getController("CluteringConfigurationController").showClusteringConfigurationWindow("edit", record.get("id"), GlobalData.lastSelectedMenuId);
break;
case 'delete-clustering-config':
webapp.app.getController("CluteringConfigurationController").deleteConfig(record.get("id"));
break;
default:
break;
}
},
hide:function(menu){
menu.destroy();
}
},
defaults: {
clickHideDelay: 1
}
});
mnuContext.showAt(e.getXY());
e.stopEvent();
}
}); | nices96/athena-meerkat | console/app/view/DomainContainer.js | JavaScript | gpl-2.0 | 21,777 |
/**
* @author Jensen Technologies S.L. <[email protected]>
* @copyright Copyright (C) 2014 Jensen Technologies S.L. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
/**
* Highlight box
* @param selector jQuery Selector
*
* @return void
*/
function highlightBox(selector) {
jQuery(selector).addClass('highlighted-box');
setTimeout(function () {
jQuery(selector).removeClass('highlighted-box');
}, 500);
}
/**
* Fixes issues with a language such as "language out of date" or "missing content"
*/
function fixIssue() {
var button = jQuery(this);
button.closest('.alert').remove();
jQuery.ajax({
url : 'index.php?option=com_neno&task=fixLanguageIssue',
data: {
language: button.data('language'),
issue : button.data('issue')
},
type: 'POST'
});
}
/**
* Load missing translations method
*
* @param listSelector List jQuery selector.
* @param placement Where is the dropdown placed.
*
* @return void
*/
function loadMissingTranslationMethodSelectors(listSelector, placement) {
apply = false;
if (typeof listSelector != 'string') {
var parent = jQuery('.translation-method-selector-container').parent();
if (typeof parent.prop('id') == 'undefined' || parent.prop('id') == '') {
listSelector = '.method-selectors';
}
else {
listSelector = '#' + parent.prop('id');
}
}
if (typeof placement != 'string') {
placement = 'language';
}
if (typeof jQuery(this).prop("tagName") == 'undefined') {
i = 1;
jQuery(listSelector).each(function () {
//Count how many we currently are showing
var n = jQuery(this).find('.translation-method-selector-container').length;
//If we are loading because of changing a selector, remove all children
var selector_id = jQuery(this).find('.translation-method-selector').attr('data-selector-id');
if (typeof selector_id !== 'undefined') {
//Loop through each selector and remove the ones that are after this one
for (var i = 0; i < n; i++) {
if (i > selector_id) {
jQuery(this).find("[data-selector-container-id='" + i + "']").remove();
}
}
}
//Create a string to pass the current selections
var selected_methods_string = '';
jQuery(this).find('.translation-method-selector').each(function () {
selected_methods_string += '&selected_methods[]=' + jQuery(this).find(':selected').val();
});
var lang = jQuery(this).closest(listSelector).data('language');
var otherParams = '';
if (typeof lang != 'undefined') {
otherParams = '&language=' + lang;
}
executeAjaxForTranslationMethodSelectors(listSelector, placement, n, selected_methods_string, jQuery(this).find('.translation-method-selector'), otherParams, false);
});
}
else {
//If we are loading because of changing a selector, remove all children
var selector_id = jQuery(this).data('selector-id');
var n = jQuery(this).closest(listSelector).find('.translation-method-selector-container').length;
if (typeof selector_id !== 'undefined') {
//Loop through each selector and remove the ones that are after this one
for (var i = 0; i < n; i++) {
if (i > selector_id) {
jQuery(this).closest(listSelector).find("[data-selector-container-id='" + i + "']").remove();
n--;
}
}
}
var selected_methods_string = '&selected_methods[]=' + jQuery(this).find(':selected').val();
var lang = jQuery(this).closest(listSelector).data('language');
var otherParams = '';
var element = jQuery(this);
if (typeof lang != 'undefined') {
otherParams = '&language=' + lang;
}
var modal = jQuery('#translationMethodModal');
// There isn't a modal, so we are on the installation process setting up the translation method for the source language
if (modal.length == 0) {
executeAjaxForTranslationMethodSelectors(listSelector, 'general', n, selected_methods_string, element, otherParams);
}
else {
var run = modal.length == 0;
modal.modal('show');
modal.find('.yes-btn').off('click').on('click', function () {
saveTranslationMethod(element.find(':selected').val(), lang, selector_id + 1, true);
run = true;
modal.modal('hide');
apply = true;
});
modal.off('hide').on('hide', function () {
if (!run) {
saveTranslationMethod(element.find(':selected').val(), lang, selector_id + 1, false);
}
executeAjaxForTranslationMethodSelectors(listSelector, placement, n, selected_methods_string, element, otherParams);
});
}
}
}
/**
* Load translation method selector via AJAX
*
* @param listSelector jQuery selector for dropdown
* @param placement Where the dropdown is placed
* @param n
* @param selected_methods_string
* @param element
* @param otherParams
*/
function executeAjaxForTranslationMethodSelectors(listSelector, placement, n, selected_methods_string, element, otherParams) {
if (typeof otherParams == 'undefined') {
otherParams = '';
}
jQuery.ajax({
url : 'index.php?option=com_neno&task=getTranslationMethodSelector&placement=' + placement + '&n=' + n + selected_methods_string + otherParams,
success: function (html) {
if (html !== '') {
jQuery(element).closest(listSelector).append(html);
if (placement == 'language') {
jQuery(element).closest(listSelector).find('.translation-method-selector').each(function () {
saveTranslationMethod(jQuery(this).find(':selected').val(), jQuery(this).closest(listSelector).data('language'), jQuery(this).data('selector-id') + 1, apply);
});
}
}
jQuery('select').chosen();
jQuery('.translation-method-selector').off('change').on('change', loadMissingTranslationMethodSelectors);
var container = element.parents('.language-configuration');
var select1 = element.parents(listSelector).find("[data-selector-container-id='1']");
if (select1.length) {
if (!container.hasClass('expanded')) {
container.css('min-height',
parseInt(container.css('min-height')) + 60
);
container.addClass('expanded');
}
} else if (container.hasClass('expanded')) {
container.css('min-height',
parseInt(container.css('min-height')) - 60
);
container.removeClass('expanded');
}
}
});
}
/**
* Save translation method
*
* @param translationMethod Translation method to save
* @param language Language to apply the translation method
* @param ordering Ordering of this translation method
* @param applyToElements If this translation method should be applied to groups for a particular language
*/
function saveTranslationMethod(translationMethod, language, ordering, applyToElements) {
if (typeof applyToElements == 'undefined') {
applyToElements = false;
}
applyToElements = applyToElements ? 1 : 0;
jQuery.ajax({
url : 'index.php?option=com_neno&task=saveTranslationMethod',
type: 'POST',
data: {
translationMethod: translationMethod,
language : language,
ordering : ordering,
applyToElements : applyToElements
}
});
}
/**
* Set wrapper height for sidebar elements.
*/
function setResultsWrapperHeight() {
var available = jQuery(window).outerHeight() - jQuery('header').outerHeight() - jQuery('.subhead-collapse').outerHeight() - jQuery('#status').outerHeight();
var sidebar = jQuery('#j-sidebar-container');
sidebar.height(available);
var results = jQuery('#results-wrapper');
var resultsBottom = results.position().top + results.outerHeight();
var gap = sidebar.outerHeight() - resultsBottom;
var elements = jQuery('#elements-wrapper');
elements.height(elements.outerHeight() + gap - 70);
}
/**
* Set previous state for a table
*
* @param event
*/
function setOldTableStatus(event) {
if (!statusChanged) {
var modal = jQuery('#nenomodal-table-filters');
var oldStatus = parseInt(modal.data('current-status'));
var tableId = modal.data('table-id');
markLabelAsActiveByStatus(tableId, oldStatus, false);
if (event.type != 'hide') {
modal.modal('hide');
}
}
}
/**
*
* @param event
*/
function saveFilter(event) {
event.preventDefault();
var filter = jQuery(this).data('filter');
var parent = jQuery(this).closest('.btn-group');
var fieldId = parent.data('field');
parent.find('.filter.hide').removeClass('hide');
parent.find(".filter[data-filter='" + filter + "']").addClass('hide');
parent.find('.dropdown-toggle').text(filter);
jQuery.ajax({
url : 'index.php?option=com_neno&task=groupselements.changeFieldFilter',
type: 'POST',
data: {
fieldId: fieldId,
filter : filter
}
});
}
/**
*
*/
function changeTableTranslateState() {
var id = jQuery(this).parent('fieldset').attr('data-field');
var status = parseInt(jQuery(this).val());
markLabelAsActiveByStatus(id, status, status == 2);
setTranslateStatus(id, status);
jQuery.ajax({
url : 'index.php?option=com_neno&task=groupselements.toggleContentElementTable&tableId=' + id + '&translateStatus=' + status,
success: function () {
if (typeof tableFiltersCallback != 'undefined') {
tableFiltersCallback(id);
}
}
}
);
}
/**
*
* @param tableId
* @param status
*/
function setTranslateStatus(tableId, status) {
//Show an alert that count no longer is accurate only on Groups&Elements view
if (getViewName() != 'installation') {
jQuery('#reload-notice').remove();
jQuery('.navbar-fixed-top .navbar-inner').append('<div style="padding:10px 30px;" id="reload-notice"><div class="alert alert-warning">' +
warning_message +
'<a href="index.php?option=com_neno&view=groupselements" class="btn btn-info pull-right" style="height: 16px; font-size: 12px;margin-top:-4px">' +
warning_button +
'</a></div></div>'
).height('92');
jQuery('body').css('padding-top', '93px');
}
jQuery.ajax({
url: 'index.php?option=com_neno&task=groupselements.toggleContentElementTable&tableId=' + tableId + '&translateStatus=' + status
}
);
}
/**
* Get view name
*
* @returns {boolean|string}
*/
function getViewName() {
var sPageURL = decodeURIComponent(window.location.search.substring(1)),
sURLVariables = sPageURL.split('&'),
sParameterName,
i;
for (i = 0; i < sURLVariables.length; i++) {
sParameterName = sURLVariables[i].split('=');
if (sParameterName[0] === 'view') {
return sParameterName[1] === undefined ? false : sParameterName[1];
}
}
}
/**
*
* @param id Table Id
* @param status Table status
* @param showFiltersModal Whether or not the filter modal need to be shown
*
* @return void
*/
function markLabelAsActiveByStatus(id, status, showFiltersModal) {
var row = jQuery('.row-table[data-id="table-' + id + '"]');
var toggler = row.find('.toggle-fields');
var translateButton = jQuery('[for="check-toggle-translate-table-' + id + '-1"]');
var translateSomeButton = jQuery('[for="check-toggle-translate-table-' + id + '-2"]');
var doNotTranslateButton = jQuery('[for="check-toggle-translate-table-' + id + '-0"]');
switch (status) {
case 1:
row.find('.bar').removeClass('bar-disabled');
translateButton.addClass('active btn-success');
doNotTranslateButton.removeClass('active btn-danger');
translateSomeButton.removeClass('active btn-warning');
bindToggleFieldVisibilityEvent(toggler);
break;
case 2:
row.find('.bar').removeClass('bar-disabled');
var currentStatus = jQuery(".active[for|='check-toggle-translate-table-" + id + "']").attr('for').replace('check-toggle-translate-table-' + id + '-', '');
translateButton.removeClass('active btn-success');
doNotTranslateButton.removeClass('active btn-danger');
translateSomeButton.addClass('active btn-warning');
bindToggleFieldVisibilityEvent(toggler);
if (showFiltersModal) {
showTableFiltersModal(id, currentStatus);
}
break;
case 0:
row.find('.bar').addClass('bar-disabled');
doNotTranslateButton.addClass('active btn-danger');
translateButton.removeClass('active btn-success');
translateSomeButton.removeClass('active btn-warning');
//Remove fields
if (toggler.hasClass('toggler-expanded')) {
toggler.click();
}
toggler.off('click');
toggler.removeClass('toggler toggler-collapsed');
toggler.find('span').removeClass();
break;
}
jQuery('#check-toggle-translate-table-' + id + '-' + status).click();
}
function bindToggleFieldVisibilityEvent(toggler) {
if (getViewName() == 'groupselements') {
//Add field toggler
toggler.off('click').on('click', toggleFieldVisibility);
toggler.addClass('toggler toggler-collapsed');
toggler.find('span').addClass('icon-arrow-right-3');
}
}
/**
*
* @param id
* @param currentStatus
*/
function showTableFiltersModal(id, currentStatus) {
//Load group form html
jQuery.ajax({
url : 'index.php?option=com_neno&task=groupselements.getTableFilterModalLayout&tableId=' + id,
success: function (html) {
statusChanged = false;
//Inject HTML into the modal
var modal = jQuery('#nenomodal-table-filters');
modal.data('current-status', currentStatus);
modal.data('table-id', id);
modal.find('.modal-body').html(html);
modal.modal('show');
// Bind events
bindEvents();
//Handle saving and submitting the form
jQuery('#save-filters-btn').off('click').on('click', saveTableFilters);
}
}
);
}
/**
*
*/
function saveTableFilters() {
var filters = [];
jQuery('tr.filter-row').each(function () {
// Only include if the filter contains any value
if (jQuery(this).find('.filter-value').val()) {
var filter = {
field : jQuery(this).find('.filter-field option:selected').val(),
operator: jQuery(this).find('.filter-operator option:selected').val(),
value : jQuery(this).find('.filter-value').val()
};
filters.push(filter);
}
});
if (filters.length != 0) {
jQuery.post(
'index.php?option=com_neno&task=groupselements.saveTableFilters',
{
filters: filters,
tableId: jQuery('#nenomodal-table-filters').data('table-id')
},
function (data) {
if (data = 'ok') {
var modal = jQuery('#nenomodal-table-filters');
setTranslateStatus(modal.data('table-id'), 2);
if (typeof tableFiltersCallback != 'undefined') {
tableFiltersCallback(modal.data('table-id'));
}
statusChanged = true;
modal.modal('hide');
}
}
);
}
}
function printMessages(messages) {
var scroll = 1;
var container = jQuery("#task-messages");
for (var i = 0; i < messages.length; i++) {
var percent = 0;
var log_line = jQuery('#installation-status-' + messages[i].level).clone().removeAttr('id').html(messages[i].message);
if (messages[i].level == 1) {
log_line.addClass('alert-' + messages[i].type);
}
container.append(log_line);
//Scroll to bottom
container.stop().animate({
scrollTop: container[0].scrollHeight - container.height()
}, 100);
if (messages[i].percent != 0) {
percent = messages[i].percent;
}
}
if (percent != 0) {
jQuery('#progress-bar').find('.bar').width(percent + '%');
}
}
function sendDiscoveringContentStep() {
jQuery.ajax({
url : 'index.php?option=com_neno&task=installation.processDiscoveringStep&contentType=content&r=' + Math.random(),
success: function (data) {
if (data != 'ok') {
sendDiscoveringContentStep();
} else {
checkStatus();
jQuery.installation = true;
processInstallationStep();
window.clearInterval(interval);
}
},
error : function () {
sendDiscoveringContentStep();
}
});
}
function sendDiscoveringStructureStep() {
jQuery.ajax({
url : 'index.php?option=com_neno&task=installation.processDiscoveringStep&contentType=structure&r=' + Math.random(),
success: function (data) {
if (data != 'ok') {
sendDiscoveringStructureStep();
} else {
checkStatus();
jQuery.installation = true;
processInstallationStep();
window.clearInterval(interval);
}
},
error : function () {
sendDiscoveringStructureStep();
}
});
}
function checkStatus() {
jQuery.ajax({
url : 'index.php?option=com_neno&task=installation.getSetupStatus&r=' + Math.random(),
dataType: 'json',
success : printMessages
});
}
function bindTranslateSomeButtonEvents() {
//Attach the translate state toggler
jQuery('.check-toggle-translate-table-radio').off('change').on('change', changeTableTranslateState);
jQuery('.filter').off('click').on('click', saveFilter);
jQuery('#filters-close-button').off('click').on('click', setOldTableStatus);
jQuery('#nenomodal-table-filters').off('hide').on('hide', setOldTableStatus);
jQuery('.add-row-button').off('click').on('click', duplicateFilterRow);
jQuery('.remove-row-button').off('click').on('click', removeFilterRow);
jQuery('.active.btn-warning').off('click').on('click', function () {
var forAttribute = jQuery(this).attr('for');
var regex = new RegExp('check-toggle-translate-table-([0-9]+)\-[0-2]', 'g');
var result = regex.exec(forAttribute);
showTableFiltersModal(result[1], 2);
});
jQuery('[data-toogle="tooltip"]').tooltip('destroy').tooltip();
}
function duplicateFilterRow() {
jQuery(this).closest('tr').clone().appendTo('#filters-table');
bindEvents();
}
function removeFilterRow() {
if (jQuery('tr.filter-row').length > 1) {
jQuery(this).closest('tr').remove();
}
}
function previewContent() {
var button = jQuery(this);
jQuery.post(
'index.php?option=com_neno&task=installation.previewContentFromTable&r=' + Math.random(),
{
tableId: button.data('table-id')
},
function (html) {
var modal = jQuery('#preview-modal');
modal.find('.modal-body').empty().append(html);
jQuery('.preview-btn').off('click').on('click', previewContent);
modal.modal('show');
}
)
} | andresmaeso/neno | media/neno/js/common.js | JavaScript | gpl-2.0 | 18,210 |
var React = require("react");
var ReactRouter = require("react-router");
var History = ReactRouter.History;
var auth = require("./auth.js");
// Top-level component for the app
var New = React.createClass({
// mixin for navigation
mixins: [ History ],
// initial state
getInitialState: function() {
return {
// the user is logged in
loggedIn: auth.loggedIn()
};
},
// callback when user is logged in
setStateOnAuth: function(loggedIn) {
this.setState({loggedIn:loggedIn});
},
// when the component loads, setup the callback
componentWillMount: function() {
auth.onChange = this.setStateOnAuth;
},
// logout the user and redirect to home page
logout: function(event) {
auth.logout();
this.history.pushState(null, '/');
},
// show the navigation bar
// the route handler replaces the RouteHandler element with the current page
render: function() {
return (
<div>
<nav className="navbar navbar-default" role="navigation">
<div className="container">
<div className="navbar-header">
<button type="button" className="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span className="sr-only">Toggle navigation</span>
<span className="icon-bar"></span>
<span className="icon-bar"></span>
<span className="icon-bar"></span>
</button>
<a className="navbar-brand" href="/">BYU Ride-Board</a>
</div>
<div className="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<div className="nav navbar-nav navbar-right">
{this.state.loggedIn ? (
<ul className="nav navbar-nav">
<li className="nav-element"><a href="#/dashboard">Dashboard</a></li>
<li className="nav-element"><a href="#/create">Create</a></li>
<li className="nav-element"><a href="#/search">Search</a></li>
<li className="nav-element"><a href="#" onClick={this.logout}>Logout</a></li>
</ul>
) : (<div></div>)}
</div>
</div>
</div>
</nav>
<div className="container">
{this.props.children}
</div>
</div>
);
}
});
module.exports = New; | gap91/byu-ride-board | app/components/ride_board.js | JavaScript | gpl-2.0 | 2,326 |
/**
* This module implements EventLogging's API for logging events from
* client-side JavaScript code. Instances of `ResourceLoaderSchemaModule`
* indicate a dependency on this module and declare themselves via its
* 'declareSchema' method.
*
* Developers should not load this module directly, but work with schema
* modules instead. Schema modules will load this module as a
* dependency.
*
* @module ext.eventLogging.core.js
* @author Ori Livneh <[email protected]>
*/
( function ( mw, $, console ) {
'use strict';
/**
* Represents a failure to validate an object against its schema.
*
* @class ValidationError
* @constructor
* @extends Error
* @private
**/
function ValidationError( message ) {
this.message = message;
}
ValidationError.prototype = new Error();
/**
* Client-side EventLogging API.
*
* The public API consists of a single function, `mw.eventLog.logEvent`.
* Other methods represent internal functionality, which is exposed only
* to ease debugging code and writing tests.
*
*
* @class eventLog
* @namespace mediaWiki
* @static
*/
var self = mw.eventLog = {
/**
* Schema registry. Schemas that have been declared explicitly via
* `eventLog.declareSchema` or implicitly by being referenced in an
* `eventLog.logEvent` call are stored in this object.
*
* @property schemas
* @type Object
*/
schemas: {},
warn: console && $.isFunction( console.warn ) ?
$.proxy( console.warn, console ) : mw.log,
/**
* Register a schema so that it can be used to validate events.
* `ResourceLoaderSchemaModule` instances generate JavaScript code that
* invokes this method.
*
* @method declareSchema
* @param {String} schemaName Name of schema.
* @param {Object} [meta] An object describing a schema:
* @param {Number} meta.revision Revision ID.
* @param {Object} meta.schema The schema itself.
* @return {Object} The registered schema.
*/
declareSchema: function ( schemaName, meta ) {
if ( self.schemas.hasOwnProperty( schemaName ) ) {
self.warn( 'Clobbering existing "' + schemaName + '" schema' );
}
self.schemas[ schemaName ] = $.extend( true, {
revision : -1,
schema : { properties: {} },
defaults : {}
}, self.schemas[ schemaName ], meta );
return self.schemas[ schemaName ];
},
/**
* Checks whether a JavaScript value conforms to a specified JSON
* Schema type. Supports string, timestamp, boolean, integer and
* number types. Arrays are not currently supported.
*
* @method isInstanceOf
* @param {Object} instance Object to test.
* @param {String} type JSON Schema type.
* @return {Boolean} Whether value is instance of type.
*/
isInstanceOf: function ( value, type ) {
// undefined and null are invalid values for any type.
if ( value === undefined || value === null ) {
return false;
}
switch ( type ) {
case 'string':
return typeof value === 'string';
case 'timestamp':
return value instanceof Date || (
typeof value === 'number' &&
value >= 0 &&
value % 1 === 0 );
case 'boolean':
return typeof value === 'boolean';
case 'integer':
return typeof value === 'number' && value % 1 === 0;
case 'number':
return typeof value === 'number' && isFinite( value );
default:
return false;
}
},
/**
* Checks whether an event object conforms to a JSON Schema.
*
* @method isValid
* @param {Object} event Event to test for validity.
* @param {String} schemaName Name of schema.
* @return {Boolean} Whether event conforms to the schema.
*/
isValid: function ( event, schemaName ) {
try {
self.assertValid( event, schemaName );
return true;
} catch ( e ) {
if ( !( e instanceof ValidationError ) ) {
throw e;
}
self.warn( e.message );
return false;
}
},
/**
* Asserts that an event validates against a JSON Schema. If the event
* does not validate, throws a `ValidationError`.
*
* @method assertValid
* @param {Object} event Event to validate.
* @param {Object} schemaName Name of schema.
* @throws {ValidationError} If event fails to validate.
*/
assertValid: function ( event, schemaName ) {
var schema = self.schemas[ schemaName ] || null,
props = schema.schema.properties,
prop;
if ( $.isEmpty( props ) ) {
throw new ValidationError( 'Unknown schema: ' + schemaName );
}
for ( prop in event ) {
if ( props[ prop ] === undefined ) {
throw new ValidationError( 'Unrecognized property: ' + prop );
}
}
$.each( props, function ( prop, desc ) {
var val = event[ prop ];
if ( val === undefined ) {
if ( desc.required ) {
throw new ValidationError( 'Missing property: ' + prop );
}
return true;
}
if ( !( self.isInstanceOf( val, desc.type ) ) ) {
throw new ValidationError( 'Wrong type for property: ' + prop + ' ' + val );
}
if ( desc[ 'enum' ] && $.inArray( val, desc[ 'enum' ] ) === -1 ) {
throw new ValidationError( 'Value "' + val + '" not in enum ' + $.toJSON( desc[ 'enum' ] ) );
}
} );
return true;
},
/**
* Sets default values to be applied to all subsequent events belonging
* to a schema. Note that `setDefaults` does not validate, but the
* complete event object (including defaults) is validated prior to
* dispatch.
*
* @method setDefaults
* @param {String} schemaName Canonical schema name.
* @param {Object|null} schemaDefaults Defaults, or null to clear.
* @return {Object} Updated defaults for schema.
*/
setDefaults: function ( schemaName, schemaDefaults ) {
var schema = self.schemas[ schemaName ];
if ( schema === undefined ) {
self.warn( 'Setting defaults on unknown schema "' + schemaName + '"' );
schema = self.declareSchema( schemaName );
}
return $.extend( true, schema.defaults, schemaDefaults );
},
/**
* Takes an event object and puts it inside a generic wrapper
* object that contains generic metadata about the event.
*
* @method encapsulate
* @param {String} schemaName Canonical schema name.
* @param {Object} event Event instance.
* @return {Object} Encapsulated event.
*/
encapsulate: function ( schemaName, event ) {
var schema = self.schemas[ schemaName ];
if ( schema === undefined ) {
self.warn( 'Got event with unknown schema "' + schemaName + '"' );
schema = self.declareSchema( schemaName );
}
event = $.extend( true, {}, event, schema.defaults );
return {
event : event,
clientValidated : self.isValid( event, schemaName ),
revision : schema.revision,
schema : schemaName,
webHost : window.location.hostname,
wiki : mw.config.get( 'wgDBname' )
};
},
/**
* Encodes a JavaScript object as percent-encoded JSON and
* pushes it to the server using a GET request.
*
* @method dispatch
* @param {Object} data Payload to send.
* @return {jQuery.Deferred} Promise object.
*/
dispatch: function ( data ) {
var beacon = document.createElement( 'img' ),
baseUri = mw.config.get( 'wgEventLoggingBaseUri' ),
dfd = $.Deferred();
if ( !baseUri ) {
dfd.rejectWith( data, [ data ] );
return dfd.promise();
}
// Browsers trigger `onerror` event on HTTP 204 replies to image
// requests. Thus, confusingly, `onerror` indicates success.
$( beacon ).on( 'error', function () {
dfd.resolveWith( data, [ data ] );
} );
beacon.src = baseUri + '?' + encodeURIComponent( $.toJSON( data ) ) + ';';
return dfd.promise();
},
/**
* Construct and transmit to a remote server a record of some event
* having occurred. Events are represented as JavaScript objects that
* conform to a JSON Schema. The schema describes the properties the
* event object may (or must) contain and their type. This method
* represents the public client-side API of EventLogging.
*
* @method logEvent
* @param {String} schemaName Canonical schema name.
* @param {Object} eventInstance Event instance.
* @return {jQuery.Deferred} Promise object.
*/
logEvent: function ( schemaName, eventInstance ) {
return self.dispatch( self.encapsulate( schemaName, eventInstance ) );
}
};
// For backward-compatibility; may be removed after 28-Feb-2012 deployment.
self.setSchema = self.declareSchema;
if ( !mw.config.get( 'wgEventLoggingBaseUri' ) ) {
self.warn( '"$wgEventLoggingBaseUri" is not set.' );
}
} ( mediaWiki, jQuery, window.console ) );
| legoktm/wikihow-src | extensions/EventLogging/modules/ext.eventLogging.core.js | JavaScript | gpl-2.0 | 8,642 |
USETEXTLINKS = 1
STARTALLOPEN = 0
WRAPTEXT = 1
PRESERVESTATE = 0
HIGHLIGHT = 1
ICONPATH = 'file:////Users/eric/github/popgenDB/sims_for_structure_paper/2PopDNAnorec_0.5_1000/' //change if the gif's folder is a subfolder, for example: 'images/'
foldersTree = gFld("<i>ARLEQUIN RESULTS (2PopDNAnorec_1_953.arp)</i>", "")
insDoc(foldersTree, gLnk("R", "Arlequin log file", "Arlequin_log.txt"))
aux1 = insFld(foldersTree, gFld("Run of 31/07/18 at 17:02:50", "2PopDNAnorec_1_953.xml#31_07_18at17_02_50"))
insDoc(aux1, gLnk("R", "Settings", "2PopDNAnorec_1_953.xml#31_07_18at17_02_50_run_information"))
aux2 = insFld(aux1, gFld("Genetic structure (samp=pop)", "2PopDNAnorec_1_953.xml#31_07_18at17_02_50_pop_gen_struct"))
insDoc(aux2, gLnk("R", "AMOVA", "2PopDNAnorec_1_953.xml#31_07_18at17_02_50_pop_amova"))
insDoc(aux2, gLnk("R", "Pairwise distances", "2PopDNAnorec_1_953.xml#31_07_18at17_02_50_pop_pairw_diff"))
| DIPnet/popgenDB | sims_for_structure_paper/2PopDNAnorec_0.5_1000/2PopDNAnorec_1_953.res/2PopDNAnorec_1_953.js | JavaScript | gpl-2.0 | 922 |
angular.module('sampleApp', ['ngRoute', 'appRoutes', 'MainCtrl', 'playersCtrl', 'playersService', 'coachesCtrl', 'coachesService']); | houyaowei/MEANFramework | public/js/app.js | JavaScript | gpl-2.0 | 132 |
var namespacebb_1_1_e_m2015 =
[
[ "EMaudiorecorder", "classbb_1_1_e_m2015_1_1_e_maudiorecorder.html", "classbb_1_1_e_m2015_1_1_e_maudiorecorder" ],
[ "HDMI", "classbb_1_1_e_m2015_1_1_h_d_m_i.html", "classbb_1_1_e_m2015_1_1_h_d_m_i" ]
]; | Schwane/EM2015_PraesiBert | Doc/Doxygen/html/namespacebb_1_1_e_m2015.js | JavaScript | gpl-2.0 | 244 |
// Script to Upload Image
jQuery.noConflict();
jQuery(document).ready(function(jQuery){
jQuery('#audio-settings').hide();
jQuery('#link-settings').hide();
jQuery('#video-settings').hide();
jQuery('#post-formats-select > .post-format').each(function(i){
if(jQuery(this).is(':checked')) {
var val = jQuery(this).val();
jQuery('#'+val+'-settings').show();
}
});
jQuery('#post-formats-select > .post-format').click(function(){
var val = jQuery(this).val();
jQuery('#audio-settings').hide();
jQuery('#link-settings').hide();
jQuery('#video-settings').hide();
jQuery('#'+val+'-settings').show();
});
}); | initLab/initlanesis | include/cpt/js/admin_script.js | JavaScript | gpl-2.0 | 672 |
/*!
* ZUI: 数组辅助方法 - v1.5.0 - 2016-10-08
* http://zui.sexy
* GitHub: https://github.com/easysoft/zui.git
* Copyright (c) 2016 cnezsoft.com; Licensed MIT
*/
/* ========================================================================
* ZUI: array.js
* Array Polyfill.
* http://zui.sexy
* ========================================================================
* Copyright (c) 2014-2016 cnezsoft.com; Licensed MIT
* ======================================================================== */
// Some polyfills copy from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array
(function() {
'use strict';
var STR_FUNCTION = 'function';
/**
* Calls a function for each element in the array.
*/
if(!Array.prototype.forEach) {
Array.prototype.forEach = function(fun /*, thisp*/ ) {
var len = this.length;
if(typeof fun != STR_FUNCTION)
throw new TypeError();
var thisp = arguments[1];
for(var i = 0; i < len; i++) {
if(i in this) {
fun.call(thisp, this[i], i, this);
}
}
};
}
/**
* Judge an object is an real array
*/
if(!Array.isArray) {
Array.isArray = function(obj) {
return Object.toString.call(obj) === '[object Array]';
};
}
/**
* Returns the last (greatest) index of an element within the array equal to the specified value, or -1 if none is found.
*/
if(!Array.prototype.lastIndexOf) {
Array.prototype.lastIndexOf = function(elt /*, from*/ ) {
var len = this.length;
var from = Number(arguments[1]);
if(isNaN(from)) {
from = len - 1;
} else {
from = (from < 0) ? Math.ceil(from) : Math.floor(from);
if(from < 0)
from += len;
else if(from >= len)
from = len - 1;
}
for(; from > -1; from--) {
if(from in this &&
this[from] === elt)
return from;
}
return -1;
};
}
/**
* Returns true if every element in this array satisfies the provided testing function.
*/
if(!Array.prototype.every) {
Array.prototype.every = function(fun /*, thisp*/ ) {
var len = this.length;
if(typeof fun != STR_FUNCTION)
throw new TypeError();
var thisp = arguments[1];
for(var i = 0; i < len; i++) {
if(i in this &&
!fun.call(thisp, this[i], i, this))
return false;
}
return true;
};
}
/**
* Creates a new array with all of the elements of this array for which the provided filtering function returns true.
*/
if(!Array.prototype.filter) {
Array.prototype.filter = function(fun /*, thisp*/ ) {
var len = this.length;
if(typeof fun != STR_FUNCTION)
throw new TypeError();
var res = [];
var thisp = arguments[1];
for(var i = 0; i < len; i++) {
if(i in this) {
var val = this[i]; // in case fun mutates this
if(fun.call(thisp, val, i, this))
res.push(val);
}
}
return res;
};
}
/**
* Returns the first (least) index of an element within the array equal to the specified value, or -1 if none is found.
*/
if(!Array.prototype.indexOf) {
Array.prototype.indexOf = function(elt /*, from*/ ) {
var len = this.length;
var from = Number(arguments[1]) || 0;
from = (from < 0) ? Math.ceil(from) : Math.floor(from);
if(from < 0)
from += len;
for(; from < len; from++) {
if(from in this &&
this[from] === elt)
return from;
}
return -1;
};
}
/**
* Creates a new array with the results of calling a provided function on every element in this array.
*/
if(!Array.prototype.map) {
Array.prototype.map = function(fun /*, thisp*/ ) {
var len = this.length;
if(typeof fun != STR_FUNCTION)
throw new TypeError();
var res = new Array(len);
var thisp = arguments[1];
for(var i = 0; i < len; i++) {
if(i in this)
res[i] = fun.call(thisp, this[i], i, this);
}
return res;
};
}
/**
* Creates a new array with the results match the condistions
* @param {plain object or function} conditions
* @param {array} result
* @return {array}
*/
if(!Array.prototype.mawherep) {
Array.prototype.where = function(conditions, result) {
result = result || [];
var cdt, ok, objVal;
this.forEach(function(val) {
ok = true;
for(var key in conditions) {
cdt = conditions[key];
if(typeof cdt === STR_FUNCTION) {
ok = cdt(val);
} else {
objVal = val[key];
ok = (objVal && objVal === cdt);
}
if(!ok) break;
}
if(ok) result.push(val);
});
return result;
};
}
/**
* Return a object contains grouped result as object key
* @param {string} key
* @return {Object}
*/
if(!Array.prototype.groupBy) {
Array.prototype.groupBy = function(key) {
var result = {};
this.forEach(function(val) {
var keyName = val[key];
if(!keyName) {
keyName = 'unkown';
}
if(!result[keyName]) {
result[keyName] = [];
}
result[keyName].push(val);
});
return result;
};
}
/**
* Returns true if at least one element in this array satisfies the provided testing conditions.
* @param {function or plain object} conditions
* @return {Boolean}
*/
if(!Array.prototype.has) {
Array.prototype.has = function(conditions) {
var result = false,
cdt, ok, objVal;
this.forEach(function(val) {
ok = true;
for(var key in conditions) {
cdt = conditions[key];
if(typeof cdt === STR_FUNCTION) {
ok = cdt(val);
} else {
objVal = val[key];
ok = (objVal && objVal === cdt);
}
if(!ok) break;
}
if(ok) {
result = true;
return false;
}
});
return result;
};
}
}());
| yuanxu/django-scaffold | scaffold_toolkit/zui/static/zui/lib/array/zui.array.js | JavaScript | gpl-2.0 | 7,309 |
const ArgParser = require("../../Modules/MessageUtils/Parser");
const ModLog = require("../../Modules/ModLog");
module.exports = async ({ Constants: { Text, Colors }, client }, { serverDocument, serverQueryDocument }, msg, commandData) => {
if (msg.suffix) {
let [member, ...reason] = ArgParser.parseQuoteArgs(msg.suffix, msg.suffix.includes("|") ? "|" : " ");
member = await client.memberSearch(member.trim(), msg.guild).catch(() => null);
reason = reason.join(" ").trim();
if (!member) {
return msg.send({
embed: {
color: Colors.SOFT_ERR,
description: `I couldn't find a matching member in this guild... 🧐`,
},
});
}
if (member.user.bot || [msg.author.id, client.user.id].includes(member.id) || client.getUserBotAdmin(msg.guild, serverDocument, member) > 0) {
return msg.send({
embed: {
color: Colors.MISSING_PERMS,
description: `Sorry, you can't strike **@${client.getName(serverDocument, member)}** ✋`,
footer: {
text: msg.author.id === member.user.id ? "You cannot strike yourself!" : "Bots and Bot Admins cannot be striked!",
},
},
});
}
let targetMemberQueryDocument = serverQueryDocument.clone.id("members", member.id);
if (!targetMemberQueryDocument.val) {
serverQueryDocument.push("members", { _id: member.id });
targetMemberQueryDocument = serverQueryDocument.clone.id("members", member.id);
}
let ModLogID = await ModLog.create(msg.guild, "Strike", member, msg.member, reason);
if (ModLogID && isNaN(ModLogID) && !["INVALID_MODLOG_CHANNEL", "MISSING_MODLOG_CHANNEL"].includes(ModLogID.code)) throw ModLogID;
else if (isNaN(ModLogID)) ModLogID = null;
targetMemberQueryDocument.push("strikes", {
admin: msg.author.id,
reason: reason || "No reason specified",
modlog_entry: ModLogID,
});
const strikeLength = targetMemberQueryDocument.val.strikes.length;
const lastDigit = strikeLength % 10;
const lastTwoDigits = strikeLength % 100;
const suffix = lastTwoDigits > 10 && lastTwoDigits < 20 ? "th" :
lastDigit === 1 ? "st" :
lastDigit === 2 ? "nd" :
lastDigit === 3 ? "rd" : "th";
const strikeAmount = `${strikeLength}${suffix}`;
let success = true;
try {
const DMChannel = await member.user.createDM();
await DMChannel.send({
embed: {
description: `Tsching! You just received your ${strikeAmount} strike! ⚡`,
fields: [
{
name: "Reason",
value: `${reason || "No reason specified..."}`,
inline: true,
},
{
name: "Moderator",
value: `@${msg.author.tag}`,
inline: true,
},
],
color: Colors.LIGHT_ORANGE,
},
});
} catch (err) {
success = false;
}
msg.send({
embed: {
color: Colors.SUCCESS,
description: `Feel the thunder! **@${client.getName(serverDocument, member)}** has received their ${strikeAmount} strike! 🚦`,
footer: {
text: success ? "I also warned them via DM ⚠" : "I tried to warn them via DM, but something went wrong!",
},
},
});
} else {
msg.sendInvalidUsage(commandData, "Who do you want me to strike? 😮");
}
};
| GilbertGobbels/GAwesomeBot | Commands/Public/strike.js | JavaScript | gpl-2.0 | 3,135 |
var group__gen_a_p_i =
[
[ "NC_MSG_TYPE", "d3/d35/group__gen_a_p_i.html#ga298c7a4ad5cc76169a211f86df90f057", [
[ "NC_MSG_UNKNOWN", "d3/d35/group__gen_a_p_i.html#gga298c7a4ad5cc76169a211f86df90f057a43e894ea69b22c6080016fe210da4305", null ],
[ "NC_MSG_WOULDBLOCK", "d3/d35/group__gen_a_p_i.html#gga298c7a4ad5cc76169a211f86df90f057a5b0ce1ca54b15ef3ca1ef901263c1b72", null ],
[ "NC_MSG_NONE", "d3/d35/group__gen_a_p_i.html#gga298c7a4ad5cc76169a211f86df90f057a1272e268199e52e368957b6a3b288d50", null ],
[ "NC_MSG_HELLO", "d3/d35/group__gen_a_p_i.html#gga298c7a4ad5cc76169a211f86df90f057a7cd0f4a4edef33489e675b080645288d", null ],
[ "NC_MSG_RPC", "d3/d35/group__gen_a_p_i.html#gga298c7a4ad5cc76169a211f86df90f057a7f6951d98d30342a65e6b1d7ccca2df0", null ],
[ "NC_MSG_REPLY", "d3/d35/group__gen_a_p_i.html#gga298c7a4ad5cc76169a211f86df90f057a827b3c9c898a48ec8e9f8f9af11f1bdd", null ],
[ "NC_MSG_NOTIFICATION", "d3/d35/group__gen_a_p_i.html#gga298c7a4ad5cc76169a211f86df90f057ab4e4b148e14bdf9f320331b0cbe1dc6d", null ]
] ],
[ "NC_VERB_LEVEL", "d3/d35/group__gen_a_p_i.html#ga921d994eb69a9efd93ef85cf4a6cd060", [
[ "NC_VERB_ERROR", "d3/d35/group__gen_a_p_i.html#gga921d994eb69a9efd93ef85cf4a6cd060a908c5d51b81e0ab37d2c57e569446d9b", null ],
[ "NC_VERB_WARNING", "d3/d35/group__gen_a_p_i.html#gga921d994eb69a9efd93ef85cf4a6cd060a4a0cbb6bc660d3a50c3dff6028185abf", null ],
[ "NC_VERB_VERBOSE", "d3/d35/group__gen_a_p_i.html#gga921d994eb69a9efd93ef85cf4a6cd060ae023b386220c2337dc9a556f5c669172", null ],
[ "NC_VERB_DEBUG", "d3/d35/group__gen_a_p_i.html#gga921d994eb69a9efd93ef85cf4a6cd060a1ddf66190b3b38c4de213321e3ae6491", null ]
] ],
[ "nc_callback_print", "d3/d35/group__gen_a_p_i.html#ga806dfa9c27d2b8076bae21bcd549cce7", null ],
[ "nc_close", "d3/d35/group__gen_a_p_i.html#gaaf2f5bf5a58103d9e4ea1cbe4291094b", null ],
[ "nc_datetime2time", "d3/d35/group__gen_a_p_i.html#ga4dfd796fda30d3ad8588b4c30c4c1583", null ],
[ "nc_err_dup", "d3/d35/group__gen_a_p_i.html#ga316faef1140f1b48a2ed1de6d84d2bef", null ],
[ "nc_err_free", "d3/d35/group__gen_a_p_i.html#gac4bd51febe24b517d1952d1c1d8f6b07", null ],
[ "nc_err_get", "d3/d35/group__gen_a_p_i.html#ga3d7714f1f56ac7203a80c61aea4344f8", null ],
[ "nc_err_new", "d3/d35/group__gen_a_p_i.html#ga057524ba5256c428b6bf88710f000e0c", null ],
[ "nc_err_set", "d3/d35/group__gen_a_p_i.html#gab28d881eeebd79d485391ae1ffc97299", null ],
[ "nc_init", "d3/d35/group__gen_a_p_i.html#ga40e32bd7c1404a76105b426219021cdc", null ],
[ "nc_msgid_compare", "d3/d35/group__gen_a_p_i.html#gae160a70158f957344eb3204987329632", null ],
[ "nc_time2datetime", "d3/d35/group__gen_a_p_i.html#ga90a44b60b04512fd0a3507ab35a1ccc4", null ],
[ "nc_verb_error", "d3/d35/group__gen_a_p_i.html#gabd4e3697f3a1fe6b5853e692ad20c2bb", null ],
[ "nc_verb_verbose", "d3/d35/group__gen_a_p_i.html#gae4f0d22fb274269c0259497abb702f5d", null ],
[ "nc_verb_warning", "d3/d35/group__gen_a_p_i.html#ga943a7c859f20bb1278964a7424762d8e", null ],
[ "nc_verbosity", "d3/d35/group__gen_a_p_i.html#gadd8fd7b3bb2e7cba580c9a4229fe02d7", null ]
]; | rchuppala/usc_agent | src/usc-agent-dev/common/source/libnetconf/doc/doxygen/html/d3/d35/group__gen_a_p_i.js | JavaScript | gpl-2.0 | 3,167 |
/*
* jQuery mmenu v6.0.2
* @requires jQuery 1.7.0 or later
*
* mmenu.frebsite.nl
*
* Copyright (c) Fred Heusschen
* www.frebsite.nl
*
* License: CC-BY-NC-4.0
* http://creativecommons.org/licenses/by-nc/4.0/
*/
(function( $ ) {
var _PLUGIN_ = 'mmenu',
_VERSION_ = '6.0.2';
// Newer version of the plugin already excists
if ( $[ _PLUGIN_ ] && $[ _PLUGIN_ ].version > _VERSION_ )
{
return;
}
/*
Class
*/
$[ _PLUGIN_ ] = function( $menu, opts, conf )
{
this.$menu = $menu;
this._api = [ 'bind', 'getInstance', 'initPanels', 'openPanel', 'closePanel', 'closeAllPanels', 'setSelected' ];
this.opts = opts;
this.conf = conf;
this.vars = {};
this.cbck = {};
this.mtch = {};
if ( typeof this.___deprecated == 'function' )
{
this.___deprecated();
}
this._initAddons();
this._initExtensions();
this._initMenu();
this._initPanels();
this._initOpened();
this._initAnchors();
this._initMatchMedia();
if ( typeof this.___debug == 'function' )
{
this.___debug();
}
return this;
};
$[ _PLUGIN_ ].version = _VERSION_;
$[ _PLUGIN_ ].addons = {};
$[ _PLUGIN_ ].uniqueId = 0;
$[ _PLUGIN_ ].defaults = {
extensions : [],
initMenu : function() {},
initPanels : function() {},
navbar : {
add : true,
title : 'Menu',
titleLink : 'parent'
},
onClick : {
// close : true,
// preventDefault : null,
setSelected : true
},
slidingSubmenus : true
};
$[ _PLUGIN_ ].configuration = {
classNames : {
divider : 'Divider',
inset : 'Inset',
nolistview : 'NoListview',
nopanel : 'NoPanel',
panel : 'Panel',
selected : 'Selected',
spacer : 'Spacer',
vertical : 'Vertical'
},
clone : false,
openingInterval : 25,
panelNodetype : 'ul, ol, div',
transitionDuration : 400
};
$[ _PLUGIN_ ].prototype = {
getInstance: function()
{
return this;
},
initPanels: function( $panels )
{
this._initPanels( $panels );
},
openPanel: function( $panel, animation )
{
this.trigger( 'openPanel:before', $panel );
if ( !$panel || !$panel.length )
{
return;
}
if ( !$panel.is( '.' + _c.panel ) )
{
$panel = $panel.closest( '.' + _c.panel )
}
if ( !$panel.is( '.' + _c.panel ) )
{
return;
}
var that = this;
if ( typeof animation != 'boolean' )
{
animation = true;
}
// vertical
if ( $panel.hasClass( _c.vertical ) )
{
// Open current and all vertical parent panels
$panel
.add( $panel.parents( '.' + _c.vertical ) )
.removeClass( _c.hidden )
.parent( 'li' )
.addClass( _c.opened );
// Open first non-vertical parent panel
this.openPanel(
$panel
.parents( '.' + _c.panel )
.not( '.' + _c.vertical )
.first()
);
this.trigger( 'openPanel:start' , $panel );
this.trigger( 'openPanel:finish', $panel );
}
// Horizontal
else
{
if ( $panel.hasClass( _c.opened ) )
{
return;
}
var $panels = this.$pnls.children( '.' + _c.panel ),
$current = $panels.filter( '.' + _c.opened );
// old browser support
if ( !$[ _PLUGIN_ ].support.csstransitions )
{
$current
.addClass( _c.hidden )
.removeClass( _c.opened );
$panel
.removeClass( _c.hidden )
.addClass( _c.opened );
this.trigger( 'openPanel:start' , $panel );
this.trigger( 'openPanel:finish', $panel );
return;
}
// /old browser support
// 'Close' all children
$panels
.not( $panel )
.removeClass( _c.subopened );
// 'Open' all parents
var $parent = $panel.data( _d.parent );
while( $parent )
{
$parent = $parent.closest( '.' + _c.panel );
if ( !$parent.is( '.' + _c.vertical ) )
{
$parent.addClass( _c.subopened );
}
$parent = $parent.data( _d.parent );
}
// Add classes for animation
$panels
.removeClass( _c.highest )
.not( $current )
.not( $panel )
.addClass( _c.hidden );
$panel
.removeClass( _c.hidden );
var start = function()
{
$current.removeClass( _c.opened );
$panel.addClass( _c.opened );
if ( $panel.hasClass( _c.subopened ) )
{
$current.addClass( _c.highest );
$panel.removeClass( _c.subopened );
}
else
{
$current.addClass( _c.subopened );
$panel.addClass( _c.highest );
}
this.trigger( 'openPanel:start', $panel );
};
var finish = function()
{
$current.removeClass( _c.highest ).addClass( _c.hidden );
$panel.removeClass( _c.highest );
this.trigger( 'openPanel:finish', $panel );
}
if ( animation && !$panel.hasClass( _c.noanimation ) )
{
// Without the timeout the animation will not work because the element had display: none;
setTimeout(
function()
{
// Callback
that.__transitionend( $panel,
function()
{
finish.call( that );
}, that.conf.transitionDuration
);
start.call( that );
}, this.conf.openingInterval
);
}
else
{
start.call( this );
finish.call( this );
}
}
this.trigger( 'openPanel:after', $panel );
},
closePanel: function( $panel )
{
this.trigger( 'closePanel:before', $panel );
var $l = $panel.parent();
// Vertical only
if ( $l.hasClass( _c.vertical ) )
{
$l.removeClass( _c.opened );
this.trigger( 'closePanel', $panel );
}
this.trigger( 'closePanel:after', $panel );
},
closeAllPanels: function()
{
this.trigger( 'closeAllPanels:before' );
// Vertical
this.$pnls
.find( '.' + _c.listview )
.children()
.removeClass( _c.selected )
.filter( '.' + _c.vertical )
.removeClass( _c.opened );
// Horizontal
var $pnls = this.$pnls.children( '.' + _c.panel ),
$frst = $pnls.first();
this.$pnls
.children( '.' + _c.panel )
.not( $frst )
.removeClass( _c.subopened )
.removeClass( _c.opened )
.removeClass( _c.highest )
.addClass( _c.hidden );
this.openPanel( $frst );
this.trigger( 'closeAllPanels:after' );
},
togglePanel: function( $panel )
{
var $l = $panel.parent();
// Vertical only
if ( $l.hasClass( _c.vertical ) )
{
this[ $l.hasClass( _c.opened ) ? 'closePanel' : 'openPanel' ]( $panel );
}
},
setSelected: function( $li )
{
this.trigger( 'setSelected:before', $li );
this.$menu.find( '.' + _c.listview ).children( '.' + _c.selected ).removeClass( _c.selected );
$li.addClass( _c.selected );
this.trigger( 'setSelected:after', $li );
},
bind: function( evnt, fn )
{
this.cbck[ evnt ] = this.cbck[ evnt ] || [];
this.cbck[ evnt ].push( fn );
},
trigger: function()
{
var that = this,
args = Array.prototype.slice.call( arguments ),
evnt = args.shift();
if ( this.cbck[ evnt ] )
{
for ( var e = 0, l = this.cbck[ evnt ].length; e < l; e++ )
{
this.cbck[ evnt ][ e ].apply( that, args );
}
}
},
matchMedia: function( mdia, yes, no )
{
var that = this,
func = {
'yes': yes,
'no' : no
};
// Bind to windowResize
this.mtch[ mdia ] = this.mtch[ mdia ] || [];
this.mtch[ mdia ].push( func );
},
_initAddons: function()
{
this.trigger( 'initAddons:before' );
// Add add-ons to plugin
var adns;
for ( adns in $[ _PLUGIN_ ].addons )
{
$[ _PLUGIN_ ].addons[ adns ].add.call( this );
$[ _PLUGIN_ ].addons[ adns ].add = function() {};
}
// Setup add-ons for menu
for ( adns in $[ _PLUGIN_ ].addons )
{
$[ _PLUGIN_ ].addons[ adns ].setup.call( this );
}
this.trigger( 'initAddons:after' );
},
_initExtensions: function()
{
this.trigger( 'initExtensions:before' );
var that = this;
// Convert array to object with array
if ( this.opts.extensions.constructor === Array )
{
this.opts.extensions = {
'all': this.opts.extensions
};
}
// Loop over object
for ( var mdia in this.opts.extensions )
{
this.opts.extensions[ mdia ] = this.opts.extensions[ mdia ].length ? 'mm-' + this.opts.extensions[ mdia ].join( ' mm-' ) : '';
if ( this.opts.extensions[ mdia ] )
{
(function( mdia ) {
that.matchMedia( mdia,
function()
{
this.$menu.addClass( this.opts.extensions[ mdia ] );
},
function()
{
this.$menu.removeClass( this.opts.extensions[ mdia ] );
}
);
})( mdia );
}
}
this.trigger( 'initExtensions:after' );
},
_initMenu: function()
{
this.trigger( 'initMenu:before' );
var that = this;
// Clone if needed
if ( this.conf.clone )
{
this.$orig = this.$menu;
this.$menu = this.$orig.clone();
this.$menu.add( this.$menu.find( '[id]' ) )
.filter( '[id]' )
.each(
function()
{
$(this).attr( 'id', _c.mm( $(this).attr( 'id' ) ) );
}
);
}
// Via options
this.opts.initMenu.call( this, this.$menu, this.$orig );
// Add ID
this.$menu.attr( 'id', this.$menu.attr( 'id' ) || this.__getUniqueId() );
// Add markup
this.$pnls = $( '<div class="' + _c.panels + '" />' )
.append( this.$menu.children( this.conf.panelNodetype ) )
.prependTo( this.$menu );
// Add classes
var clsn = [ _c.menu ];
if ( !this.opts.slidingSubmenus )
{
clsn.push( _c.vertical );
}
this.$menu
.addClass( clsn.join( ' ' ) )
.parent()
.addClass( _c.wrapper );
this.trigger( 'initMenu:after' );
},
_initPanels: function( $panels )
{
this.trigger( 'initPanels:before', $panels );
$panels = $panels || this.$pnls.children( this.conf.panelNodetype );
var $newpanels = $();
var that = this;
var init = function( $panels )
{
$panels
.filter( this.conf.panelNodetype )
.each(
function()
{
$panel = that._initPanel( $(this) );
if ( $panel )
{
that._initNavbar( $panel );
that._initListview( $panel );
$newpanels = $newpanels.add( $panel );
// init child panels
var $child = $panel
.children( '.' + _c.listview )
.children( 'li' )
.children( that.conf.panelNodeType )
.add( $panel.children( '.' + that.conf.classNames.panel ) );
if ( $child.length )
{
init.call( that, $child );
}
}
}
);
};
init.call( this, $panels );
// Init via options
this.opts.initPanels.call( this, $newpanels );
this.trigger( 'initPanels:after', $newpanels );
},
_initPanel: function( $panel )
{
this.trigger( 'initPanel:before', $panel );
var that = this;
// Refactor panel classnames
this.__refactorClass( $panel, this.conf.classNames.panel , 'panel' );
this.__refactorClass( $panel, this.conf.classNames.nopanel , 'nopanel' );
this.__refactorClass( $panel, this.conf.classNames.vertical , 'vertical' );
this.__refactorClass( $panel, this.conf.classNames.inset , 'inset' );
$panel.filter( '.' + _c.inset )
.addClass( _c.nopanel );
// Stop if not supposed to be a panel
if ( $panel.hasClass( _c.nopanel ) )
{
return false;
}
// Stop if already a panel
if ( $panel.hasClass( _c.panel ) )
{
return $panel;
}
// Wrap UL/OL in DIV
var vertical = ( $panel.hasClass( _c.vertical ) || !this.opts.slidingSubmenus );
$panel.removeClass( _c.vertical );
var id = $panel.attr( 'id' ) || this.__getUniqueId();
$panel.removeAttr( 'id' );
if ( $panel.is( 'ul, ol' ) )
{
$panel.wrap( '<div />' );
$panel = $panel.parent();
}
$panel
.addClass( _c.panel + ' ' + _c.hidden )
.attr( 'id', id );
var $parent = $panel.parent( 'li' );
if ( vertical )
{
$panel
.add( $parent )
.addClass( _c.vertical );
}
else
{
$panel.appendTo( this.$pnls );
}
// Store parent/child relation
if ( $parent.length )
{
$parent.data( _d.child, $panel );
$panel.data( _d.parent, $parent );
}
this.trigger( 'initPanel:after', $panel );
return $panel;
},
_initNavbar: function( $panel )
{
this.trigger( 'initNavbar:before', $panel );
if ( $panel.children( '.' + _c.navbar ).length )
{
return;
}
var $parent = $panel.data( _d.parent ),
$navbar = $( '<div class="' + _c.navbar + '" />' );
var title = $[ _PLUGIN_ ].i18n( this.opts.navbar.title ),
href = false;
if ( $parent && $parent.length )
{
if ( $parent.hasClass( _c.vertical ) )
{
return;
}
// Listview, the panel wrapping this panel
if ( $parent.parent().is( '.' + _c.listview ) )
{
var $a = $parent
.children( 'a, span' )
.not( '.' + _c.next );
}
// Non-listview, the first anchor in the parent panel that links to this panel
else
{
var $a = $parent
.closest( '.' + _c.panel )
.find( 'a[href="#' + $panel.attr( 'id' ) + '"]' );
}
$a = $a.first();
$parent = $a.closest( '.' + _c.panel );
var id = $parent.attr( 'id' );
title = $a.text();
switch ( this.opts.navbar.titleLink )
{
case 'anchor':
href = $a.attr( 'href' );
break;
case 'parent':
href = '#' + id;
break;
}
$navbar.append( '<a class="' + _c.btn + ' ' + _c.prev + '" href="#' + id + '" />' );
}
else if ( !this.opts.navbar.title )
{
return;
}
if ( this.opts.navbar.add )
{
$panel.addClass( _c.hasnavbar );
}
$navbar.append( '<a class="' + _c.title + '"' + ( href ? ' href="' + href + '"' : '' ) + '>' + title + '</a>' )
.prependTo( $panel );
this.trigger( 'initNavbar:after', $panel );
},
_initListview: function( $panel )
{
this.trigger( 'initListview:before', $panel );
// Refactor listviews classnames
var $ul = this.__childAddBack( $panel, 'ul, ol' );
this.__refactorClass( $ul, this.conf.classNames.nolistview , 'nolistview' );
$ul.filter( '.' + this.conf.classNames.inset )
.addClass( _c.nolistview );
// Refactor listitems classnames
var $li = $ul
.not( '.' + _c.nolistview )
.addClass( _c.listview )
.children();
this.__refactorClass( $li, this.conf.classNames.selected , 'selected' );
this.__refactorClass( $li, this.conf.classNames.divider , 'divider' );
this.__refactorClass( $li, this.conf.classNames.spacer , 'spacer' );
// Add open link to parent listitem
var $parent = $panel.data( _d.parent );
if ( $parent && $parent.parent().is( '.' + _c.listview ) )
{
if ( !$parent.children( '.' + _c.next ).length )
{
var $a = $parent.children( 'a, span' ).first(),
$b = $( '<a class="' + _c.next + '" href="#' + $panel.attr( 'id' ) + '" />' ).insertBefore( $a );
if ( $a.is( 'span' ) )
{
$b.addClass( _c.fullsubopen );
}
}
}
this.trigger( 'initListview:after', $panel );
},
_initOpened: function()
{
this.trigger( 'initOpened:before' );
var $selected = this.$pnls
.find( '.' + _c.listview )
.children( '.' + _c.selected )
.removeClass( _c.selected )
.last()
.addClass( _c.selected );
var $current = ( $selected.length )
? $selected.closest( '.' + _c.panel )
: this.$pnls.children( '.' + _c.panel ).first();
this.openPanel( $current, false );
this.trigger( 'initOpened:after' );
},
_initAnchors: function()
{
var that = this;
glbl.$body
.on( _e.click + '-oncanvas',
'a[href]',
function( e )
{
var $t = $(this),
fired = false,
inMenu = that.$menu.find( $t ).length;
// Find behavior for addons
for ( var a in $[ _PLUGIN_ ].addons )
{
if ( $[ _PLUGIN_ ].addons[ a ].clickAnchor.call( that, $t, inMenu ) )
{
fired = true;
break;
}
}
var _h = $t.attr( 'href' );
// Open/Close panel
if ( !fired && inMenu )
{
if ( _h.length > 1 && _h.slice( 0, 1 ) == '#' )
{
try
{
var $h = $(_h, that.$menu);
if ( $h.is( '.' + _c.panel ) )
{
fired = true;
that[ $t.parent().hasClass( _c.vertical ) ? 'togglePanel' : 'openPanel' ]( $h );
}
}
catch( err ) {}
}
}
if ( fired )
{
e.preventDefault();
}
// All other anchors in lists
if ( !fired && inMenu )
{
if ( $t.is( '.' + _c.listview + ' > li > a' ) && !$t.is( '[rel="external"]' ) && !$t.is( '[target="_blank"]' ) )
{
// Set selected item
if ( that.__valueOrFn( that.opts.onClick.setSelected, $t ) )
{
that.setSelected( $(e.target).parent() );
}
// Prevent default / don't follow link. Default: false
var preventDefault = that.__valueOrFn( that.opts.onClick.preventDefault, $t, _h.slice( 0, 1 ) == '#' );
if ( preventDefault )
{
e.preventDefault();
}
// Close menu. Default: true if preventDefault, false otherwise
if ( that.__valueOrFn( that.opts.onClick.close, $t, preventDefault ) )
{
that.close();
}
}
}
}
);
},
_initMatchMedia: function()
{
var that = this;
this._fireMatchMedia();
glbl.$wndw
.on( _e.resize,
function( e )
{
that._fireMatchMedia();
}
);
},
_fireMatchMedia: function()
{
for ( var mdia in this.mtch )
{
var fn = window.matchMedia && window.matchMedia( mdia ).matches ? 'yes' : 'no';
for ( var m = 0; m < this.mtch[ mdia ].length; m++ )
{
this.mtch[ mdia ][ m ][ fn ].call( this );
}
}
},
_getOriginalMenuId: function()
{
var id = this.$menu.attr( 'id' );
if ( this.conf.clone && id && id.length )
{
id = _c.umm( id );
}
return id;
},
__api: function()
{
var that = this,
api = {};
$.each( this._api,
function( i )
{
var fn = this;
api[ fn ] = function()
{
var re = that[ fn ].apply( that, arguments );
return ( typeof re == 'undefined' ) ? api : re;
};
}
);
return api;
},
__valueOrFn: function( o, $e, d )
{
if ( typeof o == 'function' )
{
return o.call( $e[ 0 ] );
}
if ( typeof o == 'undefined' && typeof d != 'undefined' )
{
return d;
}
return o;
},
__refactorClass: function( $e, o, c )
{
return $e.filter( '.' + o ).removeClass( o ).addClass( _c[ c ] );
},
__findAddBack: function( $e, s )
{
return $e.find( s ).add( $e.filter( s ) );
},
__childAddBack: function( $e, s )
{
return $e.children( s ).add( $e.filter( s ) );
},
__filterListItems: function( $li )
{
return $li
.not( '.' + _c.divider )
.not( '.' + _c.hidden );
},
__filterListItemAnchors: function( $li )
{
return this.__filterListItems( $li )
.children( 'a' )
.not( '.' + _c.next );
},
__transitionend: function( $e, fn, duration )
{
var _ended = false,
_fn = function( e )
{
if ( typeof e !== 'undefined' )
{
if ( e.target != $e[ 0 ] )
{
return;
}
}
if ( !_ended )
{
$e.unbind( _e.transitionend );
$e.unbind( _e.webkitTransitionEnd );
fn.call( $e[ 0 ] );
}
_ended = true;
};
$e.on( _e.transitionend, _fn );
$e.on( _e.webkitTransitionEnd, _fn );
setTimeout( _fn, duration * 1.1 );
},
__getUniqueId: function()
{
return _c.mm( $[ _PLUGIN_ ].uniqueId++ );
}
};
/*
jQuery plugin
*/
$.fn[ _PLUGIN_ ] = function( opts, conf )
{
// First time plugin is fired
initPlugin();
// Extend options
opts = $.extend( true, {}, $[ _PLUGIN_ ].defaults, opts );
conf = $.extend( true, {}, $[ _PLUGIN_ ].configuration, conf );
var $result = $();
this.each(
function()
{
var $menu = $(this);
if ( $menu.data( _PLUGIN_ ) )
{
return;
}
var _menu = new $[ _PLUGIN_ ]( $menu, opts, conf );
_menu.$menu.data( _PLUGIN_, _menu.__api() );
$result = $result.add( _menu.$menu );
}
);
return $result;
};
/*
I18N
*/
$[ _PLUGIN_ ].i18n = (function() {
var trns = {};
return function( t )
{
switch( typeof t )
{
case 'object':
$.extend( trns, t );
return trns;
break;
case 'string':
return trns[ t ] || t;
break;
case 'undefined':
default:
return trns;
break;
}
};
})();
/*
SUPPORT
*/
$[ _PLUGIN_ ].support = {
touch: 'ontouchstart' in window || navigator.msMaxTouchPoints || false,
csstransitions: (function()
{
if ( typeof Modernizr !== 'undefined' &&
typeof Modernizr.csstransitions !== 'undefined'
) {
return Modernizr.csstransitions;
}
// w/o Modernizr, we'll assume you only support modern browsers :/
return true;
})(),
csstransforms: (function() {
if ( typeof Modernizr !== 'undefined' &&
typeof Modernizr.csstransforms !== 'undefined'
) {
return Modernizr.csstransforms;
}
// w/o Modernizr, we'll assume you only support modern browsers :/
return true;
})(),
csstransforms3d: (function() {
if ( typeof Modernizr !== 'undefined' &&
typeof Modernizr.csstransforms3d !== 'undefined'
) {
return Modernizr.csstransforms3d;
}
// w/o Modernizr, we'll assume you only support modern browsers :/
return true;
})()
};
// Global variables
var _c, _d, _e, glbl;
function initPlugin()
{
if ( $[ _PLUGIN_ ].glbl )
{
return;
}
glbl = {
$wndw : $(window),
$docu : $(document),
$html : $('html'),
$body : $('body')
};
// Classnames, Datanames, Eventnames
_c = {};
_d = {};
_e = {};
$.each( [ _c, _d, _e ],
function( i, o )
{
o.add = function( a )
{
a = a.split( ' ' );
for ( var b = 0, l = a.length; b < l; b++ )
{
o[ a[ b ] ] = o.mm( a[ b ] );
}
};
}
);
// Classnames
_c.mm = function( c ) { return 'mm-' + c; };
_c.add( 'wrapper menu panels panel nopanel highest opened subopened navbar hasnavbar title btn prev next listview nolistview inset vertical selected divider spacer hidden fullsubopen noanimation' );
_c.umm = function( c )
{
if ( c.slice( 0, 3 ) == 'mm-' )
{
c = c.slice( 3 );
}
return c;
};
// Datanames
_d.mm = function( d ) { return 'mm-' + d; };
_d.add( 'parent child' );
// Eventnames
_e.mm = function( e ) { return e + '.mm'; };
_e.add( 'transitionend webkitTransitionEnd click scroll resize keydown mousedown mouseup touchstart touchmove touchend orientationchange' );
$[ _PLUGIN_ ]._c = _c;
$[ _PLUGIN_ ]._d = _d;
$[ _PLUGIN_ ]._e = _e;
$[ _PLUGIN_ ].glbl = glbl;
}
})( jQuery );
| AmyCollishaw/kscs_drupal | sites/all/libraries/mmenu/src/core/oncanvas/jquery.mmenu.oncanvas.js | JavaScript | gpl-2.0 | 22,926 |
var gifwhesApi = require('../routes/api/gifwhes');
var gishwhesApi = require('../routes/api/gishwhes');
var showcaseApi = require('../routes/api/showcase');
var aboutApi = require('../routes/api/about');
module.exports = function(app) {
'use strict';
gifwhesApi(app);
gishwhesApi(app);
showcaseApi(app);
aboutApi(app);
};
| tzoela/massive-octo-dubstep | lib/apiRouter.js | JavaScript | gpl-2.0 | 334 |
"undefined"!=typeof jQuery&&function(d){d.widget("ui.wolfnetScrollingItems",d.thomaskahn.smoothDivScroll,{options:{autoPlay:!1,direction:"left",speed:5,minMargin:2,manualContinuousScrolling:!0,mousewheelScrolling:!0,scrollingHotSpotLeftClass:"scrollingHotSpotLeft",scrollingHotSpotRightClass:"scrollingHotSpotRight",scrollableAreaClass:"scrollableArea",scrollWrapperClass:"scrollWrapper",visibleHotSpotBackgrounds:""},_create:function(){var a=this.options;d(this.element);this.resizeDelay=0;a.autoScrollingMode=
a.autoPlay?"always":"";a.autoScrollingDirection="right"==a.direction?"endlessloopleft":"endlessloopright";a.autoScrollingInterval=a.speed;this._setup();this._establishEvents();d.thomaskahn.smoothDivScroll.prototype._create.call(this);this._recalculateItemMargins()},_setup:function(){var a=this.options,b=d(this.element),c=b.children();b.css({position:"relative",width:"100%",height:"100px"});b.children().css({"float":"left"});var g=0,f=0,e=0,h=0;c.each(function(){var a=d(this),b=a.height(),c=a.width();
g=b>g?b:g;f=c>f?c:f;b=Number(a.css("margin-top").replace("px",""));a=Number(a.css("margin-bottom").replace("px",""));e=b>e?b:e;h=a>h?a:h});a.maxItemHeight=g;a.maxItemWidth=f;a.maxItemMarginTop=e;a.maxItemMarginBottom=h;c.height(g);c.width(f);b.height(g);b.width(b.width())},_establishEvents:function(){var a=this,b=this.options,c=d(this.element);c.mouseover(function(){b.autoPlay&&a.stopAutoScrolling();a.showHotSpotBackgrounds()});c.mouseleave(function(){a.hideHotSpotBackgrounds();b.autoPlay&&a.startAutoScrolling()})},
_recalculateItemMargins:function(){var a=this,b=this.options,c=d(this.element),g=c.find(".scrollableArea:first").children();b.autoPlay&&(clearTimeout(a.resizeDelay),a.stopAutoScrolling());var f=1,e=0,h=function(a,b,c,e){f=Math.floor(a/b)+e;var d=(a-b*f)/f/2;d==-1&&(d=0);var g=(d*2+b)*f;if((d<c||g>a)&&f>1)d=h(a,b,c,e-1);return d},e=h(c.width(),b.maxItemWidth,b.minMargin,0);g.css({"margin-top":b.maxItemMarginTop,"margin-right":e,"margin-bottom":b.maxItemMarginBottom,"margin-left":e});e=b.maxItemHeight+
b.maxItemMarginTop+b.maxItemMarginBottom;c.height(e);b.autoPlay&&(a.resizeDelay=setTimeout(function(){a.startAutoScrolling()},500))}})}(jQuery);
| wp-plugins/wolfnet-idx-for-wordpress | public/js/jquery.wolfnetScrollingItems.min.js | JavaScript | gpl-2.0 | 2,191 |
/*global java */
/**
* Helper functions to enable JSDoc to run on multiple JavaScript runtimes.
*
* @module jsdoc/util/runtime
* @private
*/
'use strict';
var env = require('jsdoc/env');
var os = require('os');
// These strings represent directory names; do not modify them!
/** @private */
var RHINO = exports.RHINO = 'rhino';
/** @private */
var NODE = exports.NODE = 'node';
/**
* The JavaScript runtime that is executing JSDoc:
*
* + `module:jsdoc/util/runtime~RHINO`: Mozilla Rhino.
* + `module:jsdoc/util/runtime~NODE`: Node.js.
*
* @private
*/
var runtime = (function() {
if (global.Packages && typeof global.Packages === 'object' &&
Object.prototype.toString.call(global.Packages) === '[object JavaPackage]') {
return RHINO;
} else if (require && require.main && module) {
return NODE;
} else {
// unknown runtime
throw new Error('Unable to identify the current JavaScript runtime.');
}
})();
/**
* Check whether Mozilla Rhino is running JSDoc.
* @return {boolean} Set to `true` if the current runtime is Mozilla Rhino.
*/
exports.isRhino = function() {
return runtime === RHINO;
};
/**
* Check whether Node.js is running JSDoc.
* @return {boolean} Set to `true` if the current runtime is Node.js.
*/
exports.isNode = function() {
return runtime === NODE;
};
function initializeRhino(args) {
// the JSDoc dirname is the main module URI, minus the filename, converted to a path
var uriParts = require.main.uri.split('/');
uriParts.pop();
env.dirname = String( new java.io.File(new java.net.URI(uriParts.join('/'))) );
env.pwd = String( java.lang.System.getenv().get('PWD') );
env.args = args;
require(env.dirname + '/rhino/rhino-shim.js');
}
function initializeNode(args) {
var fs = require('fs');
var path = require('path');
var jsdocPath = args[0];
var pwd = args[1];
// resolve the path if it's a symlink
if ( fs.statSync(jsdocPath).isSymbolicLink() ) {
jsdocPath = path.resolve( path.dirname(jsdocPath), fs.readlinkSync(jsdocPath) );
}
env.dirname = jsdocPath;
env.pwd = pwd;
env.args = process.argv.slice(2);
}
exports.initialize = function(args) {
switch (runtime) {
case RHINO:
initializeRhino(args);
break;
case NODE:
initializeNode(args);
break;
default:
throw new Error('Cannot initialize the unknown JavaScript runtime "' + runtime + '"!');
}
};
/**
* Retrieve the identifier for the current JavaScript runtime.
*
* @private
* @return {string} The runtime identifier.
*/
exports.getRuntime = function() {
return runtime;
};
/**
* Get the require path for the runtime-specific implementation of a module.
*
* @param {string} partialPath - The partial path to the module. Use the same format as when calling
* `require()`.
* @return {object} The require path for the runtime-specific implementation of the module.
*/
exports.getModulePath = function(partialPath) {
var path = require('path');
return path.join(env.dirname, runtime, partialPath);
};
| phongmedia/postworld | node_modules/jsdoc/lib/jsdoc/util/runtime.js | JavaScript | gpl-2.0 | 3,154 |
;(function(){
// UTILS FUNCTIONS
// ===============
function arrayUnique(array) {
var a = this.concat();
for(var i=0; i<a.length; ++i) {
for(var j=i+1; j<a.length; ++j) {
if(a[i] === a[j])
a.splice(j--, 1);
}
}
return a;
};
function log(text){
new_text = text + "\n" + $("#logger").text();
$("#logger").text(new_text);
}
function extendJson(outputJson, json){
for (var key in json){
outputJson[key] = json[key];
}
return outputJson;
}
function extendMap(outputMap, map){
for (var key in map){
if (!outputMap.hasOwnProperty(key)){
outputMap[key] = [];
}
for (var i in map[key]){
var exist = false;
for (var j in outputMap[key]){
if (map[key][i][0] === outputMap[key][j][0] && map[key][i][1] === outputMap[key][j][1]){
exist = true;
break;
}
}
if (!exist){
outputMap[key].push(map[key][i])
}
}
}
return outputMap;
};
// REQUESTS BUILDER
// ================
function getRequestForm(){
return {"type": "", "api": "1.0", "data": {}};
}
function getDisconnect(){
a = getRequestForm();
a["type"] = "disconnect";
return a;
}
function getConnect(){
a = getRequestForm();
a["type"] = "connect";
data = {"login": $("#login").val(), "password": $("#password").val()};
a["data"] = data;
return a;
}
function getConnectRoom(){
$("#turn_counter").text(0);
a = getRequestForm();
a["type"] = "connect_room";
data = {"index": $("#index").val()};
a["data"] = data;
return a;
}
function getRequest(){
request_list = $("#requests").val().split(" ");
a = getRequestForm();
a["type"] = "request";
a["data"] = {"requests": request_list}
return a;
}
function getStatus(){
request_list = $("#requests").val().split(" ");
a = getRequestForm();
a["type"] = "status";
a["data"] = {"requests": request_list}
return a;
}
function getControl(action){
a = getRequestForm();
a["type"] = "control";
a["data"] = {"action": action};
return a;
}
function getChat(){
a = getRequestForm();
a["type"] = "chat";
msg = $("#chat_text").val();
$("#chat_text").val("");
a["data"] = {"message": msg};
return a;
}
// CONNECTIONS SETTINGS
// ====================
URL = "ws://127.0.0.1:4080/rao"
// URL = "ws://45.55.134.136:4080/rao"
ws = new WebSocket(URL);
ws.onopen = function(){
log("Connection opened to "+ URL);
};
ws.onclose = function(event){ log("Connection close. Reason: " + event.reason + ":" + event.code); };
ws.onmessage = function(event){ handleMessage(event.data); };
ws.onerror = function(error){ log("Got error: " + error.message); };
function send(json){
text = JSON.stringify(json);
// log("Send: " + text);
ws.send(text);
}
// BUTTONS FUNCTIONS
// =================
document.getElementById('status').addEventListener('click', function(){ send(getStatus()) }, false);
document.getElementById('connect').addEventListener('click', function(){ send(getConnect()) }, false);
document.getElementById('request').addEventListener('click', function(){ send(getRequest()); }, false);
document.getElementById('chat_button').addEventListener('click', function(){ send(getChat()) }, false);
document.getElementById('disconnect').addEventListener('click', function(){ send(getDisconnect()); }, false);
document.getElementById('connect_room').addEventListener('click', function(){ send(getConnectRoom()) }, false);
document.getElementById('control_up').addEventListener('click', function(){ send(getControl(this.id)) }, false);
document.getElementById('control_down').addEventListener('click', function(){ send(getControl(this.id)) }, false);
document.getElementById('control_left').addEventListener('click', function(){ send(getControl(this.id)) }, false);
document.getElementById('control_right').addEventListener('click', function(){ send(getControl(this.id)) }, false);
document.getElementById('control_action').addEventListener('click', function(){ send(getControl(this.id)) }, false);
// RENDER FUNCTIONS
// ================
var canvas_el = document.getElementById("myCanvas")
var canvas = canvas_el.getContext("2d");
canvas.font = "14px Arial";
var width = 32;
var Images = {
"Wall": loadImage("Wall"),
"Floor": loadImage("Floor")
};
function loadImage(name){
src = "images/" + name + ".png";
img = new Image();
img.src = src;
console.log("Loading image: " + src);
return img;
}
game = {"map": {}, "players": "", "player": "", "entities": ""};
myPlayer = {}
chat = []
function handleMessage(data){
json = JSON.parse(data);
jsonData = JSON.parse(json["data"].replace(/'/g, '"'));
log(data);
if (json["code"] != 200 || json["type"] == "status") {
log(data);
}
if (json["type"] == "status") {
if (jsonData["player"]){
myPlayer = jsonData["player"];
}
}
if (json["type"] == "information") {
if (jsonData["tick"]){
el = $("#turn_counter");
el.text( parseInt(el.text()) + 1);
}
if (jsonData["chat"]){
msg = jsonData["chat"];
chat.splice(0, 0, msg);
chat = chat.slice(0, 20);
$("#chat_box").text(chat.join("\n"));
}
if (jsonData["map"]){
game["map"] = extendMap(game["map"], jsonData["map"])
game["activeMap"] = jsonData["map"];
}
if (jsonData["players"]){
players = jsonData["players"];
game["players"] = players;
for (player in players){
if (players[player]["Name"] == myPlayer["Name"]){
myPlayer = players[player]
}
}
}
if (jsonData["entities"]){
game["entities"] = jsonData["entities"];
}
}
}
// var d = new Date();
function draw(){
var curTime = new Date().getTime();
canvas.clearRect(0, 0, canvas_el.width, canvas_el.height);
if (myPlayer["Hero"]){
var offsetX = (myPlayer["Hero"]["X"] * width) - canvas_el.width/2;
var offsetY = (myPlayer["Hero"]["Y"] * width) - canvas_el.height/2;
}
// In-Game loading images:
for (i in game["entities"]){
img = game["entities"][i]["Image"];
if (!Images.hasOwnProperty(img)){
Images[img] = loadImage(img);
}
}
// Draw all map
for (i in game["map"]){
tileList = game["map"][i];
for (pos in tileList) {
var x = tileList[pos][0];
var y = tileList[pos][1];
var drawX = x*width - offsetX;
var drawY = y*width - offsetY;
// if this tile on screen:
if (drawX > -width && drawX < canvas_el.width && drawY >= -width && drawY < canvas_el.height){
if (i == "#"){
canvas.drawImage(Images["Wall"], drawX, drawY);
}
else if (i == "."){
canvas.drawImage(Images["Floor"], drawX, drawY);
}
canvas.globalAlpha = 0.2;
canvas.fillStyle = "#000000";
canvas.fillRect(x*width - offsetX, y*width - offsetY, width, width);
canvas.globalAlpha = 1;
}
}
}
// Draw active map
for (i in game["activeMap"]){
tileList = game["activeMap"][i];
for (pos in tileList) {
var x = tileList[pos][0];
var y = tileList[pos][1];
if (i == "#"){
canvas.drawImage(Images["Wall"], x*width - offsetX, y*width - offsetY);
}
else if (i == "."){
canvas.drawImage(Images["Floor"], x*width - offsetX, y*width - offsetY);
}
}
}
// Draw entities
for (i in game["entities"]){
entity = game["entities"][i];
img = entity["Image"];
canvas.drawImage(Images[img], entity["X"] * width - offsetX, entity["Y"] * width - offsetY);
}
// HP bar:
for (i in game["entities"]){
entity = game["entities"][i];
if (entity["Type"] == "Enemy" || entity["Type"] == "Player"){
// render simple GUI
bar_width = 32;
bar_height = 8;
c_width = canvas_el.width
var ent_x = entity["X"] * width - offsetX
var ent_y = entity["Y"] * width - offsetY;
canvas.fillStyle = "#000000";
canvas.fillRect(ent_x, ent_y+32, bar_width, bar_height);
canvas.fillStyle = "#FF0000";
canvas.fillRect(ent_x, ent_y+32, bar_width * (entity["Health"]/entity["HealthMax"]), bar_height);
// canvas.fillStyle = "#000000";
// canvas.fillText(entity["Name"], ent_x, ent_y+38);
}
}
}
// UPDATE FUNCTIONS
// ================
setInterval(function(){ draw(); }, 25);
$('body').on('keydown',function(e){
if (e.keyCode == 87) { send(getControl("control_up")) };
if (e.keyCode == 83) { send(getControl("control_down")) };
if (e.keyCode == 65) { send(getControl("control_left")) };
if (e.keyCode == 68) { send(getControl("control_right")) };
if (e.keyCode == 32) { send(getControl("control_action")) };
});
})(); | Insality/RAO | RAOClientHtml/js/base.js | JavaScript | gpl-2.0 | 8,508 |
( function( $ ) {
$( document ).ready(function() {
// Cache the elements we'll need
var menu = $('#cssmenu');
var menuList = menu.find('ul:first');
var listItems = menu.find('li').not('#responsive-tab');
// Create responsive trigger
menuList.prepend('<li id="responsive-tab"><a href="#">Menu</a></li>');
// Toggle menu visibility
menu.on('click', '#responsive-tab', function(){
listItems.slideToggle('fast');
listItems.addClass('collapsed');
});
});
} )( jQuery );
$(document).ready(function(){
// Custom jQuery code goes here
$('#cssmenu2 > ul > li:has(ul)').addClass("has-sub");
$('#cssmenu2 > ul > li > a').click(function() {
var checkElement = $(this).next();
$('#cssmenu2 li').removeClass('active');
$(this).closest('li').addClass('active');
if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
$(this).closest('li').removeClass('active');
checkElement.slideUp('normal');
}
if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
$('#cssmenu2 ul ul:visible').slideUp('normal');
checkElement.slideDown('normal');
}
if (checkElement.is('ul')) {
return false;
} else {
return true;
}
});
});
| joannenguyen/MG | js/script.js | JavaScript | gpl-2.0 | 1,162 |
"use strict"
var path = require('path'),
rewire = require('rewire');
global.sinon = require('sinon');
global.chai = require('chai');
global.should = require('chai').should();
global.expect = require('chai').expect;
global.rewire = rewire;
global.AssertionError = require('chai').AssertionError;
global.requireTarget = function (target) {
return require( path.join(__dirname, '../', target) );
};
global.rewireTarget = function (target) {
return rewire( path.join(__dirname, '../', target) );
};
global.swallow = function (thrower) {
try {
thrower();
} catch (e) {}
};
var sinonChai = require('sinon-chai');
chai.use(sinonChai);
| scull7/filter-sort-paginate | test/common.js | JavaScript | gpl-2.0 | 681 |
/*
* ======== MODULE cc.arduino.Lifecycle ========
*/
var $$c = function() {
const Lifecycle = {};
Lifecycle.Lifecycle = Lifecycle
Lifecycle.$name = 'cc.arduino.Lifecycle';
Lifecycle.pollen$used = 0;
Lifecycle.pollen__reset = new $$Ref('cc_arduino_Lifecycle_pollen__reset__E');
Lifecycle.pollen__ready = new $$Ref('cc_arduino_Lifecycle_pollen__ready__E');
Lifecycle.pollen__shutdown = new $$Ref('cc_arduino_Lifecycle_pollen__shutdown__E');
Lifecycle.pollen__hibernate = new $$Ref('cc_arduino_Lifecycle_pollen__hibernate__E');
Lifecycle.pollen__wake = new $$Ref('cc_arduino_Lifecycle_pollen__wake__E');
Lifecycle.pollen__free = new $$Ref('cc_arduino_Lifecycle_pollen__free__E');
Lifecycle.targetInit = new $$Ref('cc_arduino_Lifecycle_targetInit__I');
Lifecycle.$$hostInit = function() {
var $$text = '';
return $$text;
}
Lifecycle.pollen__uses__ = function() {
}
Lifecycle.$$privateInit = function() {
}
return Lifecycle;
}
var $$u = $$c();
$units['cc.arduino.Lifecycle'] = $$u;
$units.push($$u);
| amaret/pollen.test | test25_out/cc.arduino/Lifecycle/Lifecycle.js | JavaScript | gpl-2.0 | 1,089 |
require(["jquery"], function ($) {
var setUpNewsletterSignUp = function (element) {
var newsletterId = element.attr("data-newsletter-signup");
var emailField = element.find('input[type="email"]');
var submitButton = element.find('input[type="submit"]');
var messageSpan = element.find("*[data-newsletter-signup-message]");
var displayMessage = function (message) {
messageSpan.text(message);
};
var onSuccess = function () {
displayMessage("Successfully signed up");
};
var onFailure = function () {
displayMessage("Hmm, something went wrong, check your e-mail address and try again");
};
var submitRequest = function () {
displayMessage("Signing you up...");
$.ajax({
url: "/newsletter/user-subscribe.aspx",
type: "GET",
data: {
lists: newsletterId,
email: emailField.val()
},
dataType: "jsonp",
success: onSuccess,
error: onFailure
});
};
var handleFormSubmission = function (event) {
event.preventDefault();
submitRequest();
return false;
};
emailField.on("keypress", function (event) {
if (event.which === 13) {
return handleFormSubmission(event);
}
});
submitButton.on("click", handleFormSubmission);
element.show();
};
$("*[data-newsletter-signup]").each(function (index, element) {
setUpNewsletterSignUp($(element));
});
}); | skyinsky/cobaya | windows/doc/004/Building my First SQL Server 2005 CLR_files/newsletter-subscriber.js | JavaScript | gpl-2.0 | 1,755 |
'use strict';
var express = require('express');
var controller = require('./clase.controller');
var auth = require('../../auth/auth.service');
var router = express.Router();
router.get('/', controller.index);
router.get('/:id', controller.show);
router.post('/crearActividad/:id', auth.isAuthenticated(), controller.crearActividad);
router.get('/horario/:id', auth.isAuthenticated(), controller.indexByHorario);
router.get('/horario/aprobados/:id', auth.isAuthenticated(), controller.indexAprobadosByHorario);
router.post('/', auth.hasRole('representante'), controller.create);
router.post('/horario/nuevo', auth.hasRole('representante'), controller.createForNewHorario);
router.put('/:id', auth.hasRole('representante'), controller.update);
router.patch('/:id', auth.hasRole('representante'), controller.update);
router.delete('/:id', controller.destroy);
module.exports = router;
| Irvandoval/reservasfia | server/api/clase/index.js | JavaScript | gpl-2.0 | 887 |
/*{{{
* Author : Kristopher Watts <[email protected]>
* Website : http://webtastic-development.net
* Github : https://github.com/uncledozer
*
}}}*/
/*
* Openweathermap.org : Not yet implemented
*/
// var opw_key = "b81aa5afc75936a3f6d29f911930ad55"
// var city_id = "5301067"
// var Weather_Url = api.openweathermap.org/data/2.5/forecast/city?id=idhere&APPID=
/*
* Quick and dirty time function
* Updates every 250 milleseconds
*/
function time() {
var dt = document.querySelector( '.cur_date' );
var da = document.querySelector( '.cur_day' );
var ho = document.querySelector( '.hours' );
var mi = document.querySelector( '.minutes' );
var se = document.querySelector( '.seconds' );
var d = new Date();
var hours = d.getHours();
var minutes = d.getMinutes();
var seconds = d.getSeconds();
var day = d.getDay();
var date = d.getDate();
var month = d.getMonth();
var year = d.getFullYear();
var days = [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ];
var months = [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ];
var currentDay = d.getDate();
var currentMonth = months[ month ];
var currentWeekday = document.createTextNode( days[day] );
// Leading zeroes for values under 10
function zeros( target ) {
var t = target;
if ( target < 10 )
t = '0' + t;
else
t = t + '';
return t;
}
var currentHour = zeros( hours );
var currentMinute = zeros( minutes );
var currentSecond = zeros( seconds );
var currentHour = document.createTextNode( currentHour );
var currentMinute = document.createTextNode( currentMinute );
var currentSecond = document.createTextNode( currentSecond );
var currentDate = document.createTextNode( currentMonth + ' ' + currentDay + ', ' + year );
// Clear the Clock
ho.innerHTML = "";
mi.innerHTML = "";
se.innerHTML = "";
// Repopulate Clock
ho.appendChild( currentHour );
mi.appendChild( currentMinute );
se.appendChild( currentSecond );
// Clear Date
dt.innerHTML = "";
da.innerHTML = "";
// Repopulate Date
dt.appendChild( currentDate );
da.appendChild( currentWeekday );
}
// Call time() to mitigate firefox's long start time so the clock isn't empty if used as a New Tab Page
time();
// Set the interval to check the time every .25 seconds
var interval = window.setInterval( time, 250 );
// TODO: Local Storage for saving custom links, colors, location, etc.
/*
* Default links: https://Webtastic-Development.com,
* https://Github.com/UncleDozer
*/
// Get Properties or set Defaults
function getProps(){
var defaultLinks = [
Link( "Webtastic-Development", "https://webtastic-development.net" ),
Link( "Github", "https://github.com/uncledozer" ),
];
var links;
var colors;
var fonts;
function getProps( get, set, defaults ) {
var localItem = localStorage.getItem( get );
if ( localItem == null )
set = defaults;
else
set = localItem;
}
getProps( "colors", colors /*, defaultColors */ );
getProps( "links", links, defaultLinks );
getProps( "fonts", fonts /*, defaultFonts */ );
}
function setProps() {
function Link( name, address ) {
this.name = name;
this.address = address;
}
function Color( foreground, background, target ){
this.foreground = foreground;
this.background = background;
this.target = target;
}
function Font( name, weight, style ){
this.name = name;
this.weight = weight;
this.style = style;
}
}
| UncleDozer/new_tab_page | js/main.js | JavaScript | gpl-2.0 | 4,028 |
var selected;
function initMap () {
console.log(ol);
selected = new ol.layer.Vector({
source: getSource(),
style: (function() {
var stroke = new ol.style.Stroke({
color: 'black'
});
var textStroke = new ol.style.Stroke({
color: '#fff',
width: 3
});
var textFill = new ol.style.Fill({
color: '#000'
});
return function(feature, resolution) {
return [new ol.style.Style({
stroke: stroke,
text: new ol.style.Text({
font: '12px Calibri,sans-serif',
text: feature.get('name'),
fill: textFill,
stroke: textStroke
})
})];
};
})()
});
var map = new ol.Map({
target: 'map',
layers: [
new ol.layer.Tile({
source: new ol.source.OSM(),
type: 'base',
title: 'OpenStreetMap'
}),
selected
],
view: new ol.View({
center: ol.proj.fromLonLat([19, 47]),
zoom: 7
})
});
map.on('click', function(evt) {
var lonlat = ol.proj.toLonLat(evt.coordinate);
selected.setSource(getSource(lonlat[1], lonlat[0]));
});
};
function getSource(lat, lon) {
return new ol.source.Vector({
url: 'http://localhost:8000/?lat=' + lat + '&lon=' + lon,
format: new ol.format.GeoJSON()
});
}
| kolesar-andras/area-query | map.js | JavaScript | gpl-2.0 | 1,222 |
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @fileOverview Defines the {@link CKEDITOR.ajax} object, which holds ajax methods for
* data loading.
*/
(function () {
CKEDITOR.plugins.add('ajax', {
requires:[ 'xml' ]
});
/**
* Ajax methods for data loading.
* @namespace
* @example
*/
CKEDITOR.ajax = (function () {
var createXMLHttpRequest = function () {
// In IE, using the native XMLHttpRequest for local files may throw
// "Access is Denied" errors.
if (!CKEDITOR.env.ie || location.protocol != 'file:') {
try {
return new XMLHttpRequest();
} catch (e) {
}
}
try {
return new ActiveXObject('Msxml2.XMLHTTP');
} catch (e) {
}
try {
return new ActiveXObject('Microsoft.XMLHTTP');
} catch (e) {
}
return null;
};
var checkStatus = function (xhr) {
// HTTP Status Codes:
// 2xx : Success
// 304 : Not Modified
// 0 : Returned when running locally (file://)
// 1223 : IE may change 204 to 1223 (see http://dev.jquery.com/ticket/1450)
return ( xhr.readyState == 4 && ( ( xhr.status >= 200 && xhr.status < 300 ) || xhr.status == 304 || xhr.status === 0 || xhr.status == 1223 ) );
};
var getResponseText = function (xhr) {
if (checkStatus(xhr)) {
return xhr.responseText;
}
return null;
};
var getResponseXml = function (xhr) {
if (checkStatus(xhr)) {
var xml = xhr.responseXML;
return new CKEDITOR.xml(xml && xml.firstChild ? xml : xhr.responseText);
}
return null;
};
var load = function (url, callback, getResponseFn) {
var async = !!callback;
var xhr = createXMLHttpRequest();
if (!xhr) {
return null;
}
xhr.open('GET', url, async);
if (async) {
// TODO: perform leak checks on this closure.
/** @ignore */
xhr.onreadystatechange = function () {
if (xhr.readyState == 4) {
callback(getResponseFn(xhr));
xhr = null;
}
};
}
xhr.send(null);
return async ? '' : getResponseFn(xhr);
};
return /** @lends CKEDITOR.ajax */ {
/**
* Loads data from an URL as plain text.
* @param {String} url The URL from which load data.
* @param {Function} [callback] A callback function to be called on
* data load. If not provided, the data will be loaded
* synchronously.
* @returns {String} The loaded data. For asynchronous requests, an
* empty string. For invalid requests, null.
* @example
* // Load data synchronously.
* var data = CKEDITOR.ajax.load( 'somedata.txt' );
* alert( data );
* @example
* // Load data asynchronously.
* var data = CKEDITOR.ajax.load( 'somedata.txt', function( data )
* {
* alert( data );
* } );
*/
load:function (url, callback) {
return load(url, callback, getResponseText);
},
/**
* Loads data from an URL as XML.
* @param {String} url The URL from which load data.
* @param {Function} [callback] A callback function to be called on
* data load. If not provided, the data will be loaded
* synchronously.
* @returns {CKEDITOR.xml} An XML object holding the loaded data. For asynchronous requests, an
* empty string. For invalid requests, null.
* @example
* // Load XML synchronously.
* var xml = CKEDITOR.ajax.loadXml( 'somedata.xml' );
* alert( xml.getInnerXml( '//' ) );
* @example
* // Load XML asynchronously.
* var data = CKEDITOR.ajax.loadXml( 'somedata.xml', function( xml )
* {
* alert( xml.getInnerXml( '//' ) );
* } );
*/
loadXml:function (url, callback) {
return load(url, callback, getResponseXml);
}
};
})();
})();
| xgrommx/svadba | sites/all/modules/ckeditor/ckeditor/_source/plugins/ajax/plugin.js | JavaScript | gpl-2.0 | 4,167 |
'use strict';
angular.module('bmmLibApp')
.directive('bmmContainerMain', ['$timeout', function ($timeout) {
return {
compile : function() {
return {
pre : function(scope, element) {
//Save elements in cache
var minified = false,
mainHeader = $('.bmm-container-header.main'),
playlistNav = $('.bmm-navigator-playlist'),
backendNav = $('.bmm-navigator-backend'),
target = $('.bmm-player-target'),
bmmView = $('.bmm-view');
//PRESET
element.addClass('bmm-container-main');
//Scrollbottom for bmm-view
$(element).bind('scroll', function() {
if($(this).scrollTop() + $(this).innerHeight()>=$(this)[0].scrollHeight) {
$('.bmm-view').trigger('scrollBottom');
}
});
$(element.find('.bmm-view')).bind('scroll', function() {
if($(this).scrollTop() + $(this).innerHeight()>=$(this)[0].scrollHeight) {
$('.bmm-view').trigger('scrollBottom');
}
});
//Scrollbottom for bmm-navigator-backend
$(element).bind('scroll', function() {
if($(this).scrollTop() + $(this).innerHeight()>=$(this)[0].scrollHeight) {
$('.bmm-navigator-backend').trigger('scrollBottomContributors');
}
});
$(element.find('.bmm-navigator-backend')).bind('scroll', function() {
if($(this).scrollTop() + $(this).innerHeight()>=$(this)[0].scrollHeight) {
$('.bmm-navigator-backend').trigger('scrollBottomContributors');
}
});
if(mainHeader.css('display')==='none') {
minified = true;
scope.miniScreen = true;
$timeout(function() {
setNavHeight();
},1500);
}
//On window resize
$(window).resize(function() {
//When height is changed, navigator is fixed or small
if (mainHeader.css('display')==='none'||
playlistNav.hasClass('fixed')||
backendNav.hasClass('fixed')
) {
setNavHeight();
}
//When width is changed and small
if(mainHeader.css('display')==='none'&&!minified) {
minified = true;
scope.miniScreen = true;
setNavHeight();
//When width is changed and big
} else if (minified&&mainHeader.css('display')!=='none') {
minified = false;
scope.miniScreen = false;
playlistNav.css({ height: '' });
backendNav.css({ height: '' });
}
});
$('.bmm-player-target').scroll(function() {
//If not minified
if (mainHeader.css('display')!=='none') {
if ((!playlistNav.hasClass('fixed')||!backendNav.hasClass('fixed'))&&
target.scrollTop()>=mainHeader.height()&&
playlistNav.height()<bmmView.height()) {
playlistNav.addClass('fixed');
backendNav.addClass('fixed');
setNavHeight();
} else if ((playlistNav.hasClass('fixed')||backendNav.hasClass('fixed'))&&
target.scrollTop()<mainHeader.height()) {
playlistNav.removeClass('fixed').css({ height: '' });
backendNav.removeClass('fixed').css({ height: '' });
}
}
});
var setNavHeight = function() {
//Calculate new height
playlistNav.css({
height: target.height()
});
//Calculate new height
backendNav.css({
height: target.height()
});
};
}
};
}
};
}]); | fela98/bmm | app/scripts/directives/bmm_container_main.js | JavaScript | gpl-2.0 | 4,107 |
angular.module('bhima.controllers')
.controller('GradeIndiceModalController', GradeIndiceModalController);
GradeIndiceModalController.$inject = [
'$state', 'StaffingIndiceService',
'NotifyService', '$uibModalInstance', 'ModalService',
];
function GradeIndiceModalController($state, StaffingIndice, Notify, Instance, Modal) {
const vm = this;
vm.close = Instance.close;
vm.submit = submit;
vm.indice = {};
vm.loading = false;
const columns = [
{
field : 'grade_text',
displayName : 'FORM.LABELS.LEVEL_OF_STUDY',
headerCellFilter : 'translate',
},
{
field : 'value',
displayName : 'FORM.LABELS.VALUE',
headerCellFilter : 'translate',
cellClass : 'text-right',
type : 'number',
},
{
field : 'actions',
enableFiltering : false,
width : 40,
displayName : '',
headerCellFilter : 'translate',
cellTemplate : 'modules/payroll/staffing_indice/templates/gradeIndice.action.cell.html',
}];
vm.gridOptions = {
appScopeProvider : vm,
enableColumnMenus : false,
columnDefs : columns,
enableSorting : true,
data : [],
fastWatch : true,
flatEntityAccess : true,
onRegisterApi : (gridApi) => {
vm.gridApi = gridApi;
},
};
// custom filter grade_uuid - assign the value to the searchQueries object
vm.onSelectGrade = function onSelectGrade(grade) {
vm.indice.grade_uuid = grade.uuid;
};
vm.onInputTextChange = (key, value) => {
vm.indice[key] = value;
};
function loadGradeIndices() {
vm.loading = true;
StaffingIndice.gradeIndice.read().then(indices => {
vm.gridOptions.data = indices;
})
.catch(Notify.handleError)
.finally(() => {
vm.loading = false;
});
}
function submit(form) {
if (form.$invalid) {
Notify.danger('FORM.ERRORS.HAS_ERRORS');
return false;
}
return StaffingIndice.gradeIndice.create(vm.indice)
.then(() => {
Notify.success('FORM.INFO.OPERATION_SUCCESS');
loadGradeIndices();
reset(form);
})
.catch(Notify.handleError);
}
function reset(form) {
form.$setPristine();
form.$setUntouched();
vm.indice = {};
}
vm.remove = function remove(uuid) {
const message = 'FORM.DIALOGS.CONFIRM_DELETE';
Modal.confirm(message)
.then(confirmResponse => {
if (!confirmResponse) {
return;
}
StaffingIndice.gradeIndice.delete(uuid)
.then(() => {
Notify.success('FORM.INFO.DELETE_SUCCESS');
loadGradeIndices();
})
.catch(Notify.handleError);
});
};
loadGradeIndices();
}
| IMA-WorldHealth/bhima | client/src/modules/payroll/staffing_indice/modal/gradeIndiceModal.js | JavaScript | gpl-2.0 | 2,702 |
(function(){
var websites = angular.module('websites', []);
jQuery(document).ready(function () {
angular.bootstrap(document.getElementById('websites-app'), ['websites']);
});
websites.controller('WebsitesController', function($scope, $http) {
//$http.get('http://localhost/json/websites')
$http.get('http://webfact7.webfact.corproot.net/json/websites')
.success(function(result) {
$scope.websites = (function() {
return result.nodes;
})();
});
});
})();
| Boran/webfact | js/app.js | JavaScript | gpl-2.0 | 517 |
/**
* @file
* A JavaScript file for the contact form.
*/
(function ($) {
'use strict';
// Contact form.
$('.contact-form').each(function () {
var $contact_form = $(this);
var $contact_button = $contact_form.find('.form-submit');
var contact_action = '/php/contact.php';
// Display the hidden form.
$contact_form.removeClass('hidden');
// Wait for a mouse to move, indicating they are human.
$('body').mousemove(function () {
// Unlock the form.
$contact_form.attr('action', contact_action);
$contact_button.attr('disabled', false);
});
// Wait for a touch move event, indicating that they are human.
$('body').on('touchmove', function () {
// Unlock the form.
$contact_form.attr('action', contact_action);
$contact_button.attr('disabled', false);
});
// A tab or enter key pressed can also indicate they are human.
$('body').keydown(function (e) {
if ((e.keyCode === 9) || (e.keyCode === 13)) {
// Unlock the form.
$contact_form.attr('action', contact_action);
$contact_button.attr('disabled', false);
}
});
// Mark the form as submitted.
$contact_button.click(function () {
$contact_form.addClass('js-submitted');
});
// Display messages.
if (location.search.substring(1) !== '') {
switch (location.search.substring(1)) {
case 'submitted':
$('.contact-submitted').removeClass('hidden');
break;
case 'error':
$('.contact-error').removeClass('hidden');
break;
}
}
});
})(jQuery);
| frjo/hugo-theme-zen | assets/js/jq_versions/contact.js | JavaScript | gpl-2.0 | 1,627 |
/**
* Replace invalid characters from a string to create an html-ready ID
*
* @param {string} id A string that may contain invalid characters for the HTML ID attribute
* @param {string} [replacement=_] The string to replace invalid characters with; "_" by default
* @return {string} Information about the parameter schema
*/
export default function createHtmlReadyId(id, replacement = "_") {
return id.replace(/[^\w-]/g, replacement)
}
| egbot/Symbiota | api/vendor/swagger-api/swagger-ui/src/helpers/create-html-ready-id.js | JavaScript | gpl-2.0 | 444 |
define([
'hybridatv/core/class',
'hybridatv/helpers/polyfil',
], function(Class, polyfil) {
'use strict';
return Class.extend({
init: function(target) {
this._target = target;
this._listeners = {};
},
on: function(evtName, handler,
preventOverwrite) {
var fn = this._listeners[evtName];
var newFn;
if (typeof fn !== 'undefined') {
if (preventOverwrite) { return this; }
this.off(evtName);
newFn = function(evt) {
fn(evt);
handler(evt);
};
this._listen(evtName, newFn);
} else {
this._listen(evtName, handler);
}
return this;
},
_listen: function(evtName, handler) {
this._target.addEventListener(evtName, handler);
this._listeners[evtName] = handler;
},
off: function(evtName) {
var fn = this._listeners[evtName];
if (typeof fn === 'function') {
this._target.removeEventListener(evtName, fn);
}
delete this._listeners[evtName];
return this;
},
trigger: function(evtName, data, target) {
var evt;
target = target || this._target;
evt = polyfil.customEvent(evtName, data);
target.dispatchEvent(evt);
return this;
},
destroy: function() {
var prop;
for (prop in this._listeners) {
this.off(prop);
}
},
});
});
| trimata/hybridatv | src/core/base.js | JavaScript | gpl-2.0 | 1,410 |
var searchData=
[
['visualaes',['VisualAES',['../md__r_e_a_d_m_e.html',1,'']]],
['visualization_5fchanged',['visualization_changed',['../classsimplegui_1_1_main_scene.html#aa53b6cd3c1c56ced6a8fe4b98602314e',1,'simplegui::MainScene']]]
];
| amon41amarth/VisualAES | Documentation/html/search/all_76.js | JavaScript | gpl-2.0 | 242 |
/**
* Tundra Support
* Provide non-core functionality, such as the clock and tooltips.
*
* @author Chris Atkin
* @link http://chrisatk.in
* @email contact {at} chrisatk {dot} com
*
* @file tundra.support.js
* @version 1.0
* @date 10/09/2011
*
* Copyright (c) 2011 Chris Atkin. All rights reserved
*/
// Rollback for browsers without a console
// I'm looking at you, Firefox (when Firebug isn't installed)
if(!window.console)
{
window.console = {};
console.log = function() {};
}
/* Facetip
---------------------------------- */
var FaceTip = new Class({
options: {
attr: 'tip',
delay: 0
},
initialize: function(els, options) {
Object.append(this.options, options || {});
els.addEvents({
'mouseenter': function(e) {
this.enter($(e.target));
}.bind(this),
'mouseleave': function() {
this.leave();
}.bind(this)
});
},
enter: function(element) {
this.on = true;
this.timer = (function() {
if (!this.on) {
clearTimeout(this.timer);
return;
}
var pos = element.getCoordinates();
var tip = new Element('div', {
'class': 'facetip',
styles: {
position: 'absolute',
left: pos.left
}
});
var arrow = new Element('div', {
'class': 'facetip-arrow-down'
});
tip.set('text', element.getProperty(this.options.attr));
arrow.inject(tip);
if (tip.get('text') !== "") {
tip.inject($$('body')[0]);
}
var tipHeight = tip.getSize().y;
arrow.setStyle('top', tipHeight);
tip.setStyle('top', pos.top - tipHeight - parseInt(arrow.getStyle('border-top')));
}).bind(this).delay(this.options.delay);
},
leave: function() {
if (this.on) {
$$('.facetip').dispose();
}
this.on = false;
clearTimeout(this.timer);
}
});
var Notimoo = new Class({
/**
* Notification elements list.
*/
elements: [],
/**
* Needed Mootools functionality
*/
Implements: [Options, Events],
/**
* Used to properly work with the scroll relocation transition
*/
scrollTimeOut: null,
/**
* Options to configure the notification manager.
* @param String parent -> parent element where notifications are to be inserted (defaults to 'body' tag)
* @param Number height -> height of the notification DOM element (in pixels -defaults to 50-)
* @param Number width -> width of the notification DOM element (in pixels -defaults to 300-)
* @param Number visibleTime -> time the notification is displayed (in miliseconds -defaults to 5000-)
* @param String locationVType -> whether you want the notifications to be shown on the top or the bottom of the parent element (defaults to 'top')
* @param String locationHType -> whether you want the notification to be shown at the left or right of the parent element (defaults to 'right')
* @param Number locationVBase -> vertical base position for the notifications (in pixels -defaults to 10-)
* @param Number locationHBase -> horizontal base position for the notifications (in pixels -defaults to 10-)
* @param Number notificationsMargin -> margin between notifications (in pixels -defaults to 5-)
* @param Number opacityTransitionTime -> duration for notification opacity transition (in miliseconds -defaults to 750-)
* @param Number closeRelocationTransitionTime -> duration for notification relocation transition when one of them is close (in miliseconds -defaults to 750-)
* @param Number scrollRelocationTransitionTime -> duration for notification relocation transition when parent scroll is moved (in miliseconds -defaults to 250-)
* @param Number notificationOpacity -> opacity used when the notification is displayed (defaults to 0.95)
* @param Function onShow -> callback to be executed when the notification is displayed. The notification element is passed as a parameter.
* @param Function onClose -> callback to be executed when the notification id closed. The notification element is passed as a parameter.
*/
options: {
parent: '', // This value needs to be set into the initializer
height: 50,
width: 300,
visibleTime: 5000, // notifications are visible for 5 seconds by default
locationVType: 'top',
locationHType: 'right',
locationVBase: 10,
locationHBase: 10,
notificationsMargin: 5,
opacityTransitionTime : 750,
closeRelocationTransitionTime: 750,
scrollRelocationTransitionTime: 500,
notificationOpacity : 0.95 /*,
onShow: $empty,
onClose: $empty */
},
/**
* Initilize instance.
* @param Hash options -> (see code above)
*/
initialize: function(options) {
this.options.parent = $(document.body);
if (options) {
if (options.parent) options.parent = $(options.parent);
this.setOptions(options);
}
var manager = this;
// Track scroll in parent element
this.options.parent.addEvent('scroll', function() {
$clear(this.scrollTimeOut);
this.scrollTimeOut = (function() { manager._relocateActiveNotifications(manager.TYPE_RELOCATE_SCROLL) }).delay(200);
}, this);
window.addEvent('scroll', function() {
$clear(manager.scrollTimeOut);
manager.scrollTimeOut = (function() { manager._relocateActiveNotifications(manager.TYPE_RELOCATE_SCROLL) }).delay(200);
});
// Insert default element into array
this.elements.push(
this.createNotificationElement(this.options)
);
},
/**
* Creates and initializes an element to show the notification
*/
createNotificationElement: function() {
var el = new Element('div', {
'class': 'notimoo'
});
el.setStyle(this.options.locationVType, this.options.locationVBase);
el.setStyle(this.options.locationHType, this.options.locationHBase);
el.adopt(new Element('span', { 'class': 'title' }));
el.adopt(new Element('div', { 'class': 'message' }));
el.setStyle('width', this.options.width);
el.setStyle('height', this.options.height);
// Element default tween instance is used to handle opacity
el.store('working', false);
el.set('tween', {
link: 'chain',
duration: this.options.opacityTransitionTime
});
el.set('opacity', 0);
// This tween instance is used to move the notification when another one is closed
var fx1 = new Fx.Tween(el, {
property: this.options.locationVType,
link: 'chain',
duration: this.options.closeRelocationTransitionTime
});
el.store('baseTween', fx1);
// This tween instance is used to move the notification when scroll is moved
var fx2 = new Fx.Tween(el, {
property: this.options.locationVType,
link: 'chain',
duration: this.options.scrollRelocationTransitionTime
});
el.store('scrollTween', fx2);
// Close the notification when the user click inside
el.addEvent('click', function(event) {
event.stop();
this.close(el);
}.bind(this));
return el;
},
/**
* Function to actually show a notification.
* @param String title (required) -> Title for the notification
* @param String message (required) -> Message for the notification
* @param booleam sticky (optional) -> Whether the notification won't be removed until user interaction (defaults to false)
* @param int visibleTime (optional) -> Time for the notification to be displayed (in milliseconds). If this isn't provided, the global one will be used.
* @param int width (optional) -> Width fot the notification (in pixels). If this isn't provided, the global one will be used.
* @param String customClass (optional) -> Custom class you want to apply to this notification. (It can be a list of classes separated by a blank space)
*/
show: function(options) {
var manager = this;
// Get the base for the notification
var nextBase = this._applyScrollPosition(this.options.locationVBase);
var el = this.elements.filter(function(el) {
var w = el.retrieve('working');
if (w) {
nextBase = el.getStyle(this.options.locationVType).toInt() + el.getSize().y + this.options.notificationsMargin;
}
return !w;
}, this).getLast();
// Create element if there is no available one
if (!el) {
el = this.createNotificationElement();
this.elements.push(el);
}
// Set base and 'working' flag
el.setStyle(this.options.locationVType, nextBase);
el.store('working', true);
// Check if a custom width has been provided
if (options.width) el.setStyle('width', options.width);
// Set notification content
if (options.title) {
el.getElement('span.title').set('html', options.title);
}
el.getElement('div.message').set('html', options.message);
// Add custom classes
if (options.customClass) el.addClass(options.customClass);
// Once the notification is populated, we check to see if there is any link inside so we can
// configure it in order not to close the notification when it's clicked
el.getElements('a').addEvent('click', function(event) {
event.stopPropagation();
});
// Insert the element into the DOM
this.options.parent.adopt(el);
// This must be done after the element is inserted into DOM. Previously (on Lost!) the element does not have coordinates (obviously)
this._checkSize(el);
// Show the element with a lot of style
el.get('tween').start('opacity', this.options.notificationOpacity).chain(function() {
// Set close notification with options visibleTime delay
if ((options.sticky) ? !options.sticky : true) {
(function() { manager.close(el); } ).delay((options.visibleTime) ? options.visibleTime : manager.options.visibleTime, manager);
}
// Fire callback
manager.fireEvent('show', el);
});
},
/**
* Function to close the notification.
* It also deals with moving other still visible notifications.
* @param Element element -> element to be removed
*/
close: function(element) {
// Hide and reset notification. Destroy it when it's not the last one.
var manager = this;
var nots = manager.elements;
element.get('tween').start('opacity', 0).chain(function() {
if (nots.length > 1) {
nots.elements = nots.erase(element);
element.destroy();
}
manager._resetNotificationElement(element);
// If there are more notifications on screen, move them!
manager._relocateActiveNotifications(manager.TYPE_RELOCATE_CLOSE);
manager.fireEvent('close', element);
});
},
/**
* Function to relocate active notifications when needed
* (notification closed or scroll moved).
* @param int sourceEvent -> the event that cause the movement (see events at the bottom)
* 1.- notification closed
* 2.- scroll moved
*/
_relocateActiveNotifications: function(sourceEvent) {
var base = this._applyScrollPosition(this.options.locationVBase);
for (var index = 0; index < this.elements.length; index++) {
var el = this.elements[index];
if (el.retrieve('working')) {
if (this.TYPE_RELOCATE_CLOSE == sourceEvent) {
el.retrieve('baseTween').start(base);
} else {
el.retrieve('scrollTween').start(base);
}
base += el.getSize().y + this.options.notificationsMargin;
}
}
},
/**
* Function to check if the size of the notification element has space enough
* to show the message.
* In case it hasn't, the element is resized.
*/
_checkSize: function(element) {
var notificationElHeight = element.getStyle('height').toInt();
var titleHeight = element.getElement('span.title').getSize().y;
var messageHeight = element.getElement('div.message').getSize().y;
if (messageHeight > (notificationElHeight - titleHeight)) {
element.setStyle('height', notificationElHeight + (messageHeight - (notificationElHeight - titleHeight)));
}
},
/**
* Function used to reset the attributes of a used element to the original state.
* It only resets the attributes that could be changed before.
*/
_resetNotificationElement: function(element) {
element.store('working', false);
element.setStyle(this.options.locationVType, this.options.locationVBase);
element.setStyle('height', this.options.height);
element.setStyle('width', this.options.width);
},
/**
* Helper function to apply scroll location to element base.
*/
_applyScrollPosition: function(base) {
if (this.options.locationVType == 'top') {
base +=this.options.parent.getScroll().y;
} else {
base -=this.options.parent.getScroll().y;
}
return base;
},
/*
* Constants for transitions
*/
TYPE_RELOCATE_CLOSE: 1,
TYPE_RELOCATE_SCROLL: 2
});
/* Clock
---------------------------------- */
function update_clock(element)
{
// Get the element to update and create an instance of Date
var d = new Date();
// Get the current hours, minutes and seconds
var hours = d.getHours(), min = d.getMinutes(), sec = d.getSeconds();
var am_pm = hours < 12 ? 'AM' : 'PM';
// Convert to 12-hour time
hours = (hours > 12) ? hours - 12 : hours;
hours = (hours == 0) ? 12 : hours;
// Helper function to add a proceeding 0
var format = function(s)
{
return (s < 10 ? '0' : '') + s;
}
// Set the contents of element to the time
$(element).set('html', 'The time is <strong>' + hours + ':' + format(min) + ':' + format(sec) + ' ' + am_pm + '</strong>');
// Set a timeout so the clock updates every second
setTimeout(function() {
update_clock(element);
}, 1000);
}
/* End of file tundra.support.js */
/* Location: ./assets/scripts/tundra.support.js */ | chrisatkin/tundra | assets/scripts/tundra.support.js | JavaScript | gpl-2.0 | 14,747 |
define(["head-on"], function($h){
var sounder = {
playingsound:[],
pausedsounds:[],
sounds:{},
load: function(name, src){
}
}
// $h.events.listen("pause", function(){
// sounder.pauseAll();
// })
// $h.events.listen("unpause", function(){
// sounder.playAll();
// })
return sounder;
}); | powerc9000/bullet-dodge2 | js/soundManager.js | JavaScript | gpl-2.0 | 308 |
(function ($) {
function getCsrfTokenForWarehouse(callback) {
$
.get(Drupal.url('rest/session/token'))
.done(function (data) {
var csrfToken = data;
callback(csrfToken);
});
}
// When user hits enter.
$('#warehouse-checkin-product-scan').keypress(function (e) {
var key = e.which;
if(key == 13) // the enter key code
{
$('#warehouse-checkin-product-status-wrapper').html('Processing product...');
var container = document.getElementById('warehouse-container-id').value;
var container_nid = document.getElementById('warehouse-container-nid').value;
//check for scanning same product
if(this.value.length){
$('#spinner-holder').removeClass( "hidden" );
process_product(this.value,container, container_nid, false);
}else{
$('#warehouse-checkin-product-status-wrapper').html('Please enter product value.');
}
}
});
/*
* Process to warehouse rest resource.
*/
function wareHouseScanProduct(csrfToken, node, init, onload) {
$('#warehouse-checkin-product-status-wrapper').html('Checking server ...');
$.ajax({
url: Drupal.url('warehouse/operation/' + init + '/post?_format=json'),
method: 'POST',
headers: {
'Content-Type': 'application/hal+json',
'X-CSRF-Token': csrfToken
},
data: JSON.stringify(node),
success: function (response) {
updateProductInformationBlock(response);
$('#warehouse-checkin-product-status-wrapper').html('Processed successfully.');
console.log(response);
if(!onload){
if(response.duplicate){
swal({
title: 'Duplicate Product',
text: 'Duplicate product, already found in another container.',
type: 'warning', //error
showCancelButton: false,
confirmButtonColor: "#DD6B55",
confirmButtonText: "OK",
closeOnConfirm: true,
timer: 5000
});
}
if(response.already_scanned){
swal({
title: 'Product already scanned',
text: 'This product already scanned in this container.',
type: 'warning', //error
showCancelButton: false,
confirmButtonColor: "#DD6B55",
confirmButtonText: "OK",
closeOnConfirm: true,
timer: 5000
});
}
setTimeout(function(){
$('#warehouse-checkin-product-status-wrapper').html(' ');
}, 3300);
}
$('#spinner-holder').addClass( "hidden" );
},
error: function(){
$('#spinner-holder').addClass( "hidden" );
alert('Failed! **');
setTimeout(function(){
$('#warehouse-checkin-product-status-wrapper').html(' ');
}, 3300);
}
});
}
/*
* Process product in the container.
*/
function process_product(product,container, container_nid, onload){
var data = {
_links: {
type: {
href: Drupal.url.toAbsolute(drupalSettings.path.baseUrl + 'rest/type/node/test')
}
},
"body": [
{
"value": {
"product": product,
"container": container,
"container_nid": container_nid
},
"format": null,
"summary": null
}
],
"type":[{"target_id":"test"}]
};
getCsrfTokenForWarehouse(function (csrfToken) {
wareHouseScanProduct(csrfToken, data, 'import', onload);
});
}
function onLoadProductBlock(){
var container = document.getElementById('warehouse-container-id').value;
var container_nid = document.getElementById('warehouse-container-nid').value;
}
function updateProductInformationBlock(data){
//document.getElementById('dd-identifier').innerHTML = data.product.concept;
$('#dd-identifier').html(data.product.identifier);
$('#dd-description').html(data.product.description);
$('#dd-colorvariant').html(data.product.colorvariant);
$('#dd-gender').html(data.product.gender);
$('#dd-color').html(data.product.color);
$('#dd-size').html(data.product.size);
$('#dd-styleno').html(data.product.styleno);
$('#pid').val(data.product.pid);
var a = data.images;
document.getElementById('filmroll').innerHTML = '';
var tag = [];
//console.log(a);
if(a){
for(var i in a){
if ($('#warpper-img-'+ i).length == 0) {
// div not found,
attachImages(a[i],i);
}
}
}
}
$("#container-finish").click(function () {
var container_nid = document.getElementById('warehouse-container-nid').value;
swal({
title: "Confirm Finish",
text: "Are you sure you want to finish this container?",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Finish It",
closeOnConfirm: false
},function () {
window.location = Drupal.url.toAbsolute(drupalSettings.path.baseUrl + 'warehouse/checkout/' + container_nid);
});
// swal({
// title: 'jQuery HTML example',
// html: $('<input type="text">')
// .addClass('some-class')
// .text('jQuery is everywhere.') +
// $('<input type="text">')
// .addClass('some-class1')
// .text('jQuery is everywhere1.')
// })
});
function attachImages(img,fid) {
if ($('#warpper-img-'+ fid).length > 0) {
return;
}
var container, inputs, index;
// Get the container element
container = document.getElementById('filmroll');
// Find its child `input` elements
//inputs = container.getElementsByTagName('input');
inputs = container.getElementsByClassName("form-checkbox");
var seq = inputs.length + 1;
var ul = document.getElementById('filmroll');
var li = document.createElement("div");
//li.appendChild(document.createTextNode(100));
li.setAttribute("class", "bulkviewfiles imagefile ui-sortable-handle"); // added line
li.setAttribute('id','warpper-img-' + fid);
var block = '';
if(img.tag==1){
block += '<div class="ribbon" id="ribboncontainer"><span data-id="'+fid+'" class="for-tag tag" id="seq-' + fid +'" name="' + seq +'"><i class="fa fa-lg fa-barcode txt-color-white"></i></span></div>';
} else{
block += '<div class="ribbon" id="ribboncontainer"><span class="for-tag" id="seq-' + fid +'" name="' + seq +'">' + seq +'</span></div>';
}
block += '<div class="scancontainer"><div class="hovereffect">';
block += '<div class="hidden" id="src-'+fid+'" data-src="'+img.uri+'"></div>'
block += '<img src="'+ img.uri +'" class="scanpicture" data-imageid="'+ fid +'" >';
block += '<div class="overlay"><input type="checkbox" class="form-checkbox" id="del-img-'+ fid +'" hidden value="'+ fid +'"><a class="info select-delete" data-id="'+ fid +'" data-click="no">Select image</a></div>';
block += '</div>';
block += '<div class="file-name">';
block += '<div id="tag-seq-img-'+fid+'" type="hidden"></div>';
block += '<div class="row">';
block += '<div class="col col-sm-12"><span id= "warehouse-tags-container-'+fid+'" data-value="'+fid+'">';
block += '<a class="col-sm-4 text-info " id= "warehouse-fullview-'+fid+'" href= "/file/'+fid+'" target="_blank"><i class="fa fa-lg fa-fw fa-search"></i></a>';
block += '<a class="col-sm-4 text-info warehouse-tag" id= "warehouse-tag-'+fid+'"><i class="fa fa-lg fa-fw fa-barcode"></i></a>';
block += '<a class="col-sm-4 text-info" id= "warehouse-delete-'+fid+'"><i class="fa fa-lg fa-fw fa-trash"></i></a>';
block += '</span></div>';
block += '</div>';
block += '</div>';
block += '</div>';
block += '<div class="studio-img-weight"><input type="hidden" value="'+fid+'"></div>';
block += '</div>';
li.innerHTML = block;
ul.appendChild(li);
var tag = document.getElementById('warehouse-tag-'+fid);
tag.addEventListener("click", function(){
// tag image todo:
update_image(1,fid, 0); //warehouse-delete-2342
}, false);
var del = document.getElementById('warehouse-delete-'+fid);
del.addEventListener("click", function(){
getCsrfTokenForWarehouse(function (csrfToken) {
if (fid) {
swal({
title: "Confirm delete image",
text: "Are you sure you want to delete image from this container?",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Delete It",
closeOnConfirm: false
},function () {
deleteImage(csrfToken, fid);
});
}else{
alert('No image found, pls refresh the page.');
}
});
}, false);
}
$( document ).ready(function() {
var w = $('#warehouse-checkin-product-scan');
var wx = w.val();
var container = document.getElementById('warehouse-container-id').value;
var container_nid = document.getElementById('warehouse-container-nid').value;
//check for scanning same product
if(wx.length){
process_product(wx,container, container_nid, true);
}
});
/*
* tag value 1 means tag
* tag value 0 means undo tag
*
*/
function update_image(tag,fidinput, ref) {
var tags_lenght = $('.tag').length;
var is_tagged = $('#warpper-img-'+ fidinput +' .tag').length;
if(is_tagged >=1){
swal({
title: "Tag Image",
text: "This image already tagged!, Delete it to tag a new image.",
type: "error",
showCancelButton: false,
confirmButtonColor: "#DD6B55",
confirmButtonText: "OK",
closeOnConfirm: true
});
return;
}
if(tags_lenght >=1){
swal({
title: "Tag Image",
text: "Tag image already found, please delete them to tag a new image.",
type: "error",
showCancelButton: false,
confirmButtonColor: "#DD6B55",
confirmButtonText: "OK",
closeOnConfirm: true
});
return;
}
// todo get file name here
var fid = fidinput;
// var identifier = document.getElementById('edit-identifier-hidden').value;
var filename = 'Tag.jpg';
if(ref){
filename = 'Ref.jpg';
}
var img = {
_links: {
type: {
href: Drupal.url.toAbsolute(drupalSettings.path.baseUrl + 'rest/type/file/image')
}
},
field_tag: {
value: tag
},
field_reference: [
{
"value": ref
}
],
filename: {
value: filename
}
};
getCsrfTokenForWarehouse(function (csrfToken) {
if (fid) {
patchImageTag(csrfToken, img, fid, tag);
}else{
alert('No product found, pls refresh the page.');
}
});
}
function patchImageTag(csrfToken, file, fid, tag) {
//document.getElementById('msg-up').innerHTML = 'Tagging product ....';
$.ajax({
url: Drupal.url('file/' + fid + '?_format=hal_json'),
method: 'PATCH',
headers: {
'Content-Type': 'application/hal+json',
'X-CSRF-Token': csrfToken
},
data: JSON.stringify(file),
success: function (file) {
if(tag){
//console.log(node);
//document.getElementById('msg-up').innerHTML = 'Image Tagged!';
swal({
title: "Tag Shot",
text: "Tag shot has been selected",
type: "success",
showConfirmButton: false,
confirmButtonColor: "#DD6B55",
confirmButtonText: "OK",
closeOnConfirm: true,
timer:1500
});
var r = '<i class="fa fa-lg fa-barcode txt-color-white"></i>';
document.getElementById('seq-' + fid).className += ' tag';
document.getElementById('seq-'+ fid).innerHTML = r;
//todo
//updateTagClasses(fid, 'tag');
}else{
swal({
title: "Undo Tag Shot",
text: "Tag shot has been cancelled",
type: "success",
showConfirmButton: false,
confirmButtonColor: "#DD6B55",
confirmButtonText: "OK",
closeOnConfirm: true,
timer:1500
});
//updateTagClasses(fid, 'untag');
//updateSequence();
$('#seq-'+fid).removeClass('tag');
}
},
error: function(){
swal({
title: "Tag Shot",
text: "There was an error, please try again.",
type: "error",
showCancelButton: false,
confirmButtonColor: "#DD6B55",
confirmButtonText: "OK",
closeOnConfirm: true
});
}
});
}
function deleteImage(csrfToken, fid) {
//document.getElementById('msg-up').innerHTML = 'Tagging product ....';
$.ajax({
url: Drupal.url('file/' + fid + '?_format=hal_json'),
method: 'DELETE',
headers: {
'Content-Type': 'application/hal+json',
'X-CSRF-Token': csrfToken
},
//data: JSON.stringify(file),
success: function (file) {
//delete image
document.getElementById("warpper-img-"+fid).remove();
swal({
title: "Deleted Image",
text: "Image deleted successfully!",
type: "success",
showConfirmButton: false,
confirmButtonColor: "#DD6B55",
confirmButtonText: "OK",
closeOnConfirm: true,
timer:1500
});
},
error: function(){
swal({
title: "Error to delete Image",
text: "There was an error to delete image, please try again.",
type: "error",
showCancelButton: false,
confirmButtonColor: "#DD6B55",
confirmButtonText: "OK",
closeOnConfirm: true
});
}
});
}
})(jQuery);
| asharnb/dawn | modules/custom/warehouse_checkin/js/warehouse-checkin.js | JavaScript | gpl-2.0 | 16,877 |
/**
* @package Gravity PDF
* @copyright Copyright (c) 2021, Blue Liquid Designs
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
* @since 5.0
*/
/*
* A simple function that forces a promise to resolve, returning an object that indicates the actual promise status
* and the underlying object returned from the original promise.
*
* See https://www.npmjs.com/package/promise-reflect for usage
*/
export default (promise) => {
return promise
.then(data => {
return { data: data, status: 'resolved' }
})
.catch(error => {
return { error: error, status: 'rejected' }
})
}
| GravityPDF/gravity-forms-pdf-extended | src/assets/js/react/utilities/promiseReflect.js | JavaScript | gpl-2.0 | 648 |
/*
SortTable
version 2
7th April 2007
Stuart Langridge, http://www.kryogenix.org/code/browser/sorttable/
Instructions:
Download this file
Add <script src="sorttable.js"></script> to your HTML
Add class="sortable" to any table you'd like to make sortable
Click on the headers to sort
Thanks to many, many people for contributions and suggestions.
Licenced as X11: http://www.kryogenix.org/code/browser/licence.html
This basically means: do what you want with it.
*/
var stIsIE = /*@cc_on!@*/false;
sorttable = {
init: function() {
// quit if this function has already been called
if (arguments.callee.done) return;
// flag this function so we don't do the same thing twice
arguments.callee.done = true;
// kill the timer
if (_timer) clearInterval(_timer);
if (!document.createElement || !document.getElementsByTagName) return;
sorttable.DATE_RE = /^(\d\d?)[\/\.-](\d\d?)[\/\.-]((\d\d)?\d\d)$/;
forEach(document.getElementsByTagName('table'), function(table) {
if (table.className.search(/\bmoduletable\b/) != -1) {
sorttable.makeSortable(table);
}
});
},
makeSortable: function(table) {
if (table.getElementsByTagName('thead').length == 0) {
// table doesn't have a tHead. Since it should have, create one and
// put the first table row in it.
the = document.createElement('thead');
the.appendChild(table.rows[0]);
table.insertBefore(the,table.firstChild);
}
// Safari doesn't support table.tHead, sigh
if (table.tHead == null) table.tHead = table.getElementsByTagName('thead')[0];
if (table.tHead.rows.length != 1) return; // can't cope with two header rows
// Sorttable v1 put rows with a class of "sortbottom" at the bottom (as
// "total" rows, for example). This is B&R, since what you're supposed
// to do is put them in a tfoot. So, if there are sortbottom rows,
// for backwards compatibility, move them to tfoot (creating it if needed).
sortbottomrows = [];
for (var i=0; i<table.rows.length; i++) {
if (table.rows[i].className.search(/\bsortbottom\b/) != -1) {
sortbottomrows[sortbottomrows.length] = table.rows[i];
}
}
if (sortbottomrows) {
if (table.tFoot == null) {
// table doesn't have a tfoot. Create one.
tfo = document.createElement('tfoot');
table.appendChild(tfo);
}
for (var i=0; i<sortbottomrows.length; i++) {
tfo.appendChild(sortbottomrows[i]);
}
delete sortbottomrows;
}
// work through each column and calculate its type
headrow = table.tHead.rows[0].cells;
for (var i=0; i<headrow.length; i++) {
// manually override the type with a sorttable_type attribute
if (!headrow[i].className.match(/\bsorttable_nosort\b/)) { // skip this col
mtch = headrow[i].className.match(/\bsorttable_([a-z0-9]+)\b/);
if (mtch) { override = mtch[1]; }
if (mtch && typeof sorttable["sort_"+override] == 'function') {
headrow[i].sorttable_sortfunction = sorttable["sort_"+override];
} else {
headrow[i].sorttable_sortfunction = sorttable.guessType(table,i);
}
// make it clickable to sort
headrow[i].sorttable_columnindex = i;
headrow[i].sorttable_tbody = table.tBodies[0];
dean_addEvent(headrow[i],"click", function(e) {
if (this.className.search(/\bsorttable_sorted\b/) != -1) {
// if we're already sorted by this column, just
// reverse the table, which is quicker
sorttable.reverse(this.sorttable_tbody);
this.className = this.className.replace('sorttable_sorted',
'sorttable_sorted_reverse');
this.removeChild(document.getElementById('sorttable_sortfwdind'));
sortrevind = document.createElement('span');
sortrevind.id = "sorttable_sortrevind";
sortrevind.innerHTML = stIsIE ? ' <font face="webdings">5</font>' : ' ▴';
this.appendChild(sortrevind);
return;
}
if (this.className.search(/\bsorttable_sorted_reverse\b/) != -1) {
// if we're already sorted by this column in reverse, just
// re-reverse the table, which is quicker
sorttable.reverse(this.sorttable_tbody);
this.className = this.className.replace('sorttable_sorted_reverse',
'sorttable_sorted');
this.removeChild(document.getElementById('sorttable_sortrevind'));
sortfwdind = document.createElement('span');
sortfwdind.id = "sorttable_sortfwdind";
sortfwdind.innerHTML = stIsIE ? ' <font face="webdings">6</font>' : ' ▾';
this.appendChild(sortfwdind);
return;
}
// remove sorttable_sorted classes
theadrow = this.parentNode;
forEach(theadrow.childNodes, function(cell) {
if (cell.nodeType == 1) { // an element
cell.className = cell.className.replace('sorttable_sorted_reverse','');
cell.className = cell.className.replace('sorttable_sorted','');
}
});
sortfwdind = document.getElementById('sorttable_sortfwdind');
if (sortfwdind) { sortfwdind.parentNode.removeChild(sortfwdind); }
sortrevind = document.getElementById('sorttable_sortrevind');
if (sortrevind) { sortrevind.parentNode.removeChild(sortrevind); }
this.className += ' sorttable_sorted';
sortfwdind = document.createElement('span');
sortfwdind.id = "sorttable_sortfwdind";
sortfwdind.innerHTML = stIsIE ? ' <font face="webdings">6</font>' : ' ▾';
this.appendChild(sortfwdind);
// build an array to sort. This is a Schwartzian transform thing,
// i.e., we "decorate" each row with the actual sort key,
// sort based on the sort keys, and then put the rows back in order
// which is a lot faster because you only do getInnerText once per row
row_array = [];
col = this.sorttable_columnindex;
rows = this.sorttable_tbody.rows;
for (var j=0; j<rows.length; j++) {
row_array[row_array.length] = [sorttable.getInnerText(rows[j].cells[col]), rows[j]];
}
/* If you want a stable sort, uncomment the following line */
//sorttable.shaker_sort(row_array, this.sorttable_sortfunction);
/* and comment out this one */
row_array.sort(this.sorttable_sortfunction);
tb = this.sorttable_tbody;
for (var j=0; j<row_array.length; j++) {
tb.appendChild(row_array[j][1]);
}
delete row_array;
});
}
}
},
guessType: function(table, column) {
// guess the type of a column based on its first non-blank row
sortfn = sorttable.sort_alpha;
for (var i=0; i<table.tBodies[0].rows.length; i++) {
text = sorttable.getInnerText(table.tBodies[0].rows[i].cells[column]);
if (text != '') {
if (text.match(/^-?[£$¤]?[\d,.]+%?$/)) {
return sorttable.sort_numeric;
}
// check for a date: dd/mm/yyyy or dd/mm/yy
// can have / or . or - as separator
// can be mm/dd as well
possdate = text.match(sorttable.DATE_RE)
if (possdate) {
// looks like a date
first = parseInt(possdate[1]);
second = parseInt(possdate[2]);
if (first > 12) {
// definitely dd/mm
return sorttable.sort_ddmm;
} else if (second > 12) {
return sorttable.sort_mmdd;
} else {
// looks like a date, but we can't tell which, so assume
// that it's dd/mm (English imperialism!) and keep looking
sortfn = sorttable.sort_ddmm;
}
}
}
}
return sortfn;
},
getInnerText: function(node) {
// gets the text we want to use for sorting for a cell.
// strips leading and trailing whitespace.
// this is *not* a generic getInnerText function; it's special to sorttable.
// for example, you can override the cell text with a customkey attribute.
// it also gets .value for <input> fields.
hasInputs = (typeof node.getElementsByTagName == 'function') &&
node.getElementsByTagName('input').length;
if (node.getAttribute("sorttable_customkey") != null) {
return node.getAttribute("sorttable_customkey");
}
else if (typeof node.textContent != 'undefined' && !hasInputs) {
return node.textContent.replace(/^\s+|\s+$/g, '');
}
else if (typeof node.innerText != 'undefined' && !hasInputs) {
return node.innerText.replace(/^\s+|\s+$/g, '');
}
else if (typeof node.text != 'undefined' && !hasInputs) {
return node.text.replace(/^\s+|\s+$/g, '');
}
else {
switch (node.nodeType) {
case 3:
if (node.nodeName.toLowerCase() == 'input') {
return node.value.replace(/^\s+|\s+$/g, '');
}
case 4:
return node.nodeValue.replace(/^\s+|\s+$/g, '');
break;
case 1:
case 11:
var innerText = '';
for (var i = 0; i < node.childNodes.length; i++) {
innerText += sorttable.getInnerText(node.childNodes[i]);
}
return innerText.replace(/^\s+|\s+$/g, '');
break;
default:
return '';
}
}
},
reverse: function(tbody) {
// reverse the rows in a tbody
newrows = [];
for (var i=0; i<tbody.rows.length; i++) {
newrows[newrows.length] = tbody.rows[i];
}
for (var i=newrows.length-1; i>=0; i--) {
tbody.appendChild(newrows[i]);
}
delete newrows;
},
/* sort functions
each sort function takes two parameters, a and b
you are comparing a[0] and b[0] */
sort_numeric: function(a,b) {
aa = parseFloat(a[0].replace(/[^0-9.-]/g,''));
if (isNaN(aa)) aa = 0;
bb = parseFloat(b[0].replace(/[^0-9.-]/g,''));
if (isNaN(bb)) bb = 0;
return aa-bb;
},
sort_alpha: function(a,b) {
if (a[0]==b[0]) return 0;
if (a[0]<b[0]) return -1;
return 1;
},
sort_ddmm: function(a,b) {
mtch = a[0].match(sorttable.DATE_RE);
y = mtch[3]; m = mtch[2]; d = mtch[1];
if (m.length == 1) m = '0'+m;
if (d.length == 1) d = '0'+d;
dt1 = y+m+d;
mtch = b[0].match(sorttable.DATE_RE);
y = mtch[3]; m = mtch[2]; d = mtch[1];
if (m.length == 1) m = '0'+m;
if (d.length == 1) d = '0'+d;
dt2 = y+m+d;
if (dt1==dt2) return 0;
if (dt1<dt2) return -1;
return 1;
},
sort_mmdd: function(a,b) {
mtch = a[0].match(sorttable.DATE_RE);
y = mtch[3]; d = mtch[2]; m = mtch[1];
if (m.length == 1) m = '0'+m;
if (d.length == 1) d = '0'+d;
dt1 = y+m+d;
mtch = b[0].match(sorttable.DATE_RE);
y = mtch[3]; d = mtch[2]; m = mtch[1];
if (m.length == 1) m = '0'+m;
if (d.length == 1) d = '0'+d;
dt2 = y+m+d;
if (dt1==dt2) return 0;
if (dt1<dt2) return -1;
return 1;
},
shaker_sort: function(list, comp_func) {
// A stable sort function to allow multi-level sorting of data
// see: http://en.wikipedia.org/wiki/Cocktail_sort
// thanks to Joseph Nahmias
var b = 0;
var t = list.length - 1;
var swap = true;
while(swap) {
swap = false;
for(var i = b; i < t; ++i) {
if ( comp_func(list[i], list[i+1]) > 0 ) {
var q = list[i]; list[i] = list[i+1]; list[i+1] = q;
swap = true;
}
} // for
t--;
if (!swap) break;
for(var i = t; i > b; --i) {
if ( comp_func(list[i], list[i-1]) < 0 ) {
var q = list[i]; list[i] = list[i-1]; list[i-1] = q;
swap = true;
}
} // for
b++;
} // while(swap)
}
}
/* ******************************************************************
Supporting functions: bundled here to avoid depending on a library
****************************************************************** */
// Dean Edwards/Matthias Miller/John Resig
/* for Mozilla/Opera9 */
if (document.addEventListener) {
document.addEventListener("DOMContentLoaded", sorttable.init, false);
}
/* for Internet Explorer */
/*@cc_on @*/
/*@if (@_win32)
document.write("<script id=__ie_onload defer src=javascript:void(0)><\/script>");
var script = document.getElementById("__ie_onload");
script.onreadystatechange = function() {
if (this.readyState == "complete") {
sorttable.init(); // call the onload handler
}
};
/*@end @*/
/* for Safari */
if (/WebKit/i.test(navigator.userAgent)) { // sniff
var _timer = setInterval(function() {
if (/loaded|complete/.test(document.readyState)) {
sorttable.init(); // call the onload handler
}
}, 10);
}
/* for other browsers */
window.onload = sorttable.init;
// written by Dean Edwards, 2005
// with input from Tino Zijdel, Matthias Miller, Diego Perini
// http://dean.edwards.name/weblog/2005/10/add-event/
function dean_addEvent(element, type, handler) {
if (element.addEventListener) {
element.addEventListener(type, handler, false);
} else {
// assign each event handler a unique ID
if (!handler.$$guid) handler.$$guid = dean_addEvent.guid++;
// create a hash table of event types for the element
if (!element.events) element.events = {};
// create a hash table of event handlers for each element/event pair
var handlers = element.events[type];
if (!handlers) {
handlers = element.events[type] = {};
// store the existing event handler (if there is one)
if (element["on" + type]) {
handlers[0] = element["on" + type];
}
}
// store the event handler in the hash table
handlers[handler.$$guid] = handler;
// assign a global event handler to do all the work
element["on" + type] = handleEvent;
}
};
// a counter used to create unique IDs
dean_addEvent.guid = 1;
function removeEvent(element, type, handler) {
if (element.removeEventListener) {
element.removeEventListener(type, handler, false);
} else {
// delete the event handler from the hash table
if (element.events && element.events[type]) {
delete element.events[type][handler.$$guid];
}
}
};
function handleEvent(event) {
var returnValue = true;
// grab the event object (IE uses a global event object)
event = event || fixEvent(((this.ownerDocument || this.document || this).parentWindow || window).event);
// get a reference to the hash table of event handlers
var handlers = this.events[event.type];
// execute each event handler
for (var i in handlers) {
this.$$handleEvent = handlers[i];
if (this.$$handleEvent(event) === false) {
returnValue = false;
}
}
return returnValue;
};
function fixEvent(event) {
// add W3C standard event methods
event.preventDefault = fixEvent.preventDefault;
event.stopPropagation = fixEvent.stopPropagation;
return event;
};
fixEvent.preventDefault = function() {
this.returnValue = false;
};
fixEvent.stopPropagation = function() {
this.cancelBubble = true;
}
// Dean's forEach: http://dean.edwards.name/base/forEach.js
/*
forEach, version 1.0
Copyright 2006, Dean Edwards
License: http://www.opensource.org/licenses/mit-license.php
*/
// array-like enumeration
if (!Array.forEach) { // mozilla already supports this
Array.forEach = function(array, block, context) {
for (var i = 0; i < array.length; i++) {
block.call(context, array[i], i, array);
}
};
}
// generic enumeration
Function.prototype.forEach = function(object, block, context) {
for (var key in object) {
if (typeof this.prototype[key] == "undefined") {
block.call(context, object[key], key, object);
}
}
};
// character enumeration
String.forEach = function(string, block, context) {
Array.forEach(string.split(""), function(chr, index) {
block.call(context, chr, index, string);
});
};
// globally resolve forEach enumeration
var forEach = function(object, block, context) {
if (object) {
var resolve = Object; // default
if (object instanceof Function) {
// functions have a "length" property
resolve = Function;
} else if (object.forEach instanceof Function) {
// the object implements a custom forEach method so use that
object.forEach(block, context);
return;
} else if (typeof object == "string") {
// the object is a string
resolve = String;
} else if (typeof object.length == "number") {
// the object is array-like
resolve = Array;
}
resolve.forEach(object, block, context);
}
};
| luffy22/Astro | components/com_freepaypal/views/listdonations/sorttable.js | JavaScript | gpl-2.0 | 16,920 |
/**
* External dependencies
*/
import { nock, useNock } from 'test/helpers/use-nock';
import sinon from 'sinon';
import { expect } from 'chai';
/**
* Internal dependencies
*/
import {
READER_LIST_DISMISS_NOTICE,
READER_LIST_REQUEST,
READER_LIST_UPDATE,
READER_LISTS_RECEIVE,
READER_LISTS_REQUEST,
READER_LISTS_FOLLOW,
READER_LISTS_UNFOLLOW,
READER_LIST_UPDATE_TITLE,
READER_LIST_UPDATE_DESCRIPTION
} from 'state/action-types';
import {
receiveLists,
requestList,
requestSubscribedLists,
followList,
unfollowList,
updateListDetails,
dismissListNotice,
updateTitle,
updateDescription
} from '../actions';
describe( 'actions', () => {
useNock();
const spy = sinon.spy();
beforeEach( () => {
spy.reset();
} );
describe( '#receiveLists()', () => {
it( 'should return an action object', () => {
const lists = [ { ID: 841, title: 'Hello World', slug: 'hello-world' } ];
const action = receiveLists( lists );
expect( action ).to.eql( {
type: READER_LISTS_RECEIVE,
lists
} );
} );
} );
describe( '#requestList()', () => {
before( () => {
nock( 'https://public-api.wordpress.com:443' )
.get( '/rest/v1.2/read/lists/listowner/listslug' )
.reply( 200, {
list: {
ID: 123,
title: 'My test list'
}
} );
} );
it( 'should dispatch fetch action when thunk triggered', () => {
requestList()( spy );
expect( spy ).to.have.been.calledWith( {
type: READER_LIST_REQUEST
} );
} );
} );
describe( '#requestSubscribedLists()', () => {
before( () => {
nock( 'https://public-api.wordpress.com:443' )
.persist()
.get( '/rest/v1.2/read/lists' )
.reply( 200, {
found: 2,
lists: [
{ ID: 841, title: 'Hello World' },
{ ID: 413, title: 'Mango & Feijoa' }
]
} );
} );
it( 'should dispatch fetch action when thunk triggered', () => {
requestSubscribedLists()( spy );
expect( spy ).to.have.been.calledWith( {
type: READER_LISTS_REQUEST
} );
} );
it( 'should dispatch lists receive action when request completes', () => {
return requestSubscribedLists()( spy ).then( () => {
expect( spy ).to.have.been.calledWith( {
type: READER_LISTS_RECEIVE,
lists: [
{ ID: 841, title: 'Hello World' },
{ ID: 413, title: 'Mango & Feijoa' }
]
} );
} );
} );
} );
describe( '#followList()', () => {
before( () => {
nock( 'https://public-api.wordpress.com:443' )
.post( '/rest/v1.2/read/lists/restapitests/testlist/follow' )
.reply( 200, {
following: true
} );
} );
it( 'should dispatch fetch action when thunk triggered', () => {
followList( 'restapitests', 'testlist' )( spy );
expect( spy ).to.have.been.calledWith( {
type: READER_LISTS_FOLLOW,
owner: 'restapitests',
slug: 'testlist'
} );
} );
} );
describe( '#unfollowList()', () => {
before( () => {
nock( 'https://public-api.wordpress.com:443' )
.post( '/rest/v1.2/read/lists/restapitests/testlist/unfollow' )
.reply( 200, {
following: false
} );
} );
it( 'should dispatch fetch action when thunk triggered', () => {
unfollowList( 'restapitests', 'testlist' )( spy );
expect( spy ).to.have.been.calledWith( {
type: READER_LISTS_UNFOLLOW,
owner: 'restapitests',
slug: 'testlist'
} );
} );
} );
describe( '#updateListDetails()', () => {
before( () => {
nock( 'https://public-api.wordpress.com:443' )
.post( '/rest/v1.2/read/lists/restapitests/testlist/update' )
.reply( 200, {
following: false
} );
} );
it( 'should dispatch fetch action when thunk triggered', () => {
const list = { owner: 'restapitests', slug: 'testlist', title: 'Banana' };
updateListDetails( list )( spy );
expect( spy ).to.have.been.calledWith( {
type: READER_LIST_UPDATE,
list
} );
} );
} );
describe( '#dismissListNotice()', () => {
it( 'should dispatch the dismiss action', () => {
const listId = 123;
dismissListNotice( listId )( spy );
expect( spy ).to.have.been.calledWith( {
type: READER_LIST_DISMISS_NOTICE,
listId: 123
} );
} );
} );
describe( '#updateTitle()', () => {
it( 'should dispatch the right action', () => {
const listId = 123;
const newTitle = 'Banana';
updateTitle( listId, newTitle )( spy );
expect( spy ).to.have.been.calledWith( {
type: READER_LIST_UPDATE_TITLE,
listId: 123,
title: newTitle
} );
} );
} );
describe( '#updateDescription()', () => {
it( 'should dispatch the right action', () => {
const listId = 123;
const newDescription = 'Yellow is a excellent fruit colour';
updateDescription( listId, newDescription )( spy );
expect( spy ).to.have.been.calledWith( {
type: READER_LIST_UPDATE_DESCRIPTION,
listId: 123,
description: newDescription
} );
} );
} );
} );
| tinkertinker/wp-calypso | client/state/reader/lists/test/actions.js | JavaScript | gpl-2.0 | 4,866 |
//>>built
require({cache:{"url:dijit/templates/TooltipDialog.html":'\x3cdiv role\x3d"alertdialog" tabIndex\x3d"-1"\x3e\n\t\x3cdiv class\x3d"dijitTooltipContainer" role\x3d"presentation"\x3e\n\t\t\x3cdiv class\x3d"dijitTooltipContents dijitTooltipFocusNode" data-dojo-attach-point\x3d"containerNode"\x3e\x3c/div\x3e\n\t\x3c/div\x3e\n\t\x3cdiv class\x3d"dijitTooltipConnector" role\x3d"presentation" data-dojo-attach-point\x3d"connectorNode"\x3e\x3c/div\x3e\n\x3c/div\x3e\n'}});
define("dijit/TooltipDialog","dojo/_base/declare dojo/dom-class dojo/has dojo/keys dojo/_base/lang dojo/on ./focus ./layout/ContentPane ./_DialogMixin ./form/_FormMixin ./_TemplatedMixin dojo/text!./templates/TooltipDialog.html ./main".split(" "),function(c,f,g,e,h,k,d,l,m,n,p,q,r){c=c("dijit.TooltipDialog",[l,p,n,m],{title:"",doLayout:!1,autofocus:!0,baseClass:"dijitTooltipDialog",_firstFocusItem:null,_lastFocusItem:null,templateString:q,_setTitleAttr:"containerNode",postCreate:function(){this.inherited(arguments);
this.own(k(this.containerNode,"keydown",h.hitch(this,"_onKey")))},orient:function(a,b,c){a={"MR-ML":"dijitTooltipRight","ML-MR":"dijitTooltipLeft","TM-BM":"dijitTooltipAbove","BM-TM":"dijitTooltipBelow","BL-TL":"dijitTooltipBelow dijitTooltipABLeft","TL-BL":"dijitTooltipAbove dijitTooltipABLeft","BR-TR":"dijitTooltipBelow dijitTooltipABRight","TR-BR":"dijitTooltipAbove dijitTooltipABRight","BR-BL":"dijitTooltipRight","BL-BR":"dijitTooltipLeft","BR-TL":"dijitTooltipBelow dijitTooltipABLeft","BL-TR":"dijitTooltipBelow dijitTooltipABRight",
"TL-BR":"dijitTooltipAbove dijitTooltipABRight","TR-BL":"dijitTooltipAbove dijitTooltipABLeft"}[b+"-"+c];f.replace(this.domNode,a,this._currentOrientClass||"");this._currentOrientClass=a},focus:function(){this._getFocusItems(this.containerNode);d.focus(this._firstFocusItem)},onOpen:function(a){this.orient(this.domNode,a.aroundCorner,a.corner);var b=a.aroundNodePos;"M"==a.corner.charAt(0)&&"M"==a.aroundCorner.charAt(0)?(this.connectorNode.style.top=b.y+(b.h-this.connectorNode.offsetHeight>>1)-a.y+
"px",this.connectorNode.style.left=""):"M"==a.corner.charAt(1)&&"M"==a.aroundCorner.charAt(1)&&(this.connectorNode.style.left=b.x+(b.w-this.connectorNode.offsetWidth>>1)-a.x+"px");this._onShow()},onClose:function(){this.onHide()},_onKey:function(a){if(a.keyCode==e.ESCAPE)this.defer("onCancel"),a.stopPropagation(),a.preventDefault();else if(a.keyCode==e.TAB){var b=a.target;this._getFocusItems(this.containerNode);this._firstFocusItem==this._lastFocusItem?(a.stopPropagation(),a.preventDefault()):b==
this._firstFocusItem&&a.shiftKey?(d.focus(this._lastFocusItem),a.stopPropagation(),a.preventDefault()):b==this._lastFocusItem&&!a.shiftKey?(d.focus(this._firstFocusItem),a.stopPropagation(),a.preventDefault()):a.stopPropagation()}}});g("dojo-bidi")&&c.extend({_setTitleAttr:function(a){this.containerNode.title=this.textDir&&this.enforceTextDirWithUcc?this.enforceTextDirWithUcc(null,a):a;this._set("title",a)},_setTextDirAttr:function(a){if(!this._created||this.textDir!=a)this._set("textDir",a),this.textDir&&
this.title&&(this.containerNode.title=this.enforceTextDirWithUcc(null,this.title))}});return c});
//@ sourceMappingURL=TooltipDialog.js.map | joshuacoddingyou/php | public/scripts/dijit/TooltipDialog.js | JavaScript | gpl-2.0 | 3,198 |
/**
* @file
* Bootstrap Modals.
*/
(function ($, Drupal, Bootstrap, Attributes, drupalSettings) {
'use strict';
/**
* Only process this once.
*/
Bootstrap.once('modal.jquery.ui.bridge', function (settings) {
// RTL support.
var rtl = document.documentElement.getAttribute('dir').toLowerCase() === 'rtl';
// Override drupal.dialog button classes. This must be done on DOM ready
// since core/drupal.dialog technically depends on this file and has not
// yet set their default settings.
$(function () {
drupalSettings.dialog.buttonClass = 'btn';
drupalSettings.dialog.buttonPrimaryClass = 'btn-primary';
});
var relayEvent = function ($element, name, stopPropagation) {
return function (e) {
if (stopPropagation === void 0 || stopPropagation) {
e.stopPropagation();
}
var parts = name.split('.').filter(Boolean);
var type = parts.shift();
e.target = $element[0];
e.currentTarget = $element[0];
e.namespace = parts.join('.');
e.type = type;
$element.trigger(e);
};
};
/**
* Proxy $.fn.dialog to $.fn.modal.
*/
Bootstrap.createPlugin('dialog', function (options) {
// When only options are passed, jQuery UI dialog treats this like a
// initialization method. Destroy any existing Bootstrap modal and
// recreate it using the contents of the dialog HTML.
if (arguments.length === 1 && typeof options === 'object') {
this.each(function () {
// This part gets a little tricky. Core can potentially already
// semi-process this "dialog" if was created using an Ajax command
// (i.e. prepareDialogButtons in drupal.ajax.js). Because of this,
// we cannot simply dump the existing dialog content into a newly
// created modal because that would destroy any existing event
// bindings. Instead, we have to create this in steps and "move"
// (append) the existing content as needed.
var $this = $(this);
// Create a new modal to get a complete template.
var $modal = $(Drupal.theme('bootstrapModal', {attributes: Attributes.create(this).remove('style')}));
// Store a reference to the content inside the existing dialog.
// This references the actual DOM node elements which will allow
// jQuery to "move" then when appending below. Using $.fn.children()
// does not return any text nodes present and $.fn.html() only returns
// a string representation of the content, which effectively destroys
// any prior event bindings or processing.
var $existing = $this.contents();
// Destroy any existing Bootstrap Modal data that may have been saved.
$this.removeData('bs.modal');
// Set the attributes of the dialog to that of the newly created modal.
$this.attr(Attributes.create($modal).toPlainObject());
// Append the newly created modal markup.
$this.append($modal.html());
// Move the existing HTML into the modal markup that was just appended.
$this.find('.modal-body').append($existing);
});
// Indicate that the modal is a jQuery UI dialog bridge.
options = {
dialogOptions: options,
jQueryUiBridge: true
};
// Proxy just the options to the Bootstrap Modal plugin.
return $.fn.modal.apply(this, [options]);
}
// Otherwise, proxy all arguments to the Bootstrap Modal plugin.
return $.fn.modal.apply(this, arguments);
});
/**
* Extend the Bootstrap Modal plugin constructor class.
*/
Bootstrap.extendPlugin('modal', function () {
var Modal = this;
return {
DEFAULTS: {
// By default, this option is disabled. It's only flagged when a modal
// was created using $.fn.dialog above.
jQueryUiBridge: false
},
prototype: {
/**
* Handler for $.fn.dialog('close').
*/
close: function () {
var _this = this;
this.hide.apply(this, arguments);
// For some reason (likely due to the transition event not being
// registered properly), the backdrop doesn't always get removed
// after the above "hide" method is invoked . Instead, ensure the
// backdrop is removed after the transition duration by manually
// invoking the internal "hideModal" method shortly thereafter.
setTimeout(function () {
if (!_this.isShown && _this.$backdrop) {
_this.hideModal();
}
}, (Modal.TRANSITION_DURATION !== void 0 ? Modal.TRANSITION_DURATION : 300) + 10);
},
/**
* Creates any necessary buttons from dialog options.
*/
createButtons: function () {
this.$footer.find('.modal-buttons').remove();
// jQuery UI supports both objects and arrays. Unfortunately
// developers have misunderstood and abused this by simply placing
// the objects that should be in an array inside an object with
// arbitrary keys (likely to target specific buttons as a hack).
var buttons = this.options.dialogOptions && this.options.dialogOptions.buttons || [];
if (!Array.isArray(buttons)) {
var array = [];
for (var k in buttons) {
// Support the proper object values: label => click callback.
if (typeof buttons[k] === 'function') {
array.push({
label: k,
click: buttons[k],
});
}
// Support nested objects, but log a warning.
else if (buttons[k].text || buttons[k].label) {
Bootstrap.warn('Malformed jQuery UI dialog button: @key. The button object should be inside an array.', {
'@key': k
});
array.push(buttons[k]);
}
else {
Bootstrap.unsupported('button', k, buttons[k]);
}
}
buttons = array;
}
if (buttons.length) {
var $buttons = $('<div class="modal-buttons"/>').appendTo(this.$footer);
for (var i = 0, l = buttons.length; i < l; i++) {
var button = buttons[i];
var $button = $(Drupal.theme('bootstrapModalDialogButton', button));
// Invoke the "create" method for jQuery UI buttons.
if (typeof button.create === 'function') {
button.create.call($button[0]);
}
// Bind the "click" method for jQuery UI buttons to the modal.
if (typeof button.click === 'function') {
$button.on('click', button.click.bind(this.$element));
}
$buttons.append($button);
}
}
// Toggle footer visibility based on whether it has child elements.
this.$footer[this.$footer.children()[0] ? 'show' : 'hide']();
},
/**
* Initializes the Bootstrap Modal.
*/
init: function () {
// Relay necessary events.
if (this.options.jQueryUiBridge) {
this.$element.on('hide.bs.modal', relayEvent(this.$element, 'dialogbeforeclose', false));
this.$element.on('hidden.bs.modal', relayEvent(this.$element, 'dialogclose', false));
this.$element.on('show.bs.modal', relayEvent(this.$element, 'dialogcreate', false));
this.$element.on('shown.bs.modal', relayEvent(this.$element, 'dialogopen', false));
}
// Create a footer if one doesn't exist.
// This is necessary in case dialog.ajax.js decides to add buttons.
if (!this.$footer[0]) {
this.$footer = $(Drupal.theme('bootstrapModalFooter', {}, true)).insertAfter(this.$dialogBody);
}
// Now call the parent init method.
this.super();
// Handle autoResize option (this is a drupal.dialog option).
if (this.options.dialogOptions && this.options.dialogOptions.autoResize && this.options.dialogOptions.position) {
this.position(this.options.dialogOptions.position);
}
// If show is enabled and currently not shown, show it.
if (this.options.jQueryUiBridge && this.options.show && !this.isShown) {
this.show();
}
},
/**
* Handler for $.fn.dialog('instance').
*/
instance: function () {
Bootstrap.unsupported('method', 'instance', arguments);
},
/**
* Handler for $.fn.dialog('isOpen').
*/
isOpen: function () {
return !!this.isShown;
},
/**
* Maps dialog options to the modal.
*
* @param {Object} options
* The options to map.
*/
mapDialogOptions: function (options) {
var mappedOptions = {};
var dialogOptions = options.dialogOptions || {};
// Remove any existing dialog options.
delete options.dialogOptions;
// Separate Bootstrap modal options from jQuery UI dialog options.
for (var k in options) {
if (Modal.DEFAULTS.hasOwnProperty(k)) {
mappedOptions[k] = options[k];
}
else {
dialogOptions[k] = options[k];
}
}
// Handle CSS properties.
var cssUnitRegExp = /^([+-]?(?:\d+|\d*\.\d+))([a-z]*|%)?$/;
var parseCssUnit = function (value, defaultUnit) {
var parts = ('' + value).match(cssUnitRegExp);
return parts && parts[1] !== void 0 ? parts[1] + (parts[2] || defaultUnit || 'px') : null;
};
var styles = {};
var cssProperties = ['height', 'maxHeight', 'maxWidth', 'minHeight', 'minWidth', 'width'];
for (var i = 0, l = cssProperties.length; i < l; i++) {
var prop = cssProperties[i];
if (dialogOptions[prop] !== void 0) {
var value = parseCssUnit(dialogOptions[prop]);
if (value) {
styles[prop] = value;
// If there's a defined height of some kind, enforce the modal
// to use flex (on modern browsers). This will ensure that
// the core autoResize calculations don't cause the content
// to overflow.
if (dialogOptions.autoResize && (prop === 'height' || prop === 'maxHeight')) {
styles.display = 'flex';
styles.flexDirection = 'column';
this.$dialogBody.css('overflow', 'scroll');
}
}
}
}
// Apply mapped CSS styles to the modal-content container.
this.$content.css(styles);
// Handle deprecated "dialogClass" option by merging it with "classes".
var classesMap = {
'ui-dialog': 'modal-content',
'ui-dialog-titlebar': 'modal-header',
'ui-dialog-title': 'modal-title',
'ui-dialog-titlebar-close': 'close',
'ui-dialog-content': 'modal-body',
'ui-dialog-buttonpane': 'modal-footer'
};
if (dialogOptions.dialogClass) {
if (dialogOptions.classes === void 0) {
dialogOptions.classes = {};
}
if (dialogOptions.classes['ui-dialog'] === void 0) {
dialogOptions.classes['ui-dialog'] = '';
}
var dialogClass = dialogOptions.classes['ui-dialog'].split(' ');
dialogClass.push(dialogOptions.dialogClass);
dialogOptions.classes['ui-dialog'] = dialogClass.join(' ');
delete dialogOptions.dialogClass;
}
// Add jQuery UI classes to elements in case developers target them
// in callbacks.
for (k in classesMap) {
this.$element.find('.' + classesMap[k]).addClass(k);
}
// Bind events.
var events = [
'beforeClose', 'close',
'create',
'drag', 'dragStart', 'dragStop',
'focus',
'open',
'resize', 'resizeStart', 'resizeStop'
];
for (i = 0, l = events.length; i < l; i++) {
var event = events[i].toLowerCase();
if (dialogOptions[event] === void 0 || typeof dialogOptions[event] !== 'function') continue;
this.$element.on('dialog' + event, dialogOptions[event]);
}
// Support title attribute on the modal.
var title;
if ((dialogOptions.title === null || dialogOptions.title === void 0) && (title = this.$element.attr('title'))) {
dialogOptions.title = title;
}
// Handle the reset of the options.
for (var name in dialogOptions) {
if (!dialogOptions.hasOwnProperty(name) || dialogOptions[name] === void 0) continue;
switch (name) {
case 'appendTo':
Bootstrap.unsupported('option', name, dialogOptions.appendTo);
break;
case 'autoOpen':
mappedOptions.show = dialogOptions.show = !!dialogOptions.autoOpen;
break;
case 'classes':
if (dialogOptions.classes) {
for (var key in dialogOptions.classes) {
if (dialogOptions.classes.hasOwnProperty(key) && classesMap[key] !== void 0) {
// Run through Attributes to sanitize classes.
var attributes = Attributes.create().addClass(dialogOptions.classes[key]).toPlainObject();
var selector = '.' + classesMap[key];
this.$element.find(selector).addClass(attributes['class']);
}
}
}
break;
case 'closeOnEscape':
mappedOptions.keyboard = !!dialogOptions.closeOnEscape;
if (!dialogOptions.closeOnEscape && dialogOptions.modal) {
mappedOptions.backdrop = 'static';
}
break;
case 'closeText':
Bootstrap.unsupported('option', name, dialogOptions.closeText);
break;
case 'draggable':
this.$content
.draggable({
handle: '.modal-header',
drag: relayEvent(this.$element, 'dialogdrag'),
start: relayEvent(this.$element, 'dialogdragstart'),
end: relayEvent(this.$element, 'dialogdragend')
})
.draggable(dialogOptions.draggable ? 'enable' : 'disable');
break;
case 'hide':
if (dialogOptions.hide === false || dialogOptions.hide === true) {
this.$element[dialogOptions.hide ? 'addClass' : 'removeClass']('fade');
mappedOptions.animation = dialogOptions.hide;
}
else {
Bootstrap.unsupported('option', name + ' (complex animation)', dialogOptions.hide);
}
break;
case 'modal':
if (!dialogOptions.closeOnEscape && dialogOptions.modal) {
mappedOptions.backdrop = 'static';
}
else {
mappedOptions.backdrop = dialogOptions.modal;
}
// If not a modal and no initial position, center it.
if (!dialogOptions.modal && !dialogOptions.position) {
this.position({ my: 'center', of: window });
}
break;
case 'position':
this.position(dialogOptions.position);
break;
// Resizable support (must initialize first).
case 'resizable':
this.$content
.resizable({
resize: relayEvent(this.$element, 'dialogresize'),
start: relayEvent(this.$element, 'dialogresizestart'),
end: relayEvent(this.$element, 'dialogresizeend')
})
.resizable(dialogOptions.resizable ? 'enable' : 'disable');
break;
case 'show':
if (dialogOptions.show === false || dialogOptions.show === true) {
this.$element[dialogOptions.show ? 'addClass' : 'removeClass']('fade');
mappedOptions.animation = dialogOptions.show;
}
else {
Bootstrap.unsupported('option', name + ' (complex animation)', dialogOptions.show);
}
break;
case 'title':
this.$dialog.find('.modal-title').text(dialogOptions.title);
break;
}
}
// Add the supported dialog options to the mapped options.
mappedOptions.dialogOptions = dialogOptions;
return mappedOptions;
},
/**
* Handler for $.fn.dialog('moveToTop').
*/
moveToTop: function () {
Bootstrap.unsupported('method', 'moveToTop', arguments);
},
/**
* Handler for $.fn.dialog('option').
*/
option: function () {
var clone = {options: {}};
// Apply the parent option method to the clone of current options.
this.super.apply(clone, arguments);
// Merge in the cloned mapped options.
$.extend(true, this.options, this.mapDialogOptions(clone.options));
// Update buttons.
this.createButtons();
},
position: function(position) {
// Reset modal styling.
this.$element.css({
bottom: 'initial',
overflow: 'visible',
right: 'initial'
});
// Position the modal.
this.$element.position(position);
},
/**
* Handler for $.fn.dialog('open').
*/
open: function () {
this.show.apply(this, arguments);
},
/**
* Handler for $.fn.dialog('widget').
*/
widget: function () {
return this.$element;
}
}
};
});
/**
* Extend Drupal theming functions.
*/
$.extend(Drupal.theme, /** @lend Drupal.theme */ {
/**
* Renders a jQuery UI Dialog compatible button element.
*
* @param {Object} button
* The button object passed in the dialog options.
*
* @return {String}
* The modal dialog button markup.
*
* @see http://api.jqueryui.com/dialog/#option-buttons
* @see http://api.jqueryui.com/button/
*/
bootstrapModalDialogButton: function (button) {
var attributes = Attributes.create();
var icon = '';
var iconPosition = button.iconPosition || 'beginning';
iconPosition = (iconPosition === 'end' && !rtl) || (iconPosition === 'beginning' && rtl) ? 'after' : 'before';
// Handle Bootstrap icons differently.
if (button.bootstrapIcon) {
icon = Drupal.theme('icon', 'bootstrap', button.icon);
}
// Otherwise, assume it's a jQuery UI icon.
// @todo Map jQuery UI icons to Bootstrap icons?
else if (button.icon) {
var iconAttributes = Attributes.create()
.addClass(['ui-icon', button.icon])
.set('aria-hidden', 'true');
icon = '<span' + iconAttributes + '></span>';
}
// Label. Note: jQuery UI dialog has an inconsistency where it uses
// "text" instead of "label", so both need to be supported.
var value = button.label || button.text;
// Show/hide label.
if (icon && ((button.showLabel !== void 0 && !button.showLabel) || (button.text !== void 0 && !button.text))) {
value = '<span' + Attributes.create().addClass('sr-only') + '>' + value + '</span>';
}
attributes.set('value', iconPosition === 'before' ? icon + value : value + icon);
// Handle disabled.
attributes[button.disabled ? 'set' :'remove']('disabled', 'disabled');
if (button.classes) {
attributes.addClass(Object.keys(button.classes).map(function(key) { return button.classes[key]; }));
}
if (button['class']) {
attributes.addClass(button['class']);
}
if (button.primary) {
attributes.addClass('btn-primary');
}
return Drupal.theme('button', attributes);
}
});
});
})(window.jQuery, window.Drupal, window.Drupal.bootstrap, window.Attributes, window.drupalSettings);
| gitkyo/tamtam | themes/bootstrap/js/modal.jquery.ui.bridge.js | JavaScript | gpl-2.0 | 21,827 |
/*!
* Bootstrap v3.3.5 (http://getbootstrap.com)
* Copyright 2011-2015 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/
/*!
* Generated using the Bootstrap Customizer (http://getbootstrap.com/customize/?id=d708d10a7b15a6d5e9c9)
* Config saved to config.json and https://gist.github.com/d708d10a7b15a6d5e9c9
*/
if (typeof jQuery === 'undefined') {
throw new Error('Bootstrap\'s JavaScript requires jQuery')
}
+function ($) {
'use strict';
var version = $.fn.jquery.split(' ')[0].split('.')
if ((version[0] < 2 && version[1] < 9) || (version[0] == 1 && version[1] == 9 && version[2] < 1)) {
throw new Error('Bootstrap\'s JavaScript requires jQuery version 1.9.1 or higher')
}
}(jQuery);
/* ========================================================================
* Bootstrap: alert.js v3.3.5
* http://getbootstrap.com/javascript/#alerts
* ========================================================================
* Copyright 2011-2015 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {
'use strict';
// ALERT CLASS DEFINITION
// ======================
var dismiss = '[data-dismiss="alert"]'
var Alert = function (el) {
$(el).on('click', dismiss, this.close)
}
Alert.VERSION = '3.3.5'
Alert.TRANSITION_DURATION = 150
Alert.prototype.close = function (e) {
var $this = $(this)
var selector = $this.attr('data-target')
if (!selector) {
selector = $this.attr('href')
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
}
var $parent = $(selector)
if (e) e.preventDefault()
if (!$parent.length) {
$parent = $this.closest('.alert')
}
$parent.trigger(e = $.Event('close.bs.alert'))
if (e.isDefaultPrevented()) return
$parent.removeClass('in')
function removeElement() {
// detach from parent, fire event then clean up data
$parent.detach().trigger('closed.bs.alert').remove()
}
$.support.transition && $parent.hasClass('fade') ?
$parent
.one('bsTransitionEnd', removeElement)
.emulateTransitionEnd(Alert.TRANSITION_DURATION) :
removeElement()
}
// ALERT PLUGIN DEFINITION
// =======================
function Plugin(option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.alert')
if (!data) $this.data('bs.alert', (data = new Alert(this)))
if (typeof option == 'string') data[option].call($this)
})
}
var old = $.fn.alert
$.fn.alert = Plugin
$.fn.alert.Constructor = Alert
// ALERT NO CONFLICT
// =================
$.fn.alert.noConflict = function () {
$.fn.alert = old
return this
}
// ALERT DATA-API
// ==============
$(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close)
}(jQuery);
/* ========================================================================
* Bootstrap: button.js v3.3.5
* http://getbootstrap.com/javascript/#buttons
* ========================================================================
* Copyright 2011-2015 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {
'use strict';
// BUTTON PUBLIC CLASS DEFINITION
// ==============================
var Button = function (element, options) {
this.$element = $(element)
this.options = $.extend({}, Button.DEFAULTS, options)
this.isLoading = false
}
Button.VERSION = '3.3.5'
Button.DEFAULTS = {
loadingText: 'loading...'
}
Button.prototype.setState = function (state) {
var d = 'disabled'
var $el = this.$element
var val = $el.is('input') ? 'val' : 'html'
var data = $el.data()
state += 'Text'
if (data.resetText == null) $el.data('resetText', $el[val]())
// push to event loop to allow forms to submit
setTimeout($.proxy(function () {
$el[val](data[state] == null ? this.options[state] : data[state])
if (state == 'loadingText') {
this.isLoading = true
$el.addClass(d).attr(d, d)
} else if (this.isLoading) {
this.isLoading = false
$el.removeClass(d).removeAttr(d)
}
}, this), 0)
}
Button.prototype.toggle = function () {
var changed = true
var $parent = this.$element.closest('[data-toggle="buttons"]')
if ($parent.length) {
var $input = this.$element.find('input')
if ($input.prop('type') == 'radio') {
if ($input.prop('checked')) changed = false
$parent.find('.active').removeClass('active')
this.$element.addClass('active')
} else if ($input.prop('type') == 'checkbox') {
if (($input.prop('checked')) !== this.$element.hasClass('active')) changed = false
this.$element.toggleClass('active')
}
$input.prop('checked', this.$element.hasClass('active'))
if (changed) $input.trigger('change')
} else {
this.$element.attr('aria-pressed', !this.$element.hasClass('active'))
this.$element.toggleClass('active')
}
}
// BUTTON PLUGIN DEFINITION
// ========================
function Plugin(option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.button')
var options = typeof option == 'object' && option
if (!data) $this.data('bs.button', (data = new Button(this, options)))
if (option == 'toggle') data.toggle()
else if (option) data.setState(option)
})
}
var old = $.fn.button
$.fn.button = Plugin
$.fn.button.Constructor = Button
// BUTTON NO CONFLICT
// ==================
$.fn.button.noConflict = function () {
$.fn.button = old
return this
}
// BUTTON DATA-API
// ===============
$(document)
.on('click.bs.button.data-api', '[data-toggle^="button"]', function (e) {
var $btn = $(e.target)
if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
Plugin.call($btn, 'toggle')
if (!($(e.target).is('input[type="radio"]') || $(e.target).is('input[type="checkbox"]'))) e.preventDefault()
})
.on('focus.bs.button.data-api blur.bs.button.data-api', '[data-toggle^="button"]', function (e) {
$(e.target).closest('.btn').toggleClass('focus', /^focus(in)?$/.test(e.type))
})
}(jQuery);
/* ========================================================================
* Bootstrap: carousel.js v3.3.5
* http://getbootstrap.com/javascript/#carousel
* ========================================================================
* Copyright 2011-2015 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {
'use strict';
// CAROUSEL CLASS DEFINITION
// =========================
var Carousel = function (element, options) {
this.$element = $(element)
this.$indicators = this.$element.find('.carousel-indicators')
this.options = options
this.paused = null
this.sliding = null
this.interval = null
this.$active = null
this.$items = null
this.options.keyboard && this.$element.on('keydown.bs.carousel', $.proxy(this.keydown, this))
this.options.pause == 'hover' && !('ontouchstart' in document.documentElement) && this.$element
.on('mouseenter.bs.carousel', $.proxy(this.pause, this))
.on('mouseleave.bs.carousel', $.proxy(this.cycle, this))
}
Carousel.VERSION = '3.3.5'
Carousel.TRANSITION_DURATION = 600
Carousel.DEFAULTS = {
interval: 5000,
pause: 'hover',
wrap: true,
keyboard: true
}
Carousel.prototype.keydown = function (e) {
if (/input|textarea/i.test(e.target.tagName)) return
switch (e.which) {
case 37: this.prev(); break
case 39: this.next(); break
default: return
}
e.preventDefault()
}
Carousel.prototype.cycle = function (e) {
e || (this.paused = false)
this.interval && clearInterval(this.interval)
this.options.interval
&& !this.paused
&& (this.interval = setInterval($.proxy(this.next, this), this.options.interval))
return this
}
Carousel.prototype.getItemIndex = function (item) {
this.$items = item.parent().children('.item')
return this.$items.index(item || this.$active)
}
Carousel.prototype.getItemForDirection = function (direction, active) {
var activeIndex = this.getItemIndex(active)
var willWrap = (direction == 'prev' && activeIndex === 0)
|| (direction == 'next' && activeIndex == (this.$items.length - 1))
if (willWrap && !this.options.wrap) return active
var delta = direction == 'prev' ? -1 : 1
var itemIndex = (activeIndex + delta) % this.$items.length
return this.$items.eq(itemIndex)
}
Carousel.prototype.to = function (pos) {
var that = this
var activeIndex = this.getItemIndex(this.$active = this.$element.find('.item.active'))
if (pos > (this.$items.length - 1) || pos < 0) return
if (this.sliding) return this.$element.one('slid.bs.carousel', function () { that.to(pos) }) // yes, "slid"
if (activeIndex == pos) return this.pause().cycle()
return this.slide(pos > activeIndex ? 'next' : 'prev', this.$items.eq(pos))
}
Carousel.prototype.pause = function (e) {
e || (this.paused = true)
if (this.$element.find('.next, .prev').length && $.support.transition) {
this.$element.trigger($.support.transition.end)
this.cycle(true)
}
this.interval = clearInterval(this.interval)
return this
}
Carousel.prototype.next = function () {
if (this.sliding) return
return this.slide('next')
}
Carousel.prototype.prev = function () {
if (this.sliding) return
return this.slide('prev')
}
Carousel.prototype.slide = function (type, next) {
var $active = this.$element.find('.item.active')
var $next = next || this.getItemForDirection(type, $active)
var isCycling = this.interval
var direction = type == 'next' ? 'left' : 'right'
var that = this
if ($next.hasClass('active')) return (this.sliding = false)
var relatedTarget = $next[0]
var slideEvent = $.Event('slide.bs.carousel', {
relatedTarget: relatedTarget,
direction: direction
})
this.$element.trigger(slideEvent)
if (slideEvent.isDefaultPrevented()) return
this.sliding = true
isCycling && this.pause()
if (this.$indicators.length) {
this.$indicators.find('.active').removeClass('active')
var $nextIndicator = $(this.$indicators.children()[this.getItemIndex($next)])
$nextIndicator && $nextIndicator.addClass('active')
}
var slidEvent = $.Event('slid.bs.carousel', { relatedTarget: relatedTarget, direction: direction }) // yes, "slid"
if ($.support.transition && this.$element.hasClass('slide')) {
$next.addClass(type)
$next[0].offsetWidth // force reflow
$active.addClass(direction)
$next.addClass(direction)
$active
.one('bsTransitionEnd', function () {
$next.removeClass([type, direction].join(' ')).addClass('active')
$active.removeClass(['active', direction].join(' '))
that.sliding = false
setTimeout(function () {
that.$element.trigger(slidEvent)
}, 0)
})
.emulateTransitionEnd(Carousel.TRANSITION_DURATION)
} else {
$active.removeClass('active')
$next.addClass('active')
this.sliding = false
this.$element.trigger(slidEvent)
}
isCycling && this.cycle()
return this
}
// CAROUSEL PLUGIN DEFINITION
// ==========================
function Plugin(option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.carousel')
var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option == 'object' && option)
var action = typeof option == 'string' ? option : options.slide
if (!data) $this.data('bs.carousel', (data = new Carousel(this, options)))
if (typeof option == 'number') data.to(option)
else if (action) data[action]()
else if (options.interval) data.pause().cycle()
})
}
var old = $.fn.carousel
$.fn.carousel = Plugin
$.fn.carousel.Constructor = Carousel
// CAROUSEL NO CONFLICT
// ====================
$.fn.carousel.noConflict = function () {
$.fn.carousel = old
return this
}
// CAROUSEL DATA-API
// =================
var clickHandler = function (e) {
var href
var $this = $(this)
var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) // strip for ie7
if (!$target.hasClass('carousel')) return
var options = $.extend({}, $target.data(), $this.data())
var slideIndex = $this.attr('data-slide-to')
if (slideIndex) options.interval = false
Plugin.call($target, options)
if (slideIndex) {
$target.data('bs.carousel').to(slideIndex)
}
e.preventDefault()
}
$(document)
.on('click.bs.carousel.data-api', '[data-slide]', clickHandler)
.on('click.bs.carousel.data-api', '[data-slide-to]', clickHandler)
$(window).on('load', function () {
$('[data-ride="carousel"]').each(function () {
var $carousel = $(this)
Plugin.call($carousel, $carousel.data())
})
})
}(jQuery);
/* ========================================================================
* Bootstrap: dropdown.js v3.3.5
* http://getbootstrap.com/javascript/#dropdowns
* ========================================================================
* Copyright 2011-2015 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {
'use strict';
// DROPDOWN CLASS DEFINITION
// =========================
var backdrop = '.dropdown-backdrop'
var toggle = '[data-toggle="dropdown"]'
var Dropdown = function (element) {
$(element).on('click.bs.dropdown', this.toggle)
}
Dropdown.VERSION = '3.3.5'
function getParent($this) {
var selector = $this.attr('data-target')
if (!selector) {
selector = $this.attr('href')
selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
}
var $parent = selector && $(selector)
return $parent && $parent.length ? $parent : $this.parent()
}
function clearMenus(e) {
if (e && e.which === 3) return
$(backdrop).remove()
$(toggle).each(function () {
var $this = $(this)
var $parent = getParent($this)
var relatedTarget = { relatedTarget: this }
if (!$parent.hasClass('open')) return
if (e && e.type == 'click' && /input|textarea/i.test(e.target.tagName) && $.contains($parent[0], e.target)) return
$parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget))
if (e.isDefaultPrevented()) return
$this.attr('aria-expanded', 'false')
$parent.removeClass('open').trigger('hidden.bs.dropdown', relatedTarget)
})
}
Dropdown.prototype.toggle = function (e) {
var $this = $(this)
if ($this.is('.disabled, :disabled')) return
var $parent = getParent($this)
var isActive = $parent.hasClass('open')
clearMenus()
if (!isActive) {
if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) {
// if mobile we use a backdrop because click events don't delegate
$(document.createElement('div'))
.addClass('dropdown-backdrop')
.insertAfter($(this))
.on('click', clearMenus)
}
var relatedTarget = { relatedTarget: this }
$parent.trigger(e = $.Event('show.bs.dropdown', relatedTarget))
if (e.isDefaultPrevented()) return
$this
.trigger('focus')
.attr('aria-expanded', 'true')
$parent
.toggleClass('open')
.trigger('shown.bs.dropdown', relatedTarget)
}
return false
}
Dropdown.prototype.keydown = function (e) {
if (!/(38|40|27|32)/.test(e.which) || /input|textarea/i.test(e.target.tagName)) return
var $this = $(this)
e.preventDefault()
e.stopPropagation()
if ($this.is('.disabled, :disabled')) return
var $parent = getParent($this)
var isActive = $parent.hasClass('open')
if (!isActive && e.which != 27 || isActive && e.which == 27) {
if (e.which == 27) $parent.find(toggle).trigger('focus')
return $this.trigger('click')
}
var desc = ' li:not(.disabled):visible a'
var $items = $parent.find('.dropdown-menu' + desc)
if (!$items.length) return
var index = $items.index(e.target)
if (e.which == 38 && index > 0) index-- // up
if (e.which == 40 && index < $items.length - 1) index++ // down
if (!~index) index = 0
$items.eq(index).trigger('focus')
}
// DROPDOWN PLUGIN DEFINITION
// ==========================
function Plugin(option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.dropdown')
if (!data) $this.data('bs.dropdown', (data = new Dropdown(this)))
if (typeof option == 'string') data[option].call($this)
})
}
var old = $.fn.dropdown
$.fn.dropdown = Plugin
$.fn.dropdown.Constructor = Dropdown
// DROPDOWN NO CONFLICT
// ====================
$.fn.dropdown.noConflict = function () {
$.fn.dropdown = old
return this
}
// APPLY TO STANDARD DROPDOWN ELEMENTS
// ===================================
$(document)
.on('click.bs.dropdown.data-api', clearMenus)
.on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
.on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle)
.on('keydown.bs.dropdown.data-api', toggle, Dropdown.prototype.keydown)
.on('keydown.bs.dropdown.data-api', '.dropdown-menu', Dropdown.prototype.keydown)
}(jQuery);
/* ========================================================================
* Bootstrap: modal.js v3.3.5
* http://getbootstrap.com/javascript/#modals
* ========================================================================
* Copyright 2011-2015 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {
'use strict';
// MODAL CLASS DEFINITION
// ======================
var Modal = function (element, options) {
this.options = options
this.$body = $(document.body)
this.$element = $(element)
this.$dialog = this.$element.find('.modal-dialog')
this.$backdrop = null
this.isShown = null
this.originalBodyPad = null
this.scrollbarWidth = 0
this.ignoreBackdropClick = false
if (this.options.remote) {
this.$element
.find('.modal-content')
.load(this.options.remote, $.proxy(function () {
this.$element.trigger('loaded.bs.modal')
}, this))
}
}
Modal.VERSION = '3.3.5'
Modal.TRANSITION_DURATION = 300
Modal.BACKDROP_TRANSITION_DURATION = 150
Modal.DEFAULTS = {
backdrop: true,
keyboard: true,
show: true
}
Modal.prototype.toggle = function (_relatedTarget) {
return this.isShown ? this.hide() : this.show(_relatedTarget)
}
Modal.prototype.show = function (_relatedTarget) {
var that = this
var e = $.Event('show.bs.modal', { relatedTarget: _relatedTarget })
this.$element.trigger(e)
if (this.isShown || e.isDefaultPrevented()) return
this.isShown = true
this.checkScrollbar()
this.setScrollbar()
this.$body.addClass('modal-open')
this.escape()
this.resize()
this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))
this.$dialog.on('mousedown.dismiss.bs.modal', function () {
that.$element.one('mouseup.dismiss.bs.modal', function (e) {
if ($(e.target).is(that.$element)) that.ignoreBackdropClick = true
})
})
this.backdrop(function () {
var transition = $.support.transition && that.$element.hasClass('fade')
if (!that.$element.parent().length) {
that.$element.appendTo(that.$body) // don't move modals dom position
}
that.$element
.show()
.scrollTop(0)
that.adjustDialog()
if (transition) {
that.$element[0].offsetWidth // force reflow
}
that.$element.addClass('in')
that.enforceFocus()
var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget })
transition ?
that.$dialog // wait for modal to slide in
.one('bsTransitionEnd', function () {
that.$element.trigger('focus').trigger(e)
})
.emulateTransitionEnd(Modal.TRANSITION_DURATION) :
that.$element.trigger('focus').trigger(e)
})
}
Modal.prototype.hide = function (e) {
if (e) e.preventDefault()
e = $.Event('hide.bs.modal')
this.$element.trigger(e)
if (!this.isShown || e.isDefaultPrevented()) return
this.isShown = false
this.escape()
this.resize()
$(document).off('focusin.bs.modal')
this.$element
.removeClass('in')
.off('click.dismiss.bs.modal')
.off('mouseup.dismiss.bs.modal')
this.$dialog.off('mousedown.dismiss.bs.modal')
$.support.transition && this.$element.hasClass('fade') ?
this.$element
.one('bsTransitionEnd', $.proxy(this.hideModal, this))
.emulateTransitionEnd(Modal.TRANSITION_DURATION) :
this.hideModal()
}
Modal.prototype.enforceFocus = function () {
$(document)
.off('focusin.bs.modal') // guard against infinite focus loop
.on('focusin.bs.modal', $.proxy(function (e) {
if (this.$element[0] !== e.target && !this.$element.has(e.target).length) {
this.$element.trigger('focus')
}
}, this))
}
Modal.prototype.escape = function () {
if (this.isShown && this.options.keyboard) {
this.$element.on('keydown.dismiss.bs.modal', $.proxy(function (e) {
e.which == 27 && this.hide()
}, this))
} else if (!this.isShown) {
this.$element.off('keydown.dismiss.bs.modal')
}
}
Modal.prototype.resize = function () {
if (this.isShown) {
$(window).on('resize.bs.modal', $.proxy(this.handleUpdate, this))
} else {
$(window).off('resize.bs.modal')
}
}
Modal.prototype.hideModal = function () {
var that = this
this.$element.hide()
this.backdrop(function () {
that.$body.removeClass('modal-open')
that.resetAdjustments()
that.resetScrollbar()
that.$element.trigger('hidden.bs.modal')
})
}
Modal.prototype.removeBackdrop = function () {
this.$backdrop && this.$backdrop.remove()
this.$backdrop = null
}
Modal.prototype.backdrop = function (callback) {
var that = this
var animate = this.$element.hasClass('fade') ? 'fade' : ''
if (this.isShown && this.options.backdrop) {
var doAnimate = $.support.transition && animate
this.$backdrop = $(document.createElement('div'))
.addClass('modal-backdrop ' + animate)
.appendTo(this.$body)
this.$element.on('click.dismiss.bs.modal', $.proxy(function (e) {
if (this.ignoreBackdropClick) {
this.ignoreBackdropClick = false
return
}
if (e.target !== e.currentTarget) return
this.options.backdrop == 'static'
? this.$element[0].focus()
: this.hide()
}, this))
if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
this.$backdrop.addClass('in')
if (!callback) return
doAnimate ?
this.$backdrop
.one('bsTransitionEnd', callback)
.emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) :
callback()
} else if (!this.isShown && this.$backdrop) {
this.$backdrop.removeClass('in')
var callbackRemove = function () {
that.removeBackdrop()
callback && callback()
}
$.support.transition && this.$element.hasClass('fade') ?
this.$backdrop
.one('bsTransitionEnd', callbackRemove)
.emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) :
callbackRemove()
} else if (callback) {
callback()
}
}
// these following methods are used to handle overflowing modals
Modal.prototype.handleUpdate = function () {
this.adjustDialog()
}
Modal.prototype.adjustDialog = function () {
var modalIsOverflowing = this.$element[0].scrollHeight > document.documentElement.clientHeight
this.$element.css({
paddingLeft: !this.bodyIsOverflowing && modalIsOverflowing ? this.scrollbarWidth : '',
paddingRight: this.bodyIsOverflowing && !modalIsOverflowing ? this.scrollbarWidth : ''
})
}
Modal.prototype.resetAdjustments = function () {
this.$element.css({
paddingLeft: '',
paddingRight: ''
})
}
Modal.prototype.checkScrollbar = function () {
var fullWindowWidth = window.innerWidth
if (!fullWindowWidth) { // workaround for missing window.innerWidth in IE8
var documentElementRect = document.documentElement.getBoundingClientRect()
fullWindowWidth = documentElementRect.right - Math.abs(documentElementRect.left)
}
this.bodyIsOverflowing = document.body.clientWidth < fullWindowWidth
this.scrollbarWidth = this.measureScrollbar()
}
Modal.prototype.setScrollbar = function () {
var bodyPad = parseInt((this.$body.css('padding-right') || 0), 10)
this.originalBodyPad = document.body.style.paddingRight || ''
if (this.bodyIsOverflowing) this.$body.css('padding-right', bodyPad + this.scrollbarWidth)
}
Modal.prototype.resetScrollbar = function () {
this.$body.css('padding-right', this.originalBodyPad)
}
Modal.prototype.measureScrollbar = function () { // thx walsh
var scrollDiv = document.createElement('div')
scrollDiv.className = 'modal-scrollbar-measure'
this.$body.append(scrollDiv)
var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth
this.$body[0].removeChild(scrollDiv)
return scrollbarWidth
}
// MODAL PLUGIN DEFINITION
// =======================
function Plugin(option, _relatedTarget) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.modal')
var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option)
if (!data) $this.data('bs.modal', (data = new Modal(this, options)))
if (typeof option == 'string') data[option](_relatedTarget)
else if (options.show) data.show(_relatedTarget)
})
}
var old = $.fn.modal
$.fn.modal = Plugin
$.fn.modal.Constructor = Modal
// MODAL NO CONFLICT
// =================
$.fn.modal.noConflict = function () {
$.fn.modal = old
return this
}
// MODAL DATA-API
// ==============
$(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) {
var $this = $(this)
var href = $this.attr('href')
var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) // strip for ie7
var option = $target.data('bs.modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())
if ($this.is('a')) e.preventDefault()
$target.one('show.bs.modal', function (showEvent) {
if (showEvent.isDefaultPrevented()) return // only register focus restorer if modal will actually get shown
$target.one('hidden.bs.modal', function () {
$this.is(':visible') && $this.trigger('focus')
})
})
Plugin.call($target, option, this)
})
}(jQuery);
/* ========================================================================
* Bootstrap: tooltip.js v3.3.5
* http://getbootstrap.com/javascript/#tooltip
* Inspired by the original jQuery.tipsy by Jason Frame
* ========================================================================
* Copyright 2011-2015 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {
'use strict';
// TOOLTIP PUBLIC CLASS DEFINITION
// ===============================
var Tooltip = function (element, options) {
this.type = null
this.options = null
this.enabled = null
this.timeout = null
this.hoverState = null
this.$element = null
this.inState = null
this.init('tooltip', element, options)
}
Tooltip.VERSION = '3.3.5'
Tooltip.TRANSITION_DURATION = 150
Tooltip.DEFAULTS = {
animation: true,
placement: 'top',
selector: false,
template: '<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',
trigger: 'hover focus',
title: '',
delay: 0,
html: false,
container: false,
viewport: {
selector: 'body',
padding: 0
}
}
Tooltip.prototype.init = function (type, element, options) {
this.enabled = true
this.type = type
this.$element = $(element)
this.options = this.getOptions(options)
this.$viewport = this.options.viewport && $($.isFunction(this.options.viewport) ? this.options.viewport.call(this, this.$element) : (this.options.viewport.selector || this.options.viewport))
this.inState = { click: false, hover: false, focus: false }
if (this.$element[0] instanceof document.constructor && !this.options.selector) {
throw new Error('`selector` option must be specified when initializing ' + this.type + ' on the window.document object!')
}
var triggers = this.options.trigger.split(' ')
for (var i = triggers.length; i--;) {
var trigger = triggers[i]
if (trigger == 'click') {
this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this))
} else if (trigger != 'manual') {
var eventIn = trigger == 'hover' ? 'mouseenter' : 'focusin'
var eventOut = trigger == 'hover' ? 'mouseleave' : 'focusout'
this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))
}
}
this.options.selector ?
(this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
this.fixTitle()
}
Tooltip.prototype.getDefaults = function () {
return Tooltip.DEFAULTS
}
Tooltip.prototype.getOptions = function (options) {
options = $.extend({}, this.getDefaults(), this.$element.data(), options)
if (options.delay && typeof options.delay == 'number') {
options.delay = {
show: options.delay,
hide: options.delay
}
}
return options
}
Tooltip.prototype.getDelegateOptions = function () {
var options = {}
var defaults = this.getDefaults()
this._options && $.each(this._options, function (key, value) {
if (defaults[key] != value) options[key] = value
})
return options
}
Tooltip.prototype.enter = function (obj) {
var self = obj instanceof this.constructor ?
obj : $(obj.currentTarget).data('bs.' + this.type)
if (!self) {
self = new this.constructor(obj.currentTarget, this.getDelegateOptions())
$(obj.currentTarget).data('bs.' + this.type, self)
}
if (obj instanceof $.Event) {
self.inState[obj.type == 'focusin' ? 'focus' : 'hover'] = true
}
if (self.tip().hasClass('in') || self.hoverState == 'in') {
self.hoverState = 'in'
return
}
clearTimeout(self.timeout)
self.hoverState = 'in'
if (!self.options.delay || !self.options.delay.show) return self.show()
self.timeout = setTimeout(function () {
if (self.hoverState == 'in') self.show()
}, self.options.delay.show)
}
Tooltip.prototype.isInStateTrue = function () {
for (var key in this.inState) {
if (this.inState[key]) return true
}
return false
}
Tooltip.prototype.leave = function (obj) {
var self = obj instanceof this.constructor ?
obj : $(obj.currentTarget).data('bs.' + this.type)
if (!self) {
self = new this.constructor(obj.currentTarget, this.getDelegateOptions())
$(obj.currentTarget).data('bs.' + this.type, self)
}
if (obj instanceof $.Event) {
self.inState[obj.type == 'focusout' ? 'focus' : 'hover'] = false
}
if (self.isInStateTrue()) return
clearTimeout(self.timeout)
self.hoverState = 'out'
if (!self.options.delay || !self.options.delay.hide) return self.hide()
self.timeout = setTimeout(function () {
if (self.hoverState == 'out') self.hide()
}, self.options.delay.hide)
}
Tooltip.prototype.show = function () {
var e = $.Event('show.bs.' + this.type)
if (this.hasContent() && this.enabled) {
this.$element.trigger(e)
var inDom = $.contains(this.$element[0].ownerDocument.documentElement, this.$element[0])
if (e.isDefaultPrevented() || !inDom) return
var that = this
var $tip = this.tip()
var tipId = this.getUID(this.type)
this.setContent()
$tip.attr('id', tipId)
this.$element.attr('aria-describedby', tipId)
if (this.options.animation) $tip.addClass('fade')
var placement = typeof this.options.placement == 'function' ?
this.options.placement.call(this, $tip[0], this.$element[0]) :
this.options.placement
var autoToken = /\s?auto?\s?/i
var autoPlace = autoToken.test(placement)
if (autoPlace) placement = placement.replace(autoToken, '') || 'top'
$tip
.detach()
.css({ top: 0, left: 0, display: 'block' })
.addClass(placement)
.data('bs.' + this.type, this)
this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element)
this.$element.trigger('inserted.bs.' + this.type)
var pos = this.getPosition()
var actualWidth = $tip[0].offsetWidth
var actualHeight = $tip[0].offsetHeight
if (autoPlace) {
var orgPlacement = placement
var viewportDim = this.getPosition(this.$viewport)
placement = placement == 'bottom' && pos.bottom + actualHeight > viewportDim.bottom ? 'top' :
placement == 'top' && pos.top - actualHeight < viewportDim.top ? 'bottom' :
placement == 'right' && pos.right + actualWidth > viewportDim.width ? 'left' :
placement == 'left' && pos.left - actualWidth < viewportDim.left ? 'right' :
placement
$tip
.removeClass(orgPlacement)
.addClass(placement)
}
var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight)
this.applyPlacement(calculatedOffset, placement)
var complete = function () {
var prevHoverState = that.hoverState
that.$element.trigger('shown.bs.' + that.type)
that.hoverState = null
if (prevHoverState == 'out') that.leave(that)
}
$.support.transition && this.$tip.hasClass('fade') ?
$tip
.one('bsTransitionEnd', complete)
.emulateTransitionEnd(Tooltip.TRANSITION_DURATION) :
complete()
}
}
Tooltip.prototype.applyPlacement = function (offset, placement) {
var $tip = this.tip()
var width = $tip[0].offsetWidth
var height = $tip[0].offsetHeight
// manually read margins because getBoundingClientRect includes difference
var marginTop = parseInt($tip.css('margin-top'), 10)
var marginLeft = parseInt($tip.css('margin-left'), 10)
// we must check for NaN for ie 8/9
if (isNaN(marginTop)) marginTop = 0
if (isNaN(marginLeft)) marginLeft = 0
offset.top += marginTop
offset.left += marginLeft
// $.fn.offset doesn't round pixel values
// so we use setOffset directly with our own function B-0
$.offset.setOffset($tip[0], $.extend({
using: function (props) {
$tip.css({
top: Math.round(props.top),
left: Math.round(props.left)
})
}
}, offset), 0)
$tip.addClass('in')
// check to see if placing tip in new offset caused the tip to resize itself
var actualWidth = $tip[0].offsetWidth
var actualHeight = $tip[0].offsetHeight
if (placement == 'top' && actualHeight != height) {
offset.top = offset.top + height - actualHeight
}
var delta = this.getViewportAdjustedDelta(placement, offset, actualWidth, actualHeight)
if (delta.left) offset.left += delta.left
else offset.top += delta.top
var isVertical = /top|bottom/.test(placement)
var arrowDelta = isVertical ? delta.left * 2 - width + actualWidth : delta.top * 2 - height + actualHeight
var arrowOffsetPosition = isVertical ? 'offsetWidth' : 'offsetHeight'
$tip.offset(offset)
this.replaceArrow(arrowDelta, $tip[0][arrowOffsetPosition], isVertical)
}
Tooltip.prototype.replaceArrow = function (delta, dimension, isVertical) {
this.arrow()
.css(isVertical ? 'left' : 'top', 50 * (1 - delta / dimension) + '%')
.css(isVertical ? 'top' : 'left', '')
}
Tooltip.prototype.setContent = function () {
var $tip = this.tip()
var title = this.getTitle()
$tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title)
$tip.removeClass('fade in top bottom left right')
}
Tooltip.prototype.hide = function (callback) {
var that = this
var $tip = $(this.$tip)
var e = $.Event('hide.bs.' + this.type)
function complete() {
if (that.hoverState != 'in') $tip.detach()
that.$element
.removeAttr('aria-describedby')
.trigger('hidden.bs.' + that.type)
callback && callback()
}
this.$element.trigger(e)
if (e.isDefaultPrevented()) return
$tip.removeClass('in')
$.support.transition && $tip.hasClass('fade') ?
$tip
.one('bsTransitionEnd', complete)
.emulateTransitionEnd(Tooltip.TRANSITION_DURATION) :
complete()
this.hoverState = null
return this
}
Tooltip.prototype.fixTitle = function () {
var $e = this.$element
if ($e.attr('title') || typeof $e.attr('data-original-title') != 'string') {
$e.attr('data-original-title', $e.attr('title') || '').attr('title', '')
}
}
Tooltip.prototype.hasContent = function () {
return this.getTitle()
}
Tooltip.prototype.getPosition = function ($element) {
$element = $element || this.$element
var el = $element[0]
var isBody = el.tagName == 'BODY'
var elRect = el.getBoundingClientRect()
if (elRect.width == null) {
// width and height are missing in IE8, so compute them manually; see https://github.com/twbs/bootstrap/issues/14093
elRect = $.extend({}, elRect, { width: elRect.right - elRect.left, height: elRect.bottom - elRect.top })
}
var elOffset = isBody ? { top: 0, left: 0 } : $element.offset()
var scroll = { scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop() }
var outerDims = isBody ? { width: $(window).width(), height: $(window).height() } : null
return $.extend({}, elRect, scroll, outerDims, elOffset)
}
Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) {
return placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } :
placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } :
placement == 'left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } :
/* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width }
}
Tooltip.prototype.getViewportAdjustedDelta = function (placement, pos, actualWidth, actualHeight) {
var delta = { top: 0, left: 0 }
if (!this.$viewport) return delta
var viewportPadding = this.options.viewport && this.options.viewport.padding || 0
var viewportDimensions = this.getPosition(this.$viewport)
if (/right|left/.test(placement)) {
var topEdgeOffset = pos.top - viewportPadding - viewportDimensions.scroll
var bottomEdgeOffset = pos.top + viewportPadding - viewportDimensions.scroll + actualHeight
if (topEdgeOffset < viewportDimensions.top) { // top overflow
delta.top = viewportDimensions.top - topEdgeOffset
} else if (bottomEdgeOffset > viewportDimensions.top + viewportDimensions.height) { // bottom overflow
delta.top = viewportDimensions.top + viewportDimensions.height - bottomEdgeOffset
}
} else {
var leftEdgeOffset = pos.left - viewportPadding
var rightEdgeOffset = pos.left + viewportPadding + actualWidth
if (leftEdgeOffset < viewportDimensions.left) { // left overflow
delta.left = viewportDimensions.left - leftEdgeOffset
} else if (rightEdgeOffset > viewportDimensions.right) { // right overflow
delta.left = viewportDimensions.left + viewportDimensions.width - rightEdgeOffset
}
}
return delta
}
Tooltip.prototype.getTitle = function () {
var title
var $e = this.$element
var o = this.options
title = $e.attr('data-original-title')
|| (typeof o.title == 'function' ? o.title.call($e[0]) : o.title)
return title
}
Tooltip.prototype.getUID = function (prefix) {
do prefix += ~~(Math.random() * 1000000)
while (document.getElementById(prefix))
return prefix
}
Tooltip.prototype.tip = function () {
if (!this.$tip) {
this.$tip = $(this.options.template)
if (this.$tip.length != 1) {
throw new Error(this.type + ' `template` option must consist of exactly 1 top-level element!')
}
}
return this.$tip
}
Tooltip.prototype.arrow = function () {
return (this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow'))
}
Tooltip.prototype.enable = function () {
this.enabled = true
}
Tooltip.prototype.disable = function () {
this.enabled = false
}
Tooltip.prototype.toggleEnabled = function () {
this.enabled = !this.enabled
}
Tooltip.prototype.toggle = function (e) {
var self = this
if (e) {
self = $(e.currentTarget).data('bs.' + this.type)
if (!self) {
self = new this.constructor(e.currentTarget, this.getDelegateOptions())
$(e.currentTarget).data('bs.' + this.type, self)
}
}
if (e) {
self.inState.click = !self.inState.click
if (self.isInStateTrue()) self.enter(self)
else self.leave(self)
} else {
self.tip().hasClass('in') ? self.leave(self) : self.enter(self)
}
}
Tooltip.prototype.destroy = function () {
var that = this
clearTimeout(this.timeout)
this.hide(function () {
that.$element.off('.' + that.type).removeData('bs.' + that.type)
if (that.$tip) {
that.$tip.detach()
}
that.$tip = null
that.$arrow = null
that.$viewport = null
})
}
// TOOLTIP PLUGIN DEFINITION
// =========================
function Plugin(option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.tooltip')
var options = typeof option == 'object' && option
if (!data && /destroy|hide/.test(option)) return
if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options)))
if (typeof option == 'string') data[option]()
})
}
var old = $.fn.tooltip
$.fn.tooltip = Plugin
$.fn.tooltip.Constructor = Tooltip
// TOOLTIP NO CONFLICT
// ===================
$.fn.tooltip.noConflict = function () {
$.fn.tooltip = old
return this
}
}(jQuery);
/* ========================================================================
* Bootstrap: popover.js v3.3.5
* http://getbootstrap.com/javascript/#popovers
* ========================================================================
* Copyright 2011-2015 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {
'use strict';
// POPOVER PUBLIC CLASS DEFINITION
// ===============================
var Popover = function (element, options) {
this.init('popover', element, options)
}
if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js')
Popover.VERSION = '3.3.5'
Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, {
placement: 'right',
trigger: 'click',
content: '',
template: '<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
})
// NOTE: POPOVER EXTENDS tooltip.js
// ================================
Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype)
Popover.prototype.constructor = Popover
Popover.prototype.getDefaults = function () {
return Popover.DEFAULTS
}
Popover.prototype.setContent = function () {
var $tip = this.tip()
var title = this.getTitle()
var content = this.getContent()
$tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title)
$tip.find('.popover-content').children().detach().end()[ // we use append for html objects to maintain js events
this.options.html ? (typeof content == 'string' ? 'html' : 'append') : 'text'
](content)
$tip.removeClass('fade top bottom left right in')
// IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do
// this manually by checking the contents.
if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide()
}
Popover.prototype.hasContent = function () {
return this.getTitle() || this.getContent()
}
Popover.prototype.getContent = function () {
var $e = this.$element
var o = this.options
return $e.attr('data-content')
|| (typeof o.content == 'function' ?
o.content.call($e[0]) :
o.content)
}
Popover.prototype.arrow = function () {
return (this.$arrow = this.$arrow || this.tip().find('.arrow'))
}
// POPOVER PLUGIN DEFINITION
// =========================
function Plugin(option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.popover')
var options = typeof option == 'object' && option
if (!data && /destroy|hide/.test(option)) return
if (!data) $this.data('bs.popover', (data = new Popover(this, options)))
if (typeof option == 'string') data[option]()
})
}
var old = $.fn.popover
$.fn.popover = Plugin
$.fn.popover.Constructor = Popover
// POPOVER NO CONFLICT
// ===================
$.fn.popover.noConflict = function () {
$.fn.popover = old
return this
}
}(jQuery);
/* ========================================================================
* Bootstrap: tab.js v3.3.5
* http://getbootstrap.com/javascript/#tabs
* ========================================================================
* Copyright 2011-2015 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {
'use strict';
// TAB CLASS DEFINITION
// ====================
var Tab = function (element) {
// jscs:disable requireDollarBeforejQueryAssignment
this.element = $(element)
// jscs:enable requireDollarBeforejQueryAssignment
}
Tab.VERSION = '3.3.5'
Tab.TRANSITION_DURATION = 150
Tab.prototype.show = function () {
var $this = this.element
var $ul = $this.closest('ul:not(.dropdown-menu)')
var selector = $this.data('target')
if (!selector) {
selector = $this.attr('href')
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
}
if ($this.parent('li').hasClass('active')) return
var $previous = $ul.find('.active:last a')
var hideEvent = $.Event('hide.bs.tab', {
relatedTarget: $this[0]
})
var showEvent = $.Event('show.bs.tab', {
relatedTarget: $previous[0]
})
$previous.trigger(hideEvent)
$this.trigger(showEvent)
if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) return
var $target = $(selector)
this.activate($this.closest('li'), $ul)
this.activate($target, $target.parent(), function () {
$previous.trigger({
type: 'hidden.bs.tab',
relatedTarget: $this[0]
})
$this.trigger({
type: 'shown.bs.tab',
relatedTarget: $previous[0]
})
})
}
Tab.prototype.activate = function (element, container, callback) {
var $active = container.find('> .active')
var transition = callback
&& $.support.transition
&& ($active.length && $active.hasClass('fade') || !!container.find('> .fade').length)
function next() {
$active
.removeClass('active')
.find('> .dropdown-menu > .active')
.removeClass('active')
.end()
.find('[data-toggle="tab"]')
.attr('aria-expanded', false)
element
.addClass('active')
.find('[data-toggle="tab"]')
.attr('aria-expanded', true)
if (transition) {
element[0].offsetWidth // reflow for transition
element.addClass('in')
} else {
element.removeClass('fade')
}
if (element.parent('.dropdown-menu').length) {
element
.closest('li.dropdown')
.addClass('active')
.end()
.find('[data-toggle="tab"]')
.attr('aria-expanded', true)
}
callback && callback()
}
$active.length && transition ?
$active
.one('bsTransitionEnd', next)
.emulateTransitionEnd(Tab.TRANSITION_DURATION) :
next()
$active.removeClass('in')
}
// TAB PLUGIN DEFINITION
// =====================
function Plugin(option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.tab')
if (!data) $this.data('bs.tab', (data = new Tab(this)))
if (typeof option == 'string') data[option]()
})
}
var old = $.fn.tab
$.fn.tab = Plugin
$.fn.tab.Constructor = Tab
// TAB NO CONFLICT
// ===============
$.fn.tab.noConflict = function () {
$.fn.tab = old
return this
}
// TAB DATA-API
// ============
var clickHandler = function (e) {
e.preventDefault()
Plugin.call($(this), 'show')
}
$(document)
.on('click.bs.tab.data-api', '[data-toggle="tab"]', clickHandler)
.on('click.bs.tab.data-api', '[data-toggle="pill"]', clickHandler)
}(jQuery);
/* ========================================================================
* Bootstrap: affix.js v3.3.5
* http://getbootstrap.com/javascript/#affix
* ========================================================================
* Copyright 2011-2015 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {
'use strict';
// AFFIX CLASS DEFINITION
// ======================
var Affix = function (element, options) {
this.options = $.extend({}, Affix.DEFAULTS, options)
this.$target = $(this.options.target)
.on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this))
.on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this))
this.$element = $(element)
this.affixed = null
this.unpin = null
this.pinnedOffset = null
this.checkPosition()
}
Affix.VERSION = '3.3.5'
Affix.RESET = 'affix affix-top affix-bottom'
Affix.DEFAULTS = {
offset: 0,
target: window
}
Affix.prototype.getState = function (scrollHeight, height, offsetTop, offsetBottom) {
var scrollTop = this.$target.scrollTop()
var position = this.$element.offset()
var targetHeight = this.$target.height()
if (offsetTop != null && this.affixed == 'top') return scrollTop < offsetTop ? 'top' : false
if (this.affixed == 'bottom') {
if (offsetTop != null) return (scrollTop + this.unpin <= position.top) ? false : 'bottom'
return (scrollTop + targetHeight <= scrollHeight - offsetBottom) ? false : 'bottom'
}
var initializing = this.affixed == null
var colliderTop = initializing ? scrollTop : position.top
var colliderHeight = initializing ? targetHeight : height
if (offsetTop != null && scrollTop <= offsetTop) return 'top'
if (offsetBottom != null && (colliderTop + colliderHeight >= scrollHeight - offsetBottom)) return 'bottom'
return false
}
Affix.prototype.getPinnedOffset = function () {
if (this.pinnedOffset) return this.pinnedOffset
this.$element.removeClass(Affix.RESET).addClass('affix')
var scrollTop = this.$target.scrollTop()
var position = this.$element.offset()
return (this.pinnedOffset = position.top - scrollTop)
}
Affix.prototype.checkPositionWithEventLoop = function () {
setTimeout($.proxy(this.checkPosition, this), 1)
}
Affix.prototype.checkPosition = function () {
if (!this.$element.is(':visible')) return
var height = this.$element.height()
var offset = this.options.offset
var offsetTop = offset.top
var offsetBottom = offset.bottom
var scrollHeight = Math.max($(document).height(), $(document.body).height())
if (typeof offset != 'object') offsetBottom = offsetTop = offset
if (typeof offsetTop == 'function') offsetTop = offset.top(this.$element)
if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element)
var affix = this.getState(scrollHeight, height, offsetTop, offsetBottom)
if (this.affixed != affix) {
if (this.unpin != null) this.$element.css('top', '')
var affixType = 'affix' + (affix ? '-' + affix : '')
var e = $.Event(affixType + '.bs.affix')
this.$element.trigger(e)
if (e.isDefaultPrevented()) return
this.affixed = affix
this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null
this.$element
.removeClass(Affix.RESET)
.addClass(affixType)
.trigger(affixType.replace('affix', 'affixed') + '.bs.affix')
}
if (affix == 'bottom') {
this.$element.offset({
top: scrollHeight - height - offsetBottom
})
}
}
// AFFIX PLUGIN DEFINITION
// =======================
function Plugin(option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.affix')
var options = typeof option == 'object' && option
if (!data) $this.data('bs.affix', (data = new Affix(this, options)))
if (typeof option == 'string') data[option]()
})
}
var old = $.fn.affix
$.fn.affix = Plugin
$.fn.affix.Constructor = Affix
// AFFIX NO CONFLICT
// =================
$.fn.affix.noConflict = function () {
$.fn.affix = old
return this
}
// AFFIX DATA-API
// ==============
$(window).on('load', function () {
$('[data-spy="affix"]').each(function () {
var $spy = $(this)
var data = $spy.data()
data.offset = data.offset || {}
if (data.offsetBottom != null) data.offset.bottom = data.offsetBottom
if (data.offsetTop != null) data.offset.top = data.offsetTop
Plugin.call($spy, data)
})
})
}(jQuery);
/* ========================================================================
* Bootstrap: collapse.js v3.3.5
* http://getbootstrap.com/javascript/#collapse
* ========================================================================
* Copyright 2011-2015 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {
'use strict';
// COLLAPSE PUBLIC CLASS DEFINITION
// ================================
var Collapse = function (element, options) {
this.$element = $(element)
this.options = $.extend({}, Collapse.DEFAULTS, options)
this.$trigger = $('[data-toggle="collapse"][href="#' + element.id + '"],' +
'[data-toggle="collapse"][data-target="#' + element.id + '"]')
this.transitioning = null
if (this.options.parent) {
this.$parent = this.getParent()
} else {
this.addAriaAndCollapsedClass(this.$element, this.$trigger)
}
if (this.options.toggle) this.toggle()
}
Collapse.VERSION = '3.3.5'
Collapse.TRANSITION_DURATION = 350
Collapse.DEFAULTS = {
toggle: true
}
Collapse.prototype.dimension = function () {
var hasWidth = this.$element.hasClass('width')
return hasWidth ? 'width' : 'height'
}
Collapse.prototype.show = function () {
if (this.transitioning || this.$element.hasClass('in')) return
var activesData
var actives = this.$parent && this.$parent.children('.panel').children('.in, .collapsing')
if (actives && actives.length) {
activesData = actives.data('bs.collapse')
if (activesData && activesData.transitioning) return
}
var startEvent = $.Event('show.bs.collapse')
this.$element.trigger(startEvent)
if (startEvent.isDefaultPrevented()) return
if (actives && actives.length) {
Plugin.call(actives, 'hide')
activesData || actives.data('bs.collapse', null)
}
var dimension = this.dimension()
this.$element
.removeClass('collapse')
.addClass('collapsing')[dimension](0)
.attr('aria-expanded', true)
this.$trigger
.removeClass('collapsed')
.attr('aria-expanded', true)
this.transitioning = 1
var complete = function () {
this.$element
.removeClass('collapsing')
.addClass('collapse in')[dimension]('')
this.transitioning = 0
this.$element
.trigger('shown.bs.collapse')
}
if (!$.support.transition) return complete.call(this)
var scrollSize = $.camelCase(['scroll', dimension].join('-'))
this.$element
.one('bsTransitionEnd', $.proxy(complete, this))
.emulateTransitionEnd(Collapse.TRANSITION_DURATION)[dimension](this.$element[0][scrollSize])
}
Collapse.prototype.hide = function () {
if (this.transitioning || !this.$element.hasClass('in')) return
var startEvent = $.Event('hide.bs.collapse')
this.$element.trigger(startEvent)
if (startEvent.isDefaultPrevented()) return
var dimension = this.dimension()
this.$element[dimension](this.$element[dimension]())[0].offsetHeight
this.$element
.addClass('collapsing')
.removeClass('collapse in')
.attr('aria-expanded', false)
this.$trigger
.addClass('collapsed')
.attr('aria-expanded', false)
this.transitioning = 1
var complete = function () {
this.transitioning = 0
this.$element
.removeClass('collapsing')
.addClass('collapse')
.trigger('hidden.bs.collapse')
}
if (!$.support.transition) return complete.call(this)
this.$element
[dimension](0)
.one('bsTransitionEnd', $.proxy(complete, this))
.emulateTransitionEnd(Collapse.TRANSITION_DURATION)
}
Collapse.prototype.toggle = function () {
this[this.$element.hasClass('in') ? 'hide' : 'show']()
}
Collapse.prototype.getParent = function () {
return $(this.options.parent)
.find('[data-toggle="collapse"][data-parent="' + this.options.parent + '"]')
.each($.proxy(function (i, element) {
var $element = $(element)
this.addAriaAndCollapsedClass(getTargetFromTrigger($element), $element)
}, this))
.end()
}
Collapse.prototype.addAriaAndCollapsedClass = function ($element, $trigger) {
var isOpen = $element.hasClass('in')
$element.attr('aria-expanded', isOpen)
$trigger
.toggleClass('collapsed', !isOpen)
.attr('aria-expanded', isOpen)
}
function getTargetFromTrigger($trigger) {
var href
var target = $trigger.attr('data-target')
|| (href = $trigger.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') // strip for ie7
return $(target)
}
// COLLAPSE PLUGIN DEFINITION
// ==========================
function Plugin(option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.collapse')
var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option)
if (!data && options.toggle && /show|hide/.test(option)) options.toggle = false
if (!data) $this.data('bs.collapse', (data = new Collapse(this, options)))
if (typeof option == 'string') data[option]()
})
}
var old = $.fn.collapse
$.fn.collapse = Plugin
$.fn.collapse.Constructor = Collapse
// COLLAPSE NO CONFLICT
// ====================
$.fn.collapse.noConflict = function () {
$.fn.collapse = old
return this
}
// COLLAPSE DATA-API
// =================
$(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function (e) {
var $this = $(this)
if (!$this.attr('data-target')) e.preventDefault()
var $target = getTargetFromTrigger($this)
var data = $target.data('bs.collapse')
var option = data ? 'toggle' : $this.data()
Plugin.call($target, option)
})
}(jQuery);
/* ========================================================================
* Bootstrap: scrollspy.js v3.3.5
* http://getbootstrap.com/javascript/#scrollspy
* ========================================================================
* Copyright 2011-2015 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {
'use strict';
// SCROLLSPY CLASS DEFINITION
// ==========================
function ScrollSpy(element, options) {
this.$body = $(document.body)
this.$scrollElement = $(element).is(document.body) ? $(window) : $(element)
this.options = $.extend({}, ScrollSpy.DEFAULTS, options)
this.selector = (this.options.target || '') + ' .nav li > a'
this.offsets = []
this.targets = []
this.activeTarget = null
this.scrollHeight = 0
this.$scrollElement.on('scroll.bs.scrollspy', $.proxy(this.process, this))
this.refresh()
this.process()
}
ScrollSpy.VERSION = '3.3.5'
ScrollSpy.DEFAULTS = {
offset: 10
}
ScrollSpy.prototype.getScrollHeight = function () {
return this.$scrollElement[0].scrollHeight || Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight)
}
ScrollSpy.prototype.refresh = function () {
var that = this
var offsetMethod = 'offset'
var offsetBase = 0
this.offsets = []
this.targets = []
this.scrollHeight = this.getScrollHeight()
if (!$.isWindow(this.$scrollElement[0])) {
offsetMethod = 'position'
offsetBase = this.$scrollElement.scrollTop()
}
this.$body
.find(this.selector)
.map(function () {
var $el = $(this)
var href = $el.data('target') || $el.attr('href')
var $href = /^#./.test(href) && $(href)
return ($href
&& $href.length
&& $href.is(':visible')
&& [[$href[offsetMethod]().top + offsetBase, href]]) || null
})
.sort(function (a, b) { return a[0] - b[0] })
.each(function () {
that.offsets.push(this[0])
that.targets.push(this[1])
})
}
ScrollSpy.prototype.process = function () {
var scrollTop = this.$scrollElement.scrollTop() + this.options.offset
var scrollHeight = this.getScrollHeight()
var maxScroll = this.options.offset + scrollHeight - this.$scrollElement.height()
var offsets = this.offsets
var targets = this.targets
var activeTarget = this.activeTarget
var i
if (this.scrollHeight != scrollHeight) {
this.refresh()
}
if (scrollTop >= maxScroll) {
return activeTarget != (i = targets[targets.length - 1]) && this.activate(i)
}
if (activeTarget && scrollTop < offsets[0]) {
this.activeTarget = null
return this.clear()
}
for (i = offsets.length; i--;) {
activeTarget != targets[i]
&& scrollTop >= offsets[i]
&& (offsets[i + 1] === undefined || scrollTop < offsets[i + 1])
&& this.activate(targets[i])
}
}
ScrollSpy.prototype.activate = function (target) {
this.activeTarget = target
this.clear()
var selector = this.selector +
'[data-target="' + target + '"],' +
this.selector + '[href="' + target + '"]'
var active = $(selector)
.parents('li')
.addClass('active')
if (active.parent('.dropdown-menu').length) {
active = active
.closest('li.dropdown')
.addClass('active')
}
active.trigger('activate.bs.scrollspy')
}
ScrollSpy.prototype.clear = function () {
$(this.selector)
.parentsUntil(this.options.target, '.active')
.removeClass('active')
}
// SCROLLSPY PLUGIN DEFINITION
// ===========================
function Plugin(option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.scrollspy')
var options = typeof option == 'object' && option
if (!data) $this.data('bs.scrollspy', (data = new ScrollSpy(this, options)))
if (typeof option == 'string') data[option]()
})
}
var old = $.fn.scrollspy
$.fn.scrollspy = Plugin
$.fn.scrollspy.Constructor = ScrollSpy
// SCROLLSPY NO CONFLICT
// =====================
$.fn.scrollspy.noConflict = function () {
$.fn.scrollspy = old
return this
}
// SCROLLSPY DATA-API
// ==================
$(window).on('load.bs.scrollspy.data-api', function () {
$('[data-spy="scroll"]').each(function () {
var $spy = $(this)
Plugin.call($spy, $spy.data())
})
})
}(jQuery);
/* ========================================================================
* Bootstrap: transition.js v3.3.5
* http://getbootstrap.com/javascript/#transitions
* ========================================================================
* Copyright 2011-2015 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {
'use strict';
// CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/)
// ============================================================
function transitionEnd() {
var el = document.createElement('bootstrap')
var transEndEventNames = {
WebkitTransition : 'webkitTransitionEnd',
MozTransition : 'transitionend',
OTransition : 'oTransitionEnd otransitionend',
transition : 'transitionend'
}
for (var name in transEndEventNames) {
if (el.style[name] !== undefined) {
return { end: transEndEventNames[name] }
}
}
return false // explicit for ie8 ( ._.)
}
// http://blog.alexmaccaw.com/css-transitions
$.fn.emulateTransitionEnd = function (duration) {
var called = false
var $el = this
$(this).one('bsTransitionEnd', function () { called = true })
var callback = function () { if (!called) $($el).trigger($.support.transition.end) }
setTimeout(callback, duration)
return this
}
$(function () {
$.support.transition = transitionEnd()
if (!$.support.transition) return
$.event.special.bsTransitionEnd = {
bindType: $.support.transition.end,
delegateType: $.support.transition.end,
handle: function (e) {
if ($(e.target).is(this)) return e.handleObj.handler.apply(this, arguments)
}
}
})
}(jQuery);
| cuckopl/wordpress | wp-content/themes/restaurante/js/bootstrap.js | JavaScript | gpl-2.0 | 69,126 |
var u = require('util');
addStrings({
eng: {
UNHOLY_ARMOR_AFFECT: "You feel unholy-armored.",
UNHOLY_ARMOR_UNAFFECT: "Your unholy armor has fallen."
}
});
module.exports = {
requires: function(ch) {
if (ch.NPC())
return false;
var allowed = Object.keys(this).remove('requires', 'init');
if (ch.imp())
allowed.remove('raise spirit');
return allowed;
},
init: function(re) {
char.on('init', function() {
//char.instanceMethods.social = social;
//char.instanceMethods.canSocial = canSocial;
});
},
'raise spectre': function(arg) {
var ch = this;
ch.send('raise spectre: '+ arg.join(' '));
},
'raise spirit': function(arg) {
var ch = this;
ch.send('raise spirit: '+ arg.join(' '));
},
'unholy armor': function(arg) {
var ch = this;
ch.setAff({
'unholy armor': {
affects: {
armor: 2
},
expires: now() + (5).minutes(),
msg: my().UNHOLY_ARMOR_UNAFFECT
}
});
ch.send(my().UNHOLY_ARMOR_AFFECT);
}
}; | plamzi/Havoc | plugins/act.necro.js | JavaScript | gpl-2.0 | 1,037 |
jQuery(document).ready(function() {
jQuery('#thisdate').datetimepicker({
timepicker:false,
mask: true,
format:'Y-m-d'
});
jQuery('#thisdate2').datetimepicker({
timepicker:false,
mask: true,
format:'Y-m-d'
});
jQuery('.esod-date').datetimepicker({
timepicker:false,
mask: false,
format:'Y-m-d'
});
jQuery('#repeatuntil').datetimepicker({
timepicker:false,
mask: true,
format:'Y-m-d'
});
jQuery('#starttime').datetimepicker({
datepicker:false,
// mask: true,
format:'H:i',
step: 15,
});
jQuery('#endtime').datetimepicker({
datepicker:false,
// mask: true,
format:'H:i',
step: 15,
});
jQuery('.starttime').datetimepicker({
datepicker:false,
// mask: true,
format:'H:i',
step: 15,
});
jQuery('.endtime').datetimepicker({
datepicker:false,
// mask: true,
format:'H:i',
step: 15,
});
jQuery('#clockin').datetimepicker({
datepicker:false,
// mask: true,
format:'H:i',
step: 15,
});
jQuery('#clockout').datetimepicker({
datepicker:false,
// mask: true,
format:'H:i',
step: 15,
});
if(jQuery("#repeat").is(':checked'))
jQuery("#repeatfields").show(); // checked
else
jQuery("#repeatfields").hide(); // unchecked
jQuery('#repeat').onchange = function() {
jQuery('#repeatfields').style.display = this.checked ? 'block' : 'none';
};
var availabilityTemplate = jQuery('#availability-template').html();
// Add a new repeating section on user profile (only used by On Demand add-on)
jQuery('.repeat-availability').click(function(e){
e.preventDefault();
var repeating = jQuery(availabilityTemplate);
var lastRepeatingGroup = jQuery('.repeating-availability').last();
var idx = lastRepeatingGroup.index();
var attrs = ['for', 'id', 'name'];
var tags = repeating.find('input, label, select');
tags.each(function() {
var section = jQuery(this);
jQuery.each(attrs, function(i, attr) {
var attr_val = section.attr(attr);
if (attr_val) {
section.attr( attr, attr_val.replace( /\[\d+\]\[/, '\['+( idx + 1 )+'\]\[' ) );
}
})
});
lastRepeatingGroup.after(repeating);
repeating.find('.starttime').datetimepicker({
datepicker:false,
format:'H:i',
step: 15,
});
repeating.find('.endtime').datetimepicker({
datepicker:false,
format:'H:i',
step: 15,
});
});
jQuery('body').on('click', 'a.remove-availability', function(e){
e.preventDefault();
jQuery(this).closest('.repeating-availability').remove();
});
jQuery('#esod-employer-work-request').on( 'submit', function (e){
jQuery('#esod-loading').show();
});
});
| jorgehjr84/LAVEmployeePortal | wp-content/plugins/employee-scheduler/js/wpaesmscripts.js | JavaScript | gpl-2.0 | 2,731 |
/*
* Copyright (C) 2005-2010 Team XBMC
* http://www.xbmc.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with XBMC; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
var MediaLibrary = function() {
this.init();
return true;
}
MediaLibrary.prototype = {
playlists: { },
init: function() {
this.bindControls();
this.getPlaylists();
},
bindControls: function() {
$('#musicLibrary').click(jQuery.proxy(this.musicLibraryOpen, this));
$('#movieLibrary').click(jQuery.proxy(this.movieLibraryOpen, this));
$('#tvshowLibrary').click(jQuery.proxy(this.tvshowLibraryOpen, this));
$('#pictureLibrary').click(jQuery.proxy(this.pictureLibraryOpen, this));
$('#remoteControl').click(jQuery.proxy(this.remoteControlOpen, this));
$('#overlay').click(jQuery.proxy(this.hideOverlay, this));
$(window).resize(jQuery.proxy(this.updatePlayButtonLocation, this));
},
resetPage: function() {
$('#musicLibrary').removeClass('selected');
$('#movieLibrary').removeClass('selected');
$('#tvshowLibrary').removeClass('selected');
$('#remoteControl').removeClass('selected');
$('#pictureLibrary').removeClass('selected');
this.hideOverlay();
},
replaceAll: function(haystack, find, replace) {
var parts = haystack.split(find);
var result = "";
var first = true;
for (index in parts)
{
if (!first)
result += replace;
else
first = false;
result += parts[index];
}
return result;
},
getPlaylists: function() {
jQuery.ajax({
type: 'POST',
url: JSON_RPC + '?GetPlaylists',
data: '{"jsonrpc": "2.0", "method": "Playlist.GetPlaylists", "id": 1}',
timeout: 3000,
success: jQuery.proxy(function(data) {
if (data && data.result && data.result.length > 0) {
$.each($(data.result), jQuery.proxy(function(i, item) {
this.playlists[item.type] = item.playlistid;
}, this));
}
}, this),
error: jQuery.proxy(function(data, error) {
displayCommunicationError();
setTimeout(jQuery.proxy(this.updateState, this), 2000);
}, this),
dataType: 'json'});
},
remoteControlOpen: function(event) {
this.resetPage();
$('#remoteControl').addClass('selected');
$('.contentContainer').hide();
var libraryContainer = $('#remoteContainer');
if (!libraryContainer || libraryContainer.length == 0) {
$('#spinner').show();
libraryContainer = $('<div>');
libraryContainer.attr('id', 'remoteContainer')
.addClass('contentContainer');
$('#content').append(libraryContainer);
var keys=[
{name:'up',width:'40px',height:'30px',top:'28px',left:'58px'}
,{name:'down',width:'40px',height:'30px',top:'122px',left:'58px'}
,{name:'left',width:'40px',height:'30px',top:'74px',left:'15px'}
,{name:'right',width:'40px',height:'30px',top:'74px',left:'104px'}
,{name:'ok',width:'40px',height:'30px',top:'74px',left:'58px'}
,{name:'back',width:'40px',height:'30px',top:'13px',left:'161px'}
,{name:'home',width:'40px',height:'30px',top:'154px',left:'8px'}
,{name:'mute',width:'40px',height:'30px',top:'107px',left:'391px'}
,{name:'power',width:'30px',height:'30px',top:'-3px',left:'13px'}
,{name:'volumeup',width:'30px',height:'30px',top:'49px',left:'422px'}
,{name:'volumedown',width:'30px',height:'30px',top:'49px',left:'367px'}
,{name:'playpause',width:'32px',height:'23px',top:'62px',left:'260px'}
,{name:'stop',width:'32px',height:'23px',top:'62px',left:'211px'}
,{name:'next',width:'38px',height:'25px',top:'102px',left:'304px'}
,{name:'previous',width:'38px',height:'25px',top:'101px',left:'160px'}
,{name:'forward',width:'32px',height:'23px',top:'102px',left:'259px'}
,{name:'rewind',width:'32px',height:'23px',top:'101px',left:'211px'}
,{name:'cleanlib_a',width:'46px',height:'26px',top:'47px',left:'553px'}
,{name:'updatelib_a',width:'46px',height:'26px',top:'47px',left:'492px'}
,{name:'cleanlib_v',width:'46px',height:'26px',top:'111px',left:'553px'}
,{name:'updatelib_v',width:'46px',height:'26px',top:'111px',left:'492px'}
];
for (var akey in keys) {
var aremotekey=$('<p>').attr('id',keys[akey]['name']);
aremotekey.addClass('remote_key')
.css('height',keys[akey]['height'])
.css('width',keys[akey]['width'])
.css('top',keys[akey]['top'])
.css('left',keys[akey]['left'])
//.css('border','1px solid black')
.bind('click',{key: keys[akey]['name']},jQuery.proxy(this.pressRemoteKey,this));
libraryContainer.append(aremotekey);
}
} else {
libraryContainer.show();
libraryContainer.trigger('scroll');
}
$('#spinner').hide();
},
pressRemoteKey: function(event) {
var keyPressed=event.data.key;
$('#spinner').show();
var player = -1;
// TODO: Get active player
if($('#videoDescription').is(':visible'))
player = this.playlists["video"];
else if($('#audioDescription').is(':visible'))
player = this.playlists["audio"];
//common part
switch(keyPressed) {
case 'cleanlib_a':
jQuery.post(JSON_RPC + '?SendRemoteKey', '{"jsonrpc": "2.0", "method": "AudioLibrary.Clean", "id": 1}', function(data){$('#spinner').hide();}, 'json');
return;
case 'updatelib_a':
jQuery.post(JSON_RPC + '?SendRemoteKey', '{"jsonrpc": "2.0", "method": "AudioLibrary.Scan", "id": 1}', function(data){$('#spinner').hide();}, 'json');
return;
case 'cleanlib_v':
jQuery.post(JSON_RPC + '?SendRemoteKey', '{"jsonrpc": "2.0", "method": "VideoLibrary.Clean", "id": 1}', function(data){$('#spinner').hide();}, 'json');
return;
case 'updatelib_v':
jQuery.post(JSON_RPC + '?SendRemoteKey', '{"jsonrpc": "2.0", "method": "VideoLibrary.Scan", "id": 1}', function(data){$('#spinner').hide();}, 'json');
return;
case 'back':
jQuery.post(JSON_RPC + '?SendRemoteKey', '{"jsonrpc": "2.0", "method": "Input.Back", "id": 1}', function(data){$('#spinner').hide();}, 'json');
return;
case 'home':
jQuery.post(JSON_RPC + '?SendRemoteKey', '{"jsonrpc": "2.0", "method": "Input.Home", "id": 1}', function(data){$('#spinner').hide();}, 'json');
return;
case 'mute':
jQuery.post(JSON_RPC + '?SendRemoteKey', '{"jsonrpc": "2.0", "method": "Application.SetMute", "params": { "mute": "toggle" }, "id": 1}', function(data){$('#spinner').hide();}, 'json');
return;
case 'power':
jQuery.post(JSON_RPC + '?SendRemoteKey', '{"jsonrpc": "2.0", "method": "System.Shutdown", "id": 1}', function(data){$('#spinner').hide();}, 'json');
return;
case 'volumeup':
jQuery.post(JSON_RPC + '?SendRemoteKey', '{"jsonrpc": "2.0", "method": "Application.GetProperties", "params": { "properties": [ "volume" ] }, "id": 1}', function(data){
var volume = data.result.volume + 1;
jQuery.post(JSON_RPC + '?SendRemoteKey', '{"jsonrpc": "2.0", "method": "Application.SetVolume", "params": { "volume": '+volume+' }, "id": 1}', function(data){
$('#spinner').hide();
}, 'json');
}, 'json');
return;
case 'volumedown':
jQuery.post(JSON_RPC + '?SendRemoteKey', '{"jsonrpc": "2.0", "method": "Application.GetProperties", "params": { "properties": [ "volume" ] }, "id": 1}', function(data){
var volume = data.result.volume - 1;
jQuery.post(JSON_RPC + '?SendRemoteKey', '{"jsonrpc": "2.0", "method": "Application.SetVolume", "params": { "volume": '+volume+' }, "id": 1}', function(data){
$('#spinner').hide();
}, 'json');
}, 'json');
return;
}
//menus or other sections
if (player == -1)
{
switch(keyPressed) {
case 'up':
jQuery.post(JSON_RPC + '?SendRemoteKey', '{"jsonrpc": "2.0", "method": "Input.Up", "id": 1}', function(data){$('#spinner').hide();}, 'json');
return;
case 'down':
jQuery.post(JSON_RPC + '?SendRemoteKey', '{"jsonrpc": "2.0", "method": "Input.Down", "id": 1}', function(data){$('#spinner').hide();}, 'json');
return;
case 'left':
jQuery.post(JSON_RPC + '?SendRemoteKey', '{"jsonrpc": "2.0", "method": "Input.Left", "id": 1}', function(data){$('#spinner').hide();}, 'json');
return;
case 'right':
jQuery.post(JSON_RPC + '?SendRemoteKey', '{"jsonrpc": "2.0", "method": "Input.Right", "id": 1}', function(data){$('#spinner').hide();}, 'json');
return;
case 'ok':
jQuery.post(JSON_RPC + '?SendRemoteKey', '{"jsonrpc": "2.0", "method": "Input.Select", "id": 1}', function(data){$('#spinner').hide();}, 'json');
return;
}
}
if (player >= 0)
{
switch(keyPressed) {
case 'up':
jQuery.post(JSON_RPC + '?SendRemoteKey', '{"jsonrpc": "2.0", "method": "Player.Seek", "params": { "playerid": ' + player + ', "value": "bigforward" }, "id": 1}', function(data){$('#spinner').hide();}, 'json');
return;
case 'down':
jQuery.post(JSON_RPC + '?SendRemoteKey', '{"jsonrpc": "2.0", "method": "Player.Seek", "params": { "playerid": ' + player + ', "value": "bigbackward" }, "id": 1}', function(data){$('#spinner').hide();}, 'json');
return;
case 'left':
jQuery.post(JSON_RPC + '?SendRemoteKey', '{"jsonrpc": "2.0", "method": "Player.Seek", "params": { "playerid": ' + player + ', "value": "smallbackward" }, "id": 1}', function(data){$('#spinner').hide();}, 'json');
return;
case 'right':
jQuery.post(JSON_RPC + '?SendRemoteKey', '{"jsonrpc": "2.0", "method": "Player.Seek", "params": { "playerid": ' + player + ', "value": "smallforward" }, "id": 1}', function(data){$('#spinner').hide();}, 'json');
return;
case 'playpause':
jQuery.post(JSON_RPC + '?SendRemoteKey', '{"jsonrpc": "2.0", "method": "Player.PlayPause", "params": { "playerid": ' + player + ' }, "id": 1}', function(data){$('#spinner').hide();}, 'json');
return;
case 'stop':
jQuery.post(JSON_RPC + '?SendRemoteKey', '{"jsonrpc": "2.0", "method": "Player.Stop", "params": { "playerid": ' + player + ' }, "id": 1}', function(data){$('#spinner').hide();}, 'json');
return;
case 'next':
jQuery.post(JSON_RPC + '?SendRemoteKey', '{"jsonrpc": "2.0", "method": "Player.GoNext", "params": { "playerid": ' + player + ' }, "id": 1}', function(data){$('#spinner').hide();}, 'json');
return;
case 'previous':
jQuery.post(JSON_RPC + '?SendRemoteKey', '{"jsonrpc": "2.0", "method": "Player.GoPrevious", "params": { "playerid": ' + player + ' }, "id": 1}', function(data){$('#spinner').hide();}, 'json');
return;
case 'forward':
jQuery.post(JSON_RPC + '?SendRemoteKey', '{"jsonrpc": "2.0", "method": "Player.SetSpeed", "params": { "playerid": ' + player + ', "speed": "increment" }, "id": 1}', function(data){$('#spinner').hide();}, 'json');
return;
case 'rewind':
jQuery.post(JSON_RPC + '?SendRemoteKey', '{"jsonrpc": "2.0", "method": "Player.SetSpeed", "params": { "playerid": ' + player + ', "speed": "decrement" }, "id": 1}', function(data){$('#spinner').hide();}, 'json');
return;
}
}
},
musicLibraryOpen: function(event) {
this.resetPage();
$('#musicLibrary').addClass('selected');
$('.contentContainer').hide();
var libraryContainer = $('#libraryContainer');
if (!libraryContainer || libraryContainer.length == 0) {
$('#spinner').show();
libraryContainer = $('<div>');
libraryContainer.attr('id', 'libraryContainer')
.addClass('contentContainer');
$('#content').append(libraryContainer);
jQuery.post(JSON_RPC + '?GetAlbums', '{"jsonrpc": "2.0", "method": "AudioLibrary.GetAlbums", "params": { "limits": { "start": 0 }, "properties": ["description", "theme", "mood", "style", "type", "albumlabel", "artist", "genre", "rating", "title", "year", "thumbnail"], "sort": { "method": "artist" } }, "id": 1}', jQuery.proxy(function(data) {
if (data && data.result && data.result.albums) {
this.albumList = data.result.albums;
$.each($(this.albumList), jQuery.proxy(function(i, item) {
var floatableAlbum = this.generateThumb('album', item.thumbnail, item.title, item.artist);
floatableAlbum.bind('click', { album: item }, jQuery.proxy(this.displayAlbumDetails, this));
libraryContainer.append(floatableAlbum);
}, this));
libraryContainer.append($('<div>').addClass('footerPadding'));
$('#spinner').hide();
libraryContainer.bind('scroll', { activeLibrary: libraryContainer }, jQuery.proxy(this.updateScrollEffects, this));
libraryContainer.trigger('scroll');
myScroll = new iScroll('libraryContainer');
} else {
libraryContainer.html('');
}
}, this), 'json');
} else {
libraryContainer.show();
libraryContainer.trigger('scroll');
}
},
getThumbnailPath: function(thumbnail) {
return thumbnail ? ('/vfs/' + thumbnail) : DEFAULT_ALBUM_COVER;
},
generateThumb: function(type, thumbnail, title, artist) {
var floatableAlbum = $('<div>');
var path = this.getThumbnailPath(thumbnail);
title = title || '';
artist = artist ||'';
if (title.length > 18 && !(title.length <= 21)) {
title = title.substring(0, 18) + '...';
}
if (artist.length > 20 && !(artist.length <= 22)) {
artist = artist.substring(0, 20) + '...';
}
var className = '';
var code = '';
switch(type) {
case 'album':
className = 'floatableAlbum';
code = '<p class="album" title="' + title + '">' + title + '</p><p class="artist" title="' + artist + '">' + artist + '</p>';
break;
case 'movie':
className = 'floatableMovieCover';
code = '<p class="album" title="' + title + '">' + title + '</p>';
break;
case 'tvshow':
className = 'floatableTVShowCover';
break;
case 'tvshowseason':
className = 'floatableTVShowCoverSeason';
break;
case 'image':
case 'directory':
className = 'floatableAlbum';
code = '<p class="album" title="' + title + '">' + title + '</p>';
break;
}
return floatableAlbum.addClass(className).html('<div class="imgWrapper"><div class="inner"><img src="' + path + '" alt="' + title + '" /></div></div>' + code);
},
showAlbumSelectorBlock: function(album) {
if (album) {
//Find album in stored array
var prevAlbum = null,
nextAlbum = null;
$.each($(this.albumList), jQuery.proxy(function(i, item) {
if (item.albumid == album.albumid) {
if (this.albumList.length > 1) {
prevAlbum = this.albumList[i <= 0 ? this.albumList.length-1 : i-1];
nextAlbum = this.albumList[i >= this.albumList.length ? 0 : i+1];
}
return false; /* .each break */
}
}, this));
var albumSelectorBlock = $('#albumSelector');
if (!albumSelectorBlock || albumSelectorBlock.length == 0) {
albumSelectorBlock = $('<div>');
albumSelectorBlock.attr('id', 'albumSelector')
.html('<table><tr><td class="allAlbums">All Albums</td><td class="activeAlbumTitle"></td><td class="prevAlbum"> </td><td class="nextAlbum"> </td></tr></table>');
$('#content').prepend(albumSelectorBlock);
$('#albumSelector .allAlbums').bind('click', jQuery.proxy(this.hideAlbumDetails, this));
}
$('#albumSelector .prevAlbum').unbind();
$('#albumSelector .nextAlbum').unbind();
if (prevAlbum) {
$('#albumSelector .prevAlbum').bind('click', {album: prevAlbum}, jQuery.proxy(this.displayAlbumDetails, this));
}
if (nextAlbum) {
$('#albumSelector .nextAlbum').bind('click', {album: nextAlbum}, jQuery.proxy(this.displayAlbumDetails, this));
}
$('#albumSelector .activeAlbumTitle').html(album.title||'Unknown Album');
albumSelectorBlock.show();
}
},
hideAlbumDetails: function() {
$('.contentContainer').hide();
this.musicLibraryOpen();
},
displayAlbumDetails: function(event) {
this.showAlbumSelectorBlock(event.data.album);
var albumDetailsContainer = $('#albumDetails' + event.data.album.albumid);
$('#topScrollFade').hide();
if (!albumDetailsContainer || albumDetailsContainer.length == 0) {
$('#spinner').show();
jQuery.post(JSON_RPC + '?GetSongs', '{"jsonrpc": "2.0", "method": "AudioLibrary.GetSongs", "params": { "properties": ["title", "artist", "genre", "track", "duration", "year", "rating", "playcount"], "albumid" : ' + event.data.album.albumid + ' }, "id": 1}', jQuery.proxy(function(data) {
albumDetailsContainer = $('<div>');
albumDetailsContainer.attr('id', 'albumDetails' + event.data.album.albumid)
.addClass('contentContainer')
.addClass('albumContainer')
.html('<table class="albumView"><thead><tr class="headerRow"><th>Artwork</th><th> </th><th>Name</th><th class="time">Time</th><th>Artist</th><th>Genre</th></tr></thead><tbody class="resultSet"></tbody></table>');
$('.contentContainer').hide();
$('#content').append(albumDetailsContainer);
var albumThumbnail = event.data.album.thumbnail;
var albumTitle = event.data.album.title||'Unknown Album';
var albumArtist = event.data.album.artist||'Unknown Artist';
var trackCount = data.result.limits.total;
$.each($(data.result.songs), jQuery.proxy(function(i, item) {
if (i == 0) {
var trackRow = $('<tr>').addClass('trackRow').addClass('tr' + i % 2);
trackRow.append($('<td>').attr('rowspan', ++trackCount + 1).addClass('albumThumb'));
for (var a = 0; a < 5; a++) {
trackRow.append($('<td>').html(' ').attr('style', 'display: none'));
}
$('#albumDetails' + event.data.album.albumid + ' .resultSet').append(trackRow);
}
var trackRow = $('<tr>').addClass('trackRow').addClass('tr' + i % 2).bind('click', { album: event.data.album, itmnbr: i }, jQuery.proxy(this.playTrack,this));
var trackNumberTD = $('<td>')
.html(item.track)
trackRow.append(trackNumberTD);
var trackTitleTD = $('<td>')
.html(item.title);
trackRow.append(trackTitleTD);
var trackDurationTD = $('<td>')
.addClass('time')
.html(durationToString(item.duration));
trackRow.append(trackDurationTD);
var trackArtistTD = $('<td>')
.html(item.artist);
trackRow.append(trackArtistTD);
var trackGenreTD = $('<td>')
.html(item.genre);
trackRow.append(trackGenreTD);
$('#albumDetails' + event.data.album.albumid + ' .resultSet').append(trackRow);
}, this));
if (trackCount > 0) {
var trackRow = $('<tr>').addClass('fillerTrackRow');
for (var i = 0; i < 5; i++) {
trackRow.append($('<td>').html(' '));
}
$('#albumDetails' + event.data.album.albumid + ' .resultSet').append(trackRow);
var trackRow2 = $('<tr>').addClass('fillerTrackRow2');
trackRow2.append($('<td>').addClass('albumBG').html(' '));
for (var i = 0; i < 5; i++) {
trackRow2.append($('<td>').html(' '));
}
$('#albumDetails' + event.data.album.albumid + ' .resultSet').append(trackRow2);
}
$('#albumDetails' + event.data.album.albumid + ' .albumThumb')
.append(this.generateThumb('album', albumThumbnail, albumTitle, albumArtist))
.append($('<div>').addClass('footerPadding'));
$('#spinner').hide();
myScroll = new iScroll('albumDetails' + event.data.album.albumid);
}, this), 'json');
} else {
$('.contentContainer').hide();
$('#albumDetails' + event.data.album.albumid).show();
}
},
togglePosterView: function(event){
var view=event.data.mode;
var wthumblist,hthumblist,hthumbdetails;
$("#toggleBanner").removeClass('activeMode');
$("#togglePoster").removeClass('activeMode');
$("#toggleLandscape").removeClass('activeMode');
switch(view) {
case 'poster':
setCookie('TVView','poster');
wthumblist='135px';
hthumblist='199px';
hthumbdetails='559px';
$("#togglePoster").addClass('activeMode');
break;
case 'landscape':
setCookie('TVView','landscape');
wthumblist='210px';
hthumblist='118px';
hthumbdetails='213px';
$("#toggleLandscape").addClass('activeMode');
break;
default: //set banner view as default
setCookie('TVView','banner');
wthumblist='379px';
hthumblist='70px';
hthumbdetails='70px';
$("#toggleBanner").addClass('activeMode');
break;
}
$(".floatableTVShowCover, .floatableTVShowCover div.imgWrapper, .floatableTVShowCover img, .floatableTVShowCover div.imgWrapper div.inner").css('width',wthumblist).css('height',hthumblist);
$(".floatableTVShowCoverSeason div.imgWrapper, .floatableTVShowCoverSeason div.imgWrapper div.inner,.floatableTVShowCoverSeason img, .floatableTVShowCoverSeason").css('height',hthumbdetails);
},
displayTVShowDetails: function(event) {
var tvshowDetailsContainer = $('#tvShowDetails' + event.data.tvshow.tvshowid);
$('#topScrollFade').hide();
toggle=this.toggle.detach();
if (!tvshowDetailsContainer || tvshowDetailsContainer.length == 0) {
$('#spinner').show();
jQuery.post(JSON_RPC + '?GetTVShowSeasons', '{"jsonrpc": "2.0", "method": "VideoLibrary.GetSeasons", "params": { "properties": [ "season", "showtitle", "playcount", "episode", "thumbnail","fanart" ], "tvshowid" : ' + event.data.tvshow.tvshowid + ' }, "id": 1}', jQuery.proxy(function(data) {
tvshowDetailsContainer = $('<div>');
tvshowDetailsContainer.attr('id', 'tvShowDetails' + event.data.tvshow.tvshowid)
.css('display', 'none')
.addClass('contentContainer')
.addClass('tvshowContainer');
var showThumb = this.generateThumb('tvshowseason', event.data.tvshow.thumbnail, event.data.tvshow.title);
if (data && data.result && data.result.seasons && data.result.seasons.length > 0) {
var showDetails = $('<div>').addClass('showDetails');
showDetails.append(toggle);
showDetails.append($('<p>').html(data.result.seasons[0].showtitle).addClass('showTitle'));
var seasonSelectionSelect = $('<select>').addClass('seasonPicker');
//var episodeCount = 0;
this.tvActiveShowContainer = tvshowDetailsContainer;
//var fanart;
$.each($(data.result.seasons), jQuery.proxy(function(i, item) {
// if(fanart==null && item.fanart!=null){
// fanart=item.fanart;
// }
// //episodeCount += item.episode;
var season = $('<option>').attr('value',i);
season.text(item.label);
seasonSelectionSelect.append(season);
}, this));
// if(fanart!=null)
// {
// $('.contentContainer').css('background','url("'+this.getThumbnailPath(fanart)+'")').css('background-size','cover');
// }
seasonSelectionSelect.bind('change', {tvshow: event.data.tvshow.tvshowid, seasons: data.result.seasons, element: seasonSelectionSelect}, jQuery.proxy(this.displaySeasonListings, this));
//showDetails.append($('<p>').html('<span class="heading">Episodes:</span> ' + episodeCount));
showDetails.append(seasonSelectionSelect);
tvshowDetailsContainer.append(showDetails);
tvshowDetailsContainer.append(showThumb);
seasonSelectionSelect.trigger('change');
$('#content').append(tvshowDetailsContainer);
if(getCookie('TVView')!=null && getCookie('TVView')!='banner'){
var view=getCookie('TVView');
switch(view) {
case 'poster':
togglePoster.trigger('click');
break;
case 'landscape':
toggleLandscape.trigger('click')
break;
}
}
tvshowDetailsContainer.fadeIn();
}
$('#spinner').hide();
}, this), 'json');
} else {
$('.contentContainer').hide();
$('#tvShowDetails' + event.data.tvshow.tvshowid).show();
$('#tvShowDetails' + event.data.tvshow.tvshowid +' select').trigger('change');
}
},
displaySeasonListings: function(event) {
//retrieve selected season
var selectedVal=event.data.element.val();
var seasons=event.data.seasons;
$('#topScrollFade').hide();
//Hide old listings
var oldListings = $('.episodeListingsContainer', this.tvActiveShowContainer).fadeOut();
//Update ActiveSeason
this.tvActiveSeason = selectedVal;
//Populate new listings
jQuery.post(JSON_RPC + '?GetTVSeasonEpisodes', '{"jsonrpc": "2.0", "method": "VideoLibrary.GetEpisodes", "params": { "properties": [ "title", "thumbnail","episode","plot","season"], "season" : ' + seasons[selectedVal].season + ', "tvshowid" : ' + event.data.tvshow + ' }, "id": 1}', jQuery.proxy(function(data) {
var episodeListingsContainer = $('<div>').addClass('episodeListingsContainer');
var episodeTable= $('<table>').addClass('seasonView').html('<thead><tr class="headerRow"><th class="thumbHeader">N°</th><th>Title</th><th class="thumbHeader">Thumb</th><th class="thumbHeader">Details</th></tr></thead><tbody class="resultSet"></tbody>');
$.each($(data.result.episodes), jQuery.proxy(function(i, item) {
var episodeRow = $('<tr>').addClass('episodeRow').addClass('tr' + i % 2);
var episodePictureImg = $('<img>').bind('click', { episode: item }, jQuery.proxy(this.playTVShow, this)).css('cursor','pointer');
episodePictureImg.attr('src', this.getThumbnailPath(item.thumbnail));
var episodePicture=$('<td>').addClass('episodeThumb').append(episodePictureImg).bind('click', { episode: item }, jQuery.proxy(this.playTVShow, this));
var episodeNumber = $('<td>').addClass('episodeNumber').html(item.episode).bind('click', { episode: item }, jQuery.proxy(this.playTVShow, this));
var episodeTitle = $('<td>').html(item.title).bind('click', { episode: item }, jQuery.proxy(this.playTVShow, this));
var episodeDetails = $('<td class="info">').html('').bind('click',{episode:item}, jQuery.proxy(this.displayEpisodeDetails, this)).css('cursor','pointer');
episodeRow.append(episodeNumber).append(episodeTitle).append(episodePicture).append(episodeDetails);
episodeTable.append(episodeRow);
}, this));
episodeListingsContainer.append(episodeTable);
$(this.tvActiveShowContainer).append(episodeListingsContainer);
}, this), 'json');
},
displayEpisodeDetails: function(event) {
var episodeDetails = $('<div>').attr('id', 'episode-' + event.data.episode.episodeid).addClass('episodePopoverContainer');
episodeDetails.append($('<img>').attr('src', '/images/close-button.png').addClass('closeButton').bind('click', jQuery.proxy(this.hideOverlay, this)));
episodeDetails.append($('<img>').attr('src', this.getThumbnailPath(event.data.episode.thumbnail)).addClass('episodeCover'));
episodeDetails.append($('<div>').addClass('playIcon').bind('click', {episode: event.data.episode}, jQuery.proxy(this.playTVShow, this)));
var episodeTitle = $('<p>').addClass('episodeTitle');
var yearText = event.data.episode.year ? ' <span class="year">(' + event.data.episode.year + ')</span>' : '';
episodeTitle.html(event.data.episode.title + yearText);
episodeDetails.append(episodeTitle);
if (event.data.episode.runtime) {
episodeDetails.append($('<p>').addClass('runtime').html('<strong>Runtime:</strong> ' + event.data.epispde.runtime + ' minutes'));
}
if (event.data.episode.season) {
episodeDetails.append($('<p>').addClass('season').html('<strong>Season:</strong> ' + event.data.episode.season));
}
if (event.data.episode.episode) {
episodeDetails.append($('<p>').addClass('episode').html('<strong>Episode:</strong> ' + event.data.episode.episode));
}
if (event.data.episode.plot) {
episodeDetails.append($('<p>').addClass('plot').html('<strong>Plot:</strong> <br/><br/>' +event.data.episode.plot));
}
if (event.data.episode.genre) {
episodeDetails.append($('<p>').addClass('genre').html('<strong>Genre:</strong> ' + event.data.episode.genre));
}
if (event.data.episode.rating) {
//Todo
}
if (event.data.episode.director) {
episodeDetails.append($('<p>').addClass('director').html('<strong>Directed By:</strong> ' + event.data.episode.director));
}
this.activeCover = episodeDetails;
$('body').append(episodeDetails);
$('#overlay').show();
this.updatePlayButtonLocation();
},
playTVShow: function(event) {
jQuery.post(JSON_RPC + '?AddTvShowToPlaylist', '{"jsonrpc": "2.0", "method": "Player.Open", "params": { "item": { "episodeid": ' + event.data.episode.episodeid + ' } }, "id": 1}', jQuery.proxy(function(data) {
this.hideOverlay();
}, this), 'json');
},
hideOverlay: function(event) {
if (this.activeCover) {
$(this.activeCover).remove();
this.activeCover = null;
}
$('#overlay').hide();
},
updatePlayButtonLocation: function(event) {
var movieContainer = $('.movieCover');
if (movieContainer.length > 0) {
var playIcon = $('.playIcon');
if (playIcon.length > 0) {
var heightpi=$(movieContainer[0]).height();
playIcon.width(Math.floor(0.65*heightpi));
playIcon.height(heightpi);
}
}
var episodeContainer = $('.episodeCover');
if (episodeContainer.length > 0) {
var playIcon = $('.playIcon');
if (playIcon.length > 0) {
var widthpi=$(episodeContainer[0]).width();
playIcon.width(widthpi);
//assume 16/9 thumb
playIcon.height(Math.floor(widthpi*9/16));
}
}
},
playMovie: function(event) {
jQuery.post(JSON_RPC + '?PlayMovie', '{"jsonrpc": "2.0", "method": "Player.Open", "params": { "item": { "movieid": ' + event.data.movie.movieid + ' } }, "id": 1}', jQuery.proxy(function(data) {
this.hideOverlay();
}, this), 'json');
},
displayMovieDetails: function(event) {
var movieDetails = $('<div>').attr('id', 'movie-' + event.data.movie.movieid).addClass('moviePopoverContainer');
movieDetails.append($('<img>').attr('src', '/images/close-button.png').addClass('closeButton').bind('click', jQuery.proxy(this.hideOverlay, this)));
movieDetails.append($('<img>').attr('src', this.getThumbnailPath(event.data.movie.thumbnail)).addClass('movieCover'));
movieDetails.append($('<div>').addClass('playIcon').bind('click', {movie: event.data.movie}, jQuery.proxy(this.playMovie, this)));
var movieTitle = $('<p>').addClass('movieTitle');
var yearText = event.data.movie.year ? ' <span class="year">(' + event.data.movie.year + ')</span>' : '';
movieTitle.html(event.data.movie.title + yearText);
movieDetails.append(movieTitle);
if (event.data.movie.runtime) {
movieDetails.append($('<p>').addClass('runtime').html('<strong>Runtime:</strong> ' + event.data.movie.runtime + ' minutes'));
}
if (event.data.movie.plot) {
movieDetails.append($('<p>').addClass('plot').html(event.data.movie.plot));
}
if (event.data.movie.genre) {
movieDetails.append($('<p>').addClass('genre').html('<strong>Genre:</strong> ' + event.data.movie.genre));
}
if (event.data.movie.rating) {
//Todo
}
if (event.data.movie.director) {
movieDetails.append($('<p>').addClass('director').html('<strong>Directed By:</strong> ' + event.data.movie.director));
}
this.activeCover = movieDetails;
$('body').append(movieDetails);
$('#overlay').show();
this.updatePlayButtonLocation();
},
playTrack: function(event) {
jQuery.post(JSON_RPC + '?ClearPlaylist', '{"jsonrpc": "2.0", "method": "Playlist.Clear", "params": { "playlistid": ' + this.playlists["audio"] + ' }, "id": 1}', jQuery.proxy(function(data) {
//check that clear worked.
jQuery.post(JSON_RPC + '?AddAlbumToPlaylist', '{"jsonrpc": "2.0", "method": "Playlist.Add", "params": { "playlistid": ' + this.playlists["audio"] + ', "item": { "albumid": ' + event.data.album.albumid + ' } }, "id": 1}', jQuery.proxy(function(data) {
//play specific song in playlist
jQuery.post(JSON_RPC + '?PlaylistItemPlay', '{"jsonrpc": "2.0", "method": "Player.Open", "params": { "item": { "playlistid": ' + this.playlists["audio"] + ', "position": '+ event.data.itmnbr + ' } }, "id": 1}', function() {}, 'json');
}, this), 'json');
}, this), 'json');
},
movieLibraryOpen: function() {
this.resetPage();
$('#movieLibrary').addClass('selected');
$('.contentContainer').hide();
var libraryContainer = $('#movieLibraryContainer');
if (!libraryContainer || libraryContainer.length == 0) {
$('#spinner').show();
jQuery.post(JSON_RPC + '?GetMovies', '{"jsonrpc": "2.0", "method": "VideoLibrary.GetMovies", "params": { "limits": { "start": 0 }, "properties": [ "genre", "director", "trailer", "tagline", "plot", "plotoutline", "title", "originaltitle", "lastplayed", "runtime", "year", "playcount", "rating", "thumbnail", "file" ], "sort": { "method": "sorttitle", "ignorearticle": true } }, "id": 1}', jQuery.proxy(function(data) {
if (data && data.result && data.result.movies) {
libraryContainer = $('<div>');
libraryContainer.attr('id', 'movieLibraryContainer')
.addClass('contentContainer');
$('#content').append(libraryContainer);
} else {
libraryContainer.html('');
}
//data.result.movies.sort(jQuery.proxy(this.movieTitleSorter, this));
$.each($(data.result.movies), jQuery.proxy(function(i, item) {
var floatableMovieCover = this.generateThumb('movie', item.thumbnail, item.title);
floatableMovieCover.bind('click', { movie: item }, jQuery.proxy(this.displayMovieDetails, this));
libraryContainer.append(floatableMovieCover);
}, this));
libraryContainer.append($('<div>').addClass('footerPadding'));
$('#spinner').hide();
libraryContainer.bind('scroll', { activeLibrary: libraryContainer }, jQuery.proxy(this.updateScrollEffects, this));
libraryContainer.trigger('scroll');
//$('#libraryContainer img').lazyload();
myScroll = new iScroll('movieLibraryContainer');
}, this), 'json');
} else {
libraryContainer.show();
libraryContainer.trigger('scroll');
}
},
tvshowLibraryOpen: function() {
this.resetPage();
$('#tvshowLibrary').addClass('selected');
$('.contentContainer').hide();
var libraryContainer = $('#tvshowLibraryContainer');
if (!libraryContainer || libraryContainer.length == 0) {
$('#spinner').show();
toggle=$('<p>').addClass('toggle');
togglePoster= $('<span>Poster</span>');
togglePoster.attr('id', 'togglePoster')
.css('cursor','pointer')
.bind('click',{mode: 'poster'},jQuery.proxy(this.togglePosterView,this));
toggleBanner= $('<span>Banner</span>');
toggleBanner.attr('id', 'toggleBanner')
.css('cursor','pointer')
.addClass('activeMode')
.bind('click',{mode: 'banner'},jQuery.proxy(this.togglePosterView,this));
toggleLandscape= $('<span>Landscape</span>');
toggleLandscape.attr('id', 'toggleLandscape')
.css('cursor','pointer')
.bind('click',{mode: 'landscape'},jQuery.proxy(this.togglePosterView,this));
toggle.append(toggleBanner).append(' | ').append(togglePoster).append(' | ').append(toggleLandscape);
this.toggle=toggle;
jQuery.post(JSON_RPC + '?GetTVShows', '{"jsonrpc": "2.0", "method": "VideoLibrary.GetTVShows", "params": { "properties": ["genre", "plot", "title", "lastplayed", "episode", "year", "playcount", "rating", "thumbnail", "studio", "mpaa", "premiered"] }, "id": 1}', jQuery.proxy(function(data) {
if (data && data.result && data.result.tvshows) {
libraryContainer = $('<div>');
libraryContainer.append(toggle);
libraryContainer.attr('id', 'tvshowLibraryContainer')
.addClass('contentContainer');
$('#content').append(libraryContainer);
} else {
libraryContainer.html('');
}
$.each($(data.result.tvshows), jQuery.proxy(function(i, item) {
var floatableTVShowCover = this.generateThumb('tvshow', item.thumbnail, item.title);
floatableTVShowCover.bind('click', { tvshow: item }, jQuery.proxy(this.displayTVShowDetails, this));
libraryContainer.append(floatableTVShowCover);
}, this));
libraryContainer.append($('<div>').addClass('footerPadding'));
$('#spinner').hide();
libraryContainer.bind('scroll', { activeLibrary: libraryContainer }, jQuery.proxy(this.updateScrollEffects, this));
libraryContainer.trigger('scroll');
myScroll = new iScroll('tvshowLibraryContainer');
if(getCookie('TVView')!=null && getCookie('TVView')!='banner'){
var view=getCookie('TVView');
switch(view) {
case 'poster':
togglePoster.trigger('click');
break;
case 'landscape':
toggleLandscape.trigger('click')
break;
}
}
}, this), 'json');
} else {
libraryContainer.prepend($(".toggle").detach()).show();
libraryContainer.trigger('scroll');
}
},
updateScrollEffects: function(event) {
if (event.data.activeLibrary && $(event.data.activeLibrary).scrollTop() > 0) {
$('#topScrollFade').fadeIn();
} else {
$('#topScrollFade').fadeOut();
}
},
startSlideshow: function(event) {
jQuery.post(JSON_RPC + '?StartSlideshow', '{"jsonrpc": "2.0", "method": "Player.Open", "params": { "item": { "recursive" : "true", "random":"true", "path" : "' + this.replaceAll(event.data.directory.file, "\\", "\\\\") + '" } }, "id": 1}', null, 'json');
},
showDirectory: function(event) {
var directory = event.data.directory.file;
var jsonDirectory = this.replaceAll(directory, "\\", "\\\\");
this.resetPage();
$('#pictureLibrary').addClass('selected');
$('.contentContainer').hide();
var libraryContainer = $('#pictureLibraryDirContainer' + directory);
if (!libraryContainer || libraryContainer.length == 0) {
$('#spinner').show();
jQuery.post(JSON_RPC + '?GetDirectory', '{"jsonrpc": "2.0", "method": "Files.GetDirectory", "params": { "media" : "pictures", "directory": "' + jsonDirectory + '" }, "id": 1}', jQuery.proxy(function(data) {
if (data && data.result && ( data.result.directories || data.result.files )) {
libraryContainer = $('<div>');
libraryContainer.attr('id', 'pictureLibraryDirContainer' + directory)
.addClass('contentContainer');
$('#content').append(libraryContainer);
var breadcrumb = $('<div>');
var seperator = '/';
var item = '';
var directoryArray = directory.split(seperator);
jQuery.each(directoryArray, function(i,v) {
if(v != '') {
item += v + seperator;
//tmp.bind('click', { directory: item }, jQuery.proxy(this.showDirectory, this));
breadcrumb.append($('<div>').text(' > ' + v).css('float','left').addClass('breadcrumb'));
}
});
libraryContainer.append(breadcrumb);
libraryContainer.append($('<div>').css('clear','both'));
if (data.result.files) {
$.each($(data.result.files), jQuery.proxy(function(i, item) {
if (item.filetype == "file")
{
var floatableImage = this.generateThumb('image', item.file, item.label);
libraryContainer.append(floatableImage);
}
else if (item.filetype == "directory")
{
var floatableShare = this.generateThumb('directory', item.thumbnail, item.label);
floatableShare.bind('click', { directory: item }, jQuery.proxy(this.showDirectory, this));
//var slideshow = $('<div">');
//slideshow.html('<div>Slideshow</div>');
//slideshow.bind('click', { directory: item }, jQuery.proxy(this.startSlideshow, this));
//floatableShare.append(slideshow);
libraryContainer.append(floatableShare);
}
}, this));
}
libraryContainer.append($('<div>').addClass('footerPadding'));
} else {
libraryContainer.html('');
}
$('#spinner').hide();
libraryContainer.bind('scroll', { activeLibrary: libraryContainer }, jQuery.proxy(this.updateScrollEffects, this));
libraryContainer.trigger('scroll');
myScroll = new iScroll('#pictureLibraryDirContainer' + directory);
}, this), 'json');
} else {
libraryContainer.show();
libraryContainer.trigger('scroll');
}
},
pictureLibraryOpen: function() {
this.resetPage();
$('#pictureLibrary').addClass('selected');
$('.contentContainer').hide();
var libraryContainer = $('#pictureLibraryContainer');
if (!libraryContainer || libraryContainer.length == 0) {
$('#spinner').show();
jQuery.post(JSON_RPC + '?GetSources', '{"jsonrpc": "2.0", "method": "Files.GetSources", "params": { "media" : "pictures" }, "id": 1}', jQuery.proxy(function(data) {
if (data && data.result && data.result.shares) {
libraryContainer = $('<div>');
libraryContainer.attr('id', 'pictureLibraryContainer')
.addClass('contentContainer');
$('#content').append(libraryContainer);
} else {
libraryContainer.html('');
}
$.each($(data.result.shares), jQuery.proxy(function(i, item) {
var floatableShare = this.generateThumb('directory', item.thumbnail, item.label);
floatableShare.bind('click', { directory: item }, jQuery.proxy(this.showDirectory, this));
libraryContainer.append(floatableShare);
}, this));
libraryContainer.append($('<div>').addClass('footerPadding'));
$('#spinner').hide();
libraryContainer.bind('scroll', { activeLibrary: libraryContainer }, jQuery.proxy(this.updateScrollEffects, this));
libraryContainer.trigger('scroll');
myScroll = new iScroll('#pictureLibraryContainer');
}, this), 'json');
} else {
libraryContainer.show();
libraryContainer.trigger('scroll');
}
}
} | robclark/xbmc | addons/webinterface.default/js/MediaLibrary.js | JavaScript | gpl-2.0 | 42,705 |
var Edgemontbuild = {
"type": "FeatureCollection",
"features": [
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.6635637149839,
53.46801508315708
],
[
-113.66331876140202,
53.46799093424123
],
[
-113.66333466418672,
53.46793349965854
],
[
-113.66358788633671,
53.4679584643914
],
[
-113.66358636399696,
53.46796396227533
],
[
-113.6636214665547,
53.46796742277841
],
[
-113.66360858247575,
53.46801395591078
],
[
-113.66356521097416,
53.468009680451594
],
[
-113.6635637149839,
53.46801508315708
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 16360,
"number": "4462",
"FID_Catchm": 14544,
"Gal": "4.32100000000e+003",
"Area_1": "1.31800000000e+003",
"Showers": 364,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.66252408812346,
53.46815124615573
],
[
-113.66255012883128,
53.46808887101148
],
[
-113.66263398543356,
53.46810133512362
],
[
-113.66274218885108,
53.46803026061317
],
[
-113.66276409558262,
53.468042134624184
],
[
-113.6628668593403,
53.467974633685124
],
[
-113.6629728228436,
53.46803947052609
],
[
-113.6627410467849,
53.46817433821253
],
[
-113.66270327325758,
53.46826481655912
],
[
-113.66254497579826,
53.468241287136536
],
[
-113.66257914973394,
53.46815943069269
],
[
-113.66252408812346,
53.46815124615573
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 53530,
"number": "4462",
"FID_Catchm": 14545,
"Gal": "1.41400000000e+004",
"Area_1": "4.31300000000e+003",
"Showers": 1190,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.68709003664216,
53.46612694285981
],
[
-113.6871663387325,
53.46599126434534
],
[
-113.68721023151248,
53.46600005349342
],
[
-113.68713392804024,
53.466135732031866
],
[
-113.68709003664216,
53.46612694285981
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.49781400000e+000",
"Liters": 6833,
"number": "4462",
"FID_Catchm": 14548,
"Gal": "1.80500000000e+003",
"Area_1": "5.27100000000e+002",
"Showers": 152,
"area_km2": "4.25687479300052",
"ID": 181,
"GRIDCODE": 140
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.6885441441563,
53.466420278046705
],
[
-113.68854585070515,
53.46630954722415
],
[
-113.68867240589796,
53.46631024183936
],
[
-113.68867069967844,
53.466420972664224
],
[
-113.6885441441563,
53.466420278046705
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.49781400000e+000",
"Liters": 14460,
"number": "4462",
"FID_Catchm": 14549,
"Gal": "3.81900000000e+003",
"Area_1": "1.11500000000e+003",
"Showers": 321,
"area_km2": "4.25687479300052",
"ID": 181,
"GRIDCODE": 140
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.68690415986543,
53.46600547659316
],
[
-113.68694185573906,
53.466003630769755
],
[
-113.6869509326612,
53.46606963203696
],
[
-113.68691323672958,
53.466071477863125
],
[
-113.68690415986543,
53.46600547659316
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.49781400000e+000",
"Liters": 2584,
"number": "4462",
"FID_Catchm": 14550,
"Gal": "6.82600000000e+002",
"Area_1": "1.99300000000e+002",
"Showers": 57,
"area_km2": "4.25687479300052",
"ID": 181,
"GRIDCODE": 140
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.68707840673233,
53.46605216991082
],
[
-113.6870993556702,
53.46600728815064
],
[
-113.68714068295083,
53.46601415747327
],
[
-113.68711973405966,
53.46605903834207
],
[
-113.68707840673233,
53.46605216991082
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.49781400000e+000",
"Liters": 2062,
"number": "4462",
"FID_Catchm": 14551,
"Gal": "5.44600000000e+002",
"Area_1": "1.59000000000e+002",
"Showers": 46,
"area_km2": "4.25687479300052",
"ID": 181,
"GRIDCODE": 140
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.6857972296487,
53.46301373495376
],
[
-113.68579741989217,
53.46298796879673
],
[
-113.68587152186161,
53.46298816362124
],
[
-113.68587133166301,
53.46301392977845
],
[
-113.6857972296487,
53.46301373495376
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 1885,
"number": "4462",
"FID_Catchm": 14553,
"Gal": "4.98000000000e+002",
"Area_1": "1.51900000000e+002",
"Showers": 42,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.6862658689478,
53.46219251349635
],
[
-113.68645835920051,
53.462191291611795
],
[
-113.68645945368706,
53.46225263250621
],
[
-113.68626696315688,
53.46225385439209
],
[
-113.6862658689478,
53.46219251349635
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 11660,
"number": "4462",
"FID_Catchm": 14554,
"Gal": "3.08000000000e+003",
"Area_1": "9.39600000000e+002",
"Showers": 259,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.68587622743799,
53.46262118487838
],
[
-113.68587823547485,
53.46254518686996
],
[
-113.68600275816603,
53.462546358839326
],
[
-113.6860007503514,
53.46262235685023
],
[
-113.68587622743799,
53.46262118487838
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 9346,
"number": "4462",
"FID_Catchm": 14555,
"Gal": "2.46900000000e+003",
"Area_1": "7.53100000000e+002",
"Showers": 208,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.68627634034587,
53.46213406053619
],
[
-113.68628367009947,
53.4621336969734
],
[
-113.68629099420923,
53.46213409900861
],
[
-113.68629808991876,
53.46213525347642
],
[
-113.68630474065357,
53.46213712566141
],
[
-113.68631074806672,
53.46213965932926
],
[
-113.68631592451052,
53.46214277670726
],
[
-113.68632011709494,
53.46214638304045
],
[
-113.6863231956218,
53.46215036925554
],
[
-113.68632506762914,
53.46215461379812
],
[
-113.6863256768522,
53.46215898712098
],
[
-113.68632500317723,
53.462163357974795
],
[
-113.68632306867107,
53.46216759252501
],
[
-113.68631993149886,
53.46217156242329
],
[
-113.68631568591027,
53.46217514660522
],
[
-113.68631046370626,
53.46217823668515
],
[
-113.68630441917455,
53.46218073781556
],
[
-113.68629774108278,
53.46218257590746
],
[
-113.68629062861963,
53.462183693074444
],
[
-113.6862832988575,
53.46218405663767
],
[
-113.6862759747392,
53.462183654602015
],
[
-113.68626887902212,
53.46218250013278
],
[
-113.68626222678283,
53.46218062704328
],
[
-113.68625622086591,
53.46217809427559
],
[
-113.68625104291647,
53.46217497689102
],
[
-113.6862468518408,
53.462171370559524
],
[
-113.6862437718139,
53.46216738433848
],
[
-113.6862418998141,
53.462163139794654
],
[
-113.68624129211194,
53.46215876557669
],
[
-113.68624196428307,
53.46215439561798
],
[
-113.68624389879669,
53.46215016106918
],
[
-113.68624703748013,
53.462146191176764
],
[
-113.68625128156583,
53.462142606993325
],
[
-113.68625650527548,
53.462139516919976
],
[
-113.68626254830502,
53.46213701488939
],
[
-113.68626922789026,
53.462135177701924
],
[
-113.68627634034587,
53.46213406053619
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 3279,
"number": "4462",
"FID_Catchm": 14556,
"Gal": "8.66100000000e+002",
"Area_1": "2.64200000000e+002",
"Showers": 73,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.68639752452624,
53.462122431658145
],
[
-113.68640532274077,
53.462122045054954
],
[
-113.68641311345026,
53.4621224725696
],
[
-113.68642066336491,
53.46212370011069
],
[
-113.68642773934702,
53.46212569291954
],
[
-113.68643412955112,
53.46212838753776
],
[
-113.68643963731452,
53.462131703473375
],
[
-113.68644409623522,
53.46213554054448
],
[
-113.68644737166359,
53.46213978068037
],
[
-113.68644936365497,
53.46214429601647
],
[
-113.68645001148005,
53.46214894980547
],
[
-113.68644929511059,
53.462153599116185
],
[
-113.68644723665275,
53.462158104722384
],
[
-113.68644389886785,
53.46216232750486
],
[
-113.68643938357376,
53.462166141026806
],
[
-113.68643382715426,
53.462169427928664
],
[
-113.68642739748174,
53.46217208890526
],
[
-113.6864202924044,
53.46217404360113
],
[
-113.68641272467556,
53.46217523236773
],
[
-113.68640492795708,
53.462175618975365
],
[
-113.68639713573226,
53.462175191456275
],
[
-113.68638958732149,
53.46217396301901
],
[
-113.6863825113265,
53.46217197110642
],
[
-113.6863761211192,
53.46216927648554
],
[
-113.68637061335589,
53.462165960547
],
[
-113.68636615443874,
53.462162123473135
],
[
-113.68636287751094,
53.46215788333121
],
[
-113.6863608870405,
53.462153367098935
],
[
-113.68636023921852,
53.46214871420815
],
[
-113.68636095560421,
53.462144063999396
],
[
-113.68636301255812,
53.462139559289284
],
[
-113.68636635185496,
53.46213533651302
],
[
-113.68637086715233,
53.462131522993744
],
[
-113.68637642357166,
53.4621282360949
],
[
-113.68638285324073,
53.46212557512097
],
[
-113.6863899583184,
53.46212361952875
],
[
-113.68639752452624,
53.462122431658145
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 3710,
"number": "4462",
"FID_Catchm": 14557,
"Gal": "9.80200000000e+002",
"Area_1": "2.99000000000e+002",
"Showers": 82,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.6867530319597,
53.4623529897068
],
[
-113.68675468127256,
53.46228848482492
],
[
-113.68687700221695,
53.4622895988918
],
[
-113.68687535158364,
53.46235410377164
],
[
-113.6867530319597,
53.4623529897068
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 7790,
"number": "4462",
"FID_Catchm": 14558,
"Gal": "2.05800000000e+003",
"Area_1": "6.27900000000e+002",
"Showers": 173,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.6870621284139,
53.462534061967986
],
[
-113.68706553445016,
53.46243250223127
],
[
-113.68721249620287,
53.462434257388004
],
[
-113.6872090905171,
53.46253581712942
],
[
-113.6870621284139,
53.462534061967986
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 14740,
"number": "4462",
"FID_Catchm": 14559,
"Gal": "3.89500000000e+003",
"Area_1": "1.18800000000e+003",
"Showers": 328,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.68692063337741,
53.46252745499275
],
[
-113.68700838474679,
53.46252576994314
],
[
-113.68701189494239,
53.46259084637485
],
[
-113.6869241434389,
53.46259253142686
],
[
-113.68692063337741,
53.46252745499275
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 5644,
"number": "4462",
"FID_Catchm": 14560,
"Gal": "1.49100000000e+003",
"Area_1": "4.54800000000e+002",
"Showers": 125,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.68634941644784,
53.46283487114502
],
[
-113.68635069036338,
53.462791557137436
],
[
-113.68646067249318,
53.462792709332135
],
[
-113.68645939868946,
53.46283602334113
],
[
-113.68634941644784,
53.46283487114502
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 4705,
"number": "4462",
"FID_Catchm": 14561,
"Gal": "1.24300000000e+003",
"Area_1": "3.79100000000e+002",
"Showers": 105,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.68678569467782,
53.46243163245573
],
[
-113.68679302402685,
53.46239920925614
],
[
-113.68685415254555,
53.46240413028693
],
[
-113.68684682324216,
53.462436553490335
],
[
-113.68678569467782,
53.46243163245573
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 1993,
"number": "4462",
"FID_Catchm": 14562,
"Gal": "5.26500000000e+002",
"Area_1": "1.60600000000e+002",
"Showers": 44,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.68627602361069,
53.46238556994913
],
[
-113.68638746215903,
53.46238387835053
],
[
-113.6863923974116,
53.46249962290847
],
[
-113.68628096005945,
53.4625013154138
],
[
-113.68627602361069,
53.46238556994913
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 12750,
"number": "4462",
"FID_Catchm": 14563,
"Gal": "3.36700000000e+003",
"Area_1": "1.02700000000e+003",
"Showers": 283,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.6858115611693,
53.462961616587606
],
[
-113.68581351663859,
53.46289132909382
],
[
-113.68593218276779,
53.462892504607375
],
[
-113.68593022749432,
53.462962792103376
],
[
-113.6858115611693,
53.462961616587606
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 8237,
"number": "4462",
"FID_Catchm": 14564,
"Gal": "2.17600000000e+003",
"Area_1": "6.63800000000e+002",
"Showers": 183,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.68434711971666,
53.462897610642706
],
[
-113.68435142458281,
53.46287205933923
],
[
-113.68459394708579,
53.462886608369836
],
[
-113.68458964386942,
53.4629121596861
],
[
-113.68434711971666,
53.462897610642706
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 6182,
"number": "4462",
"FID_Catchm": 14565,
"Gal": "1.63300000000e+003",
"Area_1": "4.98000000000e+002",
"Showers": 137,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.68614048174115,
53.46284218715175
],
[
-113.68614283204865,
53.46278423586762
],
[
-113.68628898977164,
53.462786346793905
],
[
-113.68628663815727,
53.462844298077144
],
[
-113.68614048174115,
53.46284218715175
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 8370,
"number": "4462",
"FID_Catchm": 14566,
"Gal": "2.21100000000e+003",
"Area_1": "6.74300000000e+002",
"Showers": 186,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.68601154346314,
53.462138525728044
],
[
-113.68601734731466,
53.46213823814795
],
[
-113.68602314669786,
53.46213855621708
],
[
-113.68602876550737,
53.462139470486626
],
[
-113.68603403228798,
53.46214095354786
],
[
-113.68603878927523,
53.46214295915731
],
[
-113.68604288934422,
53.46214542762053
],
[
-113.68604620806872,
53.46214828402613
],
[
-113.68604864671933,
53.462151440051436
],
[
-113.68605012919934,
53.46215480114266
],
[
-113.68605061109182,
53.46215826474202
],
[
-113.6860500781083,
53.462161726573555
],
[
-113.68604854609475,
53.46216507974463
],
[
-113.68604606097234,
53.46216822283318
],
[
-113.68604270023638,
53.4621710607906
],
[
-113.686038563902,
53.46217350761308
],
[
-113.68603377749623,
53.46217548904614
],
[
-113.6860284890391,
53.46217694347463
],
[
-113.68602285695185,
53.462177828181694
],
[
-113.68601705308825,
53.462178116660624
],
[
-113.68601125370647,
53.46217779769266
],
[
-113.68600563489225,
53.46217688342231
],
[
-113.68600036659579,
53.46217540125441
],
[
-113.68599561111907,
53.46217339474878
],
[
-113.68599151105016,
53.46217092628406
],
[
-113.68598819081522,
53.462168070771526
],
[
-113.68598575367389,
53.46216491474897
],
[
-113.68598427119869,
53.46216155365694
],
[
-113.68598378781238,
53.46215808915483
],
[
-113.6859843223003,
53.46215462822614
],
[
-113.68598585431855,
53.46215127505586
],
[
-113.6859883379387,
53.46214813196456
],
[
-113.68599170018891,
53.46214529311408
],
[
-113.68599583652312,
53.4621428462932
],
[
-113.68600062141462,
53.462140865756304
],
[
-113.6860059113806,
53.46213941043431
],
[
-113.68601154346314,
53.462138525728044
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 2056,
"number": "4462",
"FID_Catchm": 14567,
"Gal": "5.43200000000e+002",
"Area_1": "1.65700000000e+002",
"Showers": 46,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.68676529918932,
53.46266930638729
],
[
-113.68676839639973,
53.462609801559296
],
[
-113.6868335714806,
53.462611010278465
],
[
-113.68683047436782,
53.46267051420967
],
[
-113.68676529918932,
53.46266930638729
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 3835,
"number": "4462",
"FID_Catchm": 14568,
"Gal": "1.01300000000e+003",
"Area_1": "3.08900000000e+002",
"Showers": 85,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.6654283220696,
53.46991780514789
],
[
-113.66541987261256,
53.46985486915236
],
[
-113.6653830435325,
53.469856629743234
],
[
-113.66536111435411,
53.46969326457606
],
[
-113.6655514179971,
53.469684169657285
],
[
-113.66557287416008,
53.46984400194158
],
[
-113.66555666153772,
53.46984477699716
],
[
-113.66556558494409,
53.46991124493418
],
[
-113.6654283220696,
53.46991780514789
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 39410,
"number": "4462",
"FID_Catchm": 14576,
"Gal": "1.04100000000e+004",
"Area_1": "3.17600000000e+003",
"Showers": 876,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.66615418482608,
53.46924683996918
],
[
-113.66621303501933,
53.469245767879116
],
[
-113.66621821769185,
53.46934706699648
],
[
-113.66615936585254,
53.46934813908459
],
[
-113.66615418482608,
53.46924683996918
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 5890,
"number": "4462",
"FID_Catchm": 14577,
"Gal": "1.55600000000e+003",
"Area_1": "4.74700000000e+002",
"Showers": 131,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.67025606657181,
53.46885382174002
],
[
-113.67025633439277,
53.468819265666546
],
[
-113.67037188630304,
53.4688195844575
],
[
-113.67037161857596,
53.46885414053141
],
[
-113.67025606657181,
53.46885382174002
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 3944,
"number": "4462",
"FID_Catchm": 14578,
"Gal": "1.04200000000e+003",
"Area_1": "3.17700000000e+002",
"Showers": 88,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.6664087142446,
53.46928625734432
],
[
-113.66640981597246,
53.46914574620933
],
[
-113.66653896777265,
53.46914610666908
],
[
-113.66653786647129,
53.469286617805935
],
[
-113.6664087142446,
53.46928625734432
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 17920,
"number": "4462",
"FID_Catchm": 14579,
"Gal": "4.73400000000e+003",
"Area_1": "1.44400000000e+003",
"Showers": 398,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.67019268580825,
53.468805501293616
],
[
-113.6701930175483,
53.46876270607301
],
[
-113.67024681841188,
53.46876285454429
],
[
-113.67024648672592,
53.468805649765166
],
[
-113.67019268580825,
53.468805501293616
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 2274,
"number": "4462",
"FID_Catchm": 14580,
"Gal": "6.00600000000e+002",
"Area_1": "1.83200000000e+002",
"Showers": 51,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.66508697541883,
53.470218534546866
],
[
-113.66520583099577,
53.47015396034435
],
[
-113.6652117183318,
53.470013462642875
],
[
-113.6654402841682,
53.4700168722608
],
[
-113.6654384413654,
53.47006084400367
],
[
-113.66544448594775,
53.47006093371315
],
[
-113.66544127825746,
53.470137514758925
],
[
-113.66543113166065,
53.470137363243055
],
[
-113.66542974459001,
53.47017049367541
],
[
-113.66535958422973,
53.47016944714597
],
[
-113.66516959179285,
53.47027267076016
],
[
-113.66508697541883,
53.470218534546866
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 49130,
"number": "4462",
"FID_Catchm": 14581,
"Gal": "1.29800000000e+004",
"Area_1": "3.95800000000e+003",
"Showers": 1092,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.66851163332818,
53.47481630896646
],
[
-113.66858947468074,
53.47473395916792
],
[
-113.66860215319933,
53.474704290016874
],
[
-113.66856375256866,
53.474698449522656
],
[
-113.66863405801625,
53.47453392736222
],
[
-113.66881785241347,
53.4745618820511
],
[
-113.66873388116814,
53.47475838915032
],
[
-113.66873363594695,
53.474758351627706
],
[
-113.66873387584963,
53.474759072075855
],
[
-113.66863920257907,
53.47485922879655
],
[
-113.66851163332818,
53.47481630896646
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 51710,
"number": "4462",
"FID_Catchm": 14583,
"Gal": "1.36600000000e+004",
"Area_1": "4.16600000000e+003",
"Showers": 1149,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.6688943617955,
53.47561820725947
],
[
-113.66889473937631,
53.475569701578486
],
[
-113.66908138027841,
53.47557021852737
],
[
-113.6690810029105,
53.47561872420933
],
[
-113.6688943617955,
53.47561820725947
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 8937,
"number": "4462",
"FID_Catchm": 14584,
"Gal": "2.36100000000e+003",
"Area_1": "7.20100000000e+002",
"Showers": 199,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.66809766397098,
53.47530007276357
],
[
-113.66803573681523,
53.47524445859368
],
[
-113.66797647294781,
53.47526794615846
],
[
-113.66791848128932,
53.475215868090736
],
[
-113.6681144940699,
53.4751381826832
],
[
-113.6681641919042,
53.47518281334779
],
[
-113.66813142794926,
53.47519579887804
],
[
-113.66820164913733,
53.47525886030559
],
[
-113.66809766397098,
53.47530007276357
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 22400,
"number": "4462",
"FID_Catchm": 14585,
"Gal": "5.91700000000e+003",
"Area_1": "1.80500000000e+003",
"Showers": 498,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.6683861392153,
53.47500744738533
],
[
-113.66850640383143,
53.475002999555045
],
[
-113.66851070256338,
53.475044365310225
],
[
-113.66839043783081,
53.47504881314459
],
[
-113.6683861392153,
53.47500744738533
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 4929,
"number": "4462",
"FID_Catchm": 14586,
"Gal": "1.30200000000e+003",
"Area_1": "3.97200000000e+002",
"Showers": 110,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.66905902901856,
53.475352240294754
],
[
-113.66913979960006,
53.475125667565905
],
[
-113.66938761772431,
53.47515710996588
],
[
-113.66930684839468,
53.475383683761606
],
[
-113.66905902901856,
53.475352240294754
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 57920,
"number": "4462",
"FID_Catchm": 14587,
"Gal": "1.53000000000e+004",
"Area_1": "4.66800000000e+003",
"Showers": 1287,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.66904203460565,
53.47507225422673
],
[
-113.6690791803818,
53.47496974711043
],
[
-113.66930109582675,
53.474998370028416
],
[
-113.66926394905354,
53.47510087720974
],
[
-113.66904203460565,
53.47507225422673
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 23500,
"number": "4462",
"FID_Catchm": 14588,
"Gal": "6.20900000000e+003",
"Area_1": "1.89400000000e+003",
"Showers": 522,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.68184842752902,
53.46902075025041
],
[
-113.68185002863501,
53.46896654609396
],
[
-113.68190154673928,
53.46896708761305
],
[
-113.68189994569883,
53.469021291770304
],
[
-113.68184842752902,
53.46902075025041
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 2757,
"number": "4462",
"FID_Catchm": 14590,
"Gal": "7.28400000000e+002",
"Area_1": "2.22200000000e+002",
"Showers": 61,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.68166722058837,
53.469114401172895
],
[
-113.68167005352997,
53.46905520764477
],
[
-113.68174906253198,
53.46905655392253
],
[
-113.68174622819424,
53.4691157474487
],
[
-113.68166722058837,
53.469114401172895
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 4622,
"number": "4462",
"FID_Catchm": 14591,
"Gal": "1.22100000000e+003",
"Area_1": "3.72400000000e+002",
"Showers": 103,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.68128958815228,
53.469115243955095
],
[
-113.68128928280143,
53.46904101018085
],
[
-113.68140370647951,
53.46904084262777
],
[
-113.68140358056388,
53.46901039571656
],
[
-113.68152825720685,
53.46901021314429
],
[
-113.68152839206554,
53.46904269632079
],
[
-113.68163476601494,
53.469042540342095
],
[
-113.6816350631028,
53.4691147387497
],
[
-113.68128958815228,
53.469115243955095
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 28850,
"number": "4462",
"FID_Catchm": 14592,
"Gal": "7.62200000000e+003",
"Area_1": "2.32500000000e+003",
"Showers": 641,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.68191473485949,
53.46912118964792
],
[
-113.68191612665817,
53.46893502910707
],
[
-113.68208467897915,
53.468935477634595
],
[
-113.68208328791793,
53.46912163817838
],
[
-113.68191473485949,
53.46912118964792
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 30980,
"number": "4462",
"FID_Catchm": 14593,
"Gal": "8.18300000000e+003",
"Area_1": "2.49600000000e+003",
"Showers": 688,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.68144851942584,
53.46921523328471
],
[
-113.68145244697587,
53.46916959366152
],
[
-113.68151390252629,
53.46917147739611
],
[
-113.68150997504875,
53.46921711612277
],
[
-113.68144851942584,
53.46921523328471
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 2776,
"number": "4462",
"FID_Catchm": 14594,
"Gal": "7.33400000000e+002",
"Area_1": "2.23700000000e+002",
"Showers": 62,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.68678062691046,
53.475782136636035
],
[
-113.68678439128301,
53.475692509748434
],
[
-113.68706146397872,
53.47569665118647
],
[
-113.68705770018963,
53.475786278083575
],
[
-113.68678062691046,
53.475782136636035
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.49781400000e+000",
"Liters": 25620,
"number": "4462",
"FID_Catchm": 14596,
"Gal": "6.76800000000e+003",
"Area_1": "1.97600000000e+003",
"Showers": 569,
"area_km2": "4.25687479300052",
"ID": 181,
"GRIDCODE": 140
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.68235555695288,
53.47829140720692
],
[
-113.68228487035054,
53.47824886267839
],
[
-113.68222009779274,
53.478287159739914
],
[
-113.68213517419348,
53.47823604501377
],
[
-113.68230540427737,
53.47813539472221
],
[
-113.68247471933073,
53.47823730345486
],
[
-113.68244653935477,
53.47825396509661
],
[
-113.68243283450329,
53.47824571633201
],
[
-113.68235555695288,
53.47829140720692
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.49781400000e+000",
"Liters": 27440,
"number": "4462",
"FID_Catchm": 14598,
"Gal": "7.24800000000e+003",
"Area_1": "2.11600000000e+003",
"Showers": 610,
"area_km2": "4.25687479300052",
"ID": 181,
"GRIDCODE": 140
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.68098895441153,
53.47692694687224
],
[
-113.68124905071505,
53.47667809554709
],
[
-113.68188166693109,
53.47691340855982
],
[
-113.6816215728719,
53.47716226215381
],
[
-113.68098895441153,
53.47692694687224
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.49781400000e+000",
"Liters": 225500,
"number": "4462",
"FID_Catchm": 14599,
"Gal": "5.95600000000e+004",
"Area_1": "1.73900000000e+004",
"Showers": 5011,
"area_km2": "4.25687479300052",
"ID": 181,
"GRIDCODE": 140
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.68057893573297,
53.478144572985066
],
[
-113.68055753676894,
53.478135741812565
],
[
-113.68055381914523,
53.47813894888122
],
[
-113.68046258606405,
53.47810129876504
],
[
-113.68046650380619,
53.47809792149937
],
[
-113.68044242589274,
53.47808798504851
],
[
-113.68044603585716,
53.478084872947534
],
[
-113.68044499970084,
53.47808444513694
],
[
-113.68054702777954,
53.477996464115634
],
[
-113.68052483246097,
53.477924208174315
],
[
-113.68056885942696,
53.47791939521175
],
[
-113.68053709937743,
53.477815996816304
],
[
-113.68078923151252,
53.47778843454846
],
[
-113.68080748505014,
53.477847858619725
],
[
-113.68081855658458,
53.47784664901273
],
[
-113.68084994243219,
53.477948820635625
],
[
-113.68078529648466,
53.47795588714683
],
[
-113.68079952558584,
53.47800220959262
],
[
-113.6806954415489,
53.47801358735863
],
[
-113.68068677503277,
53.47798537586753
],
[
-113.68067493911653,
53.477986669686096
],
[
-113.68069088112983,
53.47803856717303
],
[
-113.68067996934485,
53.47803975922287
],
[
-113.68065919809773,
53.47805767132782
],
[
-113.68066651729133,
53.47806069132629
],
[
-113.68062896223218,
53.478093076439194
],
[
-113.68063551706895,
53.47809578168251
],
[
-113.68057893573297,
53.478144572985066
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.49781400000e+000",
"Liters": 78550,
"number": "4462",
"FID_Catchm": 14600,
"Gal": "2.07500000000e+004",
"Area_1": "6.05700000000e+003",
"Showers": 1746,
"area_km2": "4.25687479300052",
"ID": 181,
"GRIDCODE": 140
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.68162614321956,
53.47716364020864
],
[
-113.68181596345252,
53.47704596569646
],
[
-113.68192448870033,
53.47710826731117
],
[
-113.68173466697506,
53.47722594288916
],
[
-113.68162614321956,
53.47716364020864
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.49781400000e+000",
"Liters": 25360,
"number": "4462",
"FID_Catchm": 14601,
"Gal": "6.70000000000e+003",
"Area_1": "1.95600000000e+003",
"Showers": 564,
"area_km2": "4.25687479300052",
"ID": 181,
"GRIDCODE": 140
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.68209852547066,
53.4773591176602
],
[
-113.6821376692482,
53.477208038683045
],
[
-113.68245807584174,
53.477237581987474
],
[
-113.68241893317423,
53.47738866107049
],
[
-113.68209852547066,
53.4773591176602
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.49781400000e+000",
"Liters": 51100,
"number": "4462",
"FID_Catchm": 14602,
"Gal": "1.35000000000e+004",
"Area_1": "3.94200000000e+003",
"Showers": 1136,
"area_km2": "4.25687479300052",
"ID": 181,
"GRIDCODE": 140
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.6805579376536,
53.476899268764434
],
[
-113.68055931956695,
53.47687250840553
],
[
-113.68063503189704,
53.47687389870807
],
[
-113.68063365002448,
53.476900659966525
],
[
-113.6805579376536,
53.476899268764434
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.49781400000e+000",
"Liters": 2091,
"number": "4462",
"FID_Catchm": 14603,
"Gal": "5.52500000000e+002",
"Area_1": "1.61300000000e+002",
"Showers": 46,
"area_km2": "4.25687479300052",
"ID": 181,
"GRIDCODE": 140
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.68202932930559,
53.47695404195024
],
[
-113.68205106975974,
53.47692279418969
],
[
-113.68211173491318,
53.47693781490041
],
[
-113.68208999448905,
53.47696906357055
],
[
-113.68202932930559,
53.47695404195024
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.49781400000e+000",
"Liters": 2292,
"number": "4462",
"FID_Catchm": 14604,
"Gal": "6.05600000000e+002",
"Area_1": "1.76800000000e+002",
"Showers": 51,
"area_km2": "4.25687479300052",
"ID": 181,
"GRIDCODE": 140
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.6820696178397,
53.47684425872862
],
[
-113.68214936014473,
53.47683971631755
],
[
-113.68215448913956,
53.476871755342316
],
[
-113.68207474677503,
53.476876297756675
],
[
-113.6820696178397,
53.47684425872862
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.49781400000e+000",
"Liters": 2659,
"number": "4462",
"FID_Catchm": 14605,
"Gal": "7.02500000000e+002",
"Area_1": "2.05100000000e+002",
"Showers": 59,
"area_km2": "4.25687479300052",
"ID": 181,
"GRIDCODE": 140
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.68122240086385,
53.47752028333336
],
[
-113.68122882236948,
53.477489521445214
],
[
-113.68130350748082,
53.477495070022364
],
[
-113.68129708602838,
53.4775258319146
],
[
-113.68122240086385,
53.47752028333336
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.49781400000e+000",
"Liters": 2406,
"number": "4462",
"FID_Catchm": 14606,
"Gal": "6.35700000000e+002",
"Area_1": "1.85600000000e+002",
"Showers": 53,
"area_km2": "4.25687479300052",
"ID": 181,
"GRIDCODE": 140
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.68101200424975,
53.477117477613824
],
[
-113.68109272205348,
53.477115909299016
],
[
-113.6810941509075,
53.4771421092446
],
[
-113.68101343456038,
53.4771436775643
],
[
-113.68101200424975,
53.477117477613824
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.49781400000e+000",
"Liters": 2183,
"number": "4462",
"FID_Catchm": 14607,
"Gal": "5.76800000000e+002",
"Area_1": "1.68400000000e+002",
"Showers": 49,
"area_km2": "4.25687479300052",
"ID": 181,
"GRIDCODE": 140
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.6693805282925,
53.47619612454754
],
[
-113.66946527748826,
53.47619431015144
],
[
-113.66946679684321,
53.47621956876069
],
[
-113.66938204759009,
53.47622138405642
],
[
-113.6693805282925,
53.47619612454754
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 2116,
"number": "4462",
"FID_Catchm": 14610,
"Gal": "5.59000000000e+002",
"Area_1": "1.70500000000e+002",
"Showers": 47,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.66193909779965,
53.468927032222226
],
[
-113.66206682542057,
53.46877404085554
],
[
-113.66219829965517,
53.46881311916262
],
[
-113.66219327755316,
53.46881913461742
],
[
-113.66226428090187,
53.46884023869946
],
[
-113.66229333697648,
53.468805433306756
],
[
-113.66242477244725,
53.46884450047119
],
[
-113.66236335953126,
53.46891805945072
],
[
-113.66222941176353,
53.46887824646368
],
[
-113.66223314298881,
53.4688737774555
],
[
-113.66216404172518,
53.468853237665805
],
[
-113.66215969470234,
53.46885844448434
],
[
-113.66217802023552,
53.468863891525736
],
[
-113.66213733547427,
53.468912622970215
],
[
-113.66212054694965,
53.46890763226761
],
[
-113.66207149489657,
53.468966385555795
],
[
-113.66193909779965,
53.468927032222226
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 40840,
"number": "4462",
"FID_Catchm": 14613,
"Gal": "1.07900000000e+004",
"Area_1": "3.29100000000e+003",
"Showers": 908,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.6636551517258,
53.46880246166596
],
[
-113.66382622837331,
53.46873494458443
],
[
-113.66389256047401,
53.46879478427568
],
[
-113.66372148369025,
53.468862301451175
],
[
-113.6636551517258,
53.46880246166596
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 14530,
"number": "4462",
"FID_Catchm": 14614,
"Gal": "3.83900000000e+003",
"Area_1": "1.17100000000e+003",
"Showers": 323,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.66335379378897,
53.46995415336734
],
[
-113.66345846167088,
53.469771683287675
],
[
-113.66362620171141,
53.46980593867242
],
[
-113.66357374604564,
53.46989738507594
],
[
-113.66354081232785,
53.46989065974054
],
[
-113.66353076401597,
53.46990817674181
],
[
-113.66366747897737,
53.469936095799454
],
[
-113.66362531435412,
53.47000960175216
],
[
-113.66335379378897,
53.46995415336734
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 41530,
"number": "4462",
"FID_Catchm": 14616,
"Gal": "1.09700000000e+004",
"Area_1": "3.34700000000e+003",
"Showers": 923,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.68597745524262,
53.482674841061744
],
[
-113.68597552511217,
53.48261653725631
],
[
-113.68591813171777,
53.48261721316249
],
[
-113.6859156708014,
53.48254287506699
],
[
-113.68602505162279,
53.482541587206946
],
[
-113.68602571317894,
53.48256155502821
],
[
-113.68622127291125,
53.48255925147762
],
[
-113.68622500318894,
53.48267192465063
],
[
-113.68597745524262,
53.482674841061744
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.49781400000e+000",
"Liters": 34240,
"number": "4462",
"FID_Catchm": 15390,
"Gal": "9.04600000000e+003",
"Area_1": "2.64100000000e+003",
"Showers": 761,
"area_km2": "4.25687479300052",
"ID": 181,
"GRIDCODE": 140
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.68547436517844,
53.48230618501889
],
[
-113.68545790582029,
53.482256220650605
],
[
-113.68544641345687,
53.48225756706656
],
[
-113.68544444057812,
53.482251578069445
],
[
-113.68541116970043,
53.48225547850559
],
[
-113.68538651688198,
53.48218064615639
],
[
-113.68543322810015,
53.48217517170225
],
[
-113.68541050986539,
53.48210620963793
],
[
-113.68557096211573,
53.48208740353308
],
[
-113.68558936791777,
53.48214327593809
],
[
-113.6857039504495,
53.48212984574016
],
[
-113.68573802338561,
53.48223327570848
],
[
-113.68582478293946,
53.48222310605474
],
[
-113.68585149346117,
53.48230418452614
],
[
-113.68563336450103,
53.482329752277174
],
[
-113.68563938636306,
53.48234803314306
],
[
-113.6855728927457,
53.4823558270524
],
[
-113.68558069154153,
53.48237949972733
],
[
-113.68528135822535,
53.482414585065435
],
[
-113.68525415221413,
53.48233199640579
],
[
-113.68547436517844,
53.48230618501889
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.49781400000e+000",
"Liters": 99820,
"number": "4462",
"FID_Catchm": 15393,
"Gal": "2.63700000000e+004",
"Area_1": "7.70000000000e+003",
"Showers": 2218,
"area_km2": "4.25687479300052",
"ID": 181,
"GRIDCODE": 140
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.68491199533538,
53.48177891698752
],
[
-113.68490961217816,
53.481774637841774
],
[
-113.68489551357987,
53.48177742947812
],
[
-113.68485248340586,
53.48170011693562
],
[
-113.68485756160959,
53.48169911130866
],
[
-113.68482475386294,
53.481640167119664
],
[
-113.68484168269923,
53.481636814138305
],
[
-113.68482736315572,
53.48161108618183
],
[
-113.68482379816164,
53.48161179206971
],
[
-113.6847801632083,
53.481533393288466
],
[
-113.68490460887301,
53.48150874743262
],
[
-113.68494079433741,
53.48157376069193
],
[
-113.68495818177131,
53.481570317245335
],
[
-113.6849787781044,
53.481607323038695
],
[
-113.68500013939419,
53.48160309209963
],
[
-113.68503898623763,
53.48167288662632
],
[
-113.6851925103021,
53.48164248245967
],
[
-113.68523305826949,
53.481715333063
],
[
-113.68491199533538,
53.48177891698752
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.49781400000e+000",
"Liters": 57160,
"number": "4462",
"FID_Catchm": 15394,
"Gal": "1.51000000000e+004",
"Area_1": "4.41000000000e+003",
"Showers": 1270,
"area_km2": "4.25687479300052",
"ID": 181,
"GRIDCODE": 140
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.68477055894266,
53.48146458070137
],
[
-113.68485458545409,
53.481444925167544
],
[
-113.68487753669571,
53.48147983445483
],
[
-113.68479350861273,
53.481499490899125
],
[
-113.68477055894266,
53.48146458070137
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.49781400000e+000",
"Liters": 3490,
"number": "4462",
"FID_Catchm": 15395,
"Gal": "9.22000000000e+002",
"Area_1": "2.69200000000e+002",
"Showers": 78,
"area_km2": "4.25687479300052",
"ID": 181,
"GRIDCODE": 140
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.68549879271549,
53.48181263795896
],
[
-113.68559194241323,
53.481802602108054
],
[
-113.68560324220455,
53.481839919413304
],
[
-113.68551009242111,
53.481849956171395
],
[
-113.68549879271549,
53.48181263795896
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.49781400000e+000",
"Liters": 3702,
"number": "4462",
"FID_Catchm": 15396,
"Gal": "9.77900000000e+002",
"Area_1": "2.85500000000e+002",
"Showers": 82,
"area_km2": "4.25687479300052",
"ID": 181,
"GRIDCODE": 140
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.68510025772898,
53.48127872526189
],
[
-113.68509007957474,
53.48126131045176
],
[
-113.68506704216338,
53.481266101313864
],
[
-113.68499391803708,
53.48114098553746
],
[
-113.68492746288574,
53.481154806127556
],
[
-113.68493336711822,
53.481164907626834
],
[
-113.68491676916916,
53.481168358542746
],
[
-113.68492907448015,
53.48118941293138
],
[
-113.68478897767434,
53.48121854740026
],
[
-113.68466378958423,
53.481004347545515
],
[
-113.68481720059577,
53.48097244379121
],
[
-113.68486191710733,
53.48104895385661
],
[
-113.68493269169423,
53.4810342362008
],
[
-113.6849005555166,
53.48097925035079
],
[
-113.68505528189019,
53.480947073887435
],
[
-113.68508557810657,
53.48099890973274
],
[
-113.68511041834266,
53.480993743507426
],
[
-113.68512827985724,
53.481024304472115
],
[
-113.685107588704,
53.48102860729093
],
[
-113.68515368925671,
53.48110748512018
],
[
-113.68514894117452,
53.48110847275868
],
[
-113.68522156140523,
53.48123272535178
],
[
-113.68520028928499,
53.48123714886658
],
[
-113.68521111458192,
53.4812556715537
],
[
-113.68510025772898,
53.48127872526189
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.49781400000e+000",
"Liters": 101300,
"number": "4462",
"FID_Catchm": 15399,
"Gal": "2.67500000000e+004",
"Area_1": "7.80900000000e+003",
"Showers": 2251,
"area_km2": "4.25687479300052",
"ID": 181,
"GRIDCODE": 140
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.68545416188783,
53.48072955141025
],
[
-113.68558350805593,
53.48067090107703
],
[
-113.68571145994865,
53.4807713097902
],
[
-113.68558211214409,
53.48082996025664
],
[
-113.68545416188783,
53.48072955141025
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.49781400000e+000",
"Liters": 21130,
"number": "4462",
"FID_Catchm": 15400,
"Gal": "5.58300000000e+003",
"Area_1": "1.63000000000e+003",
"Showers": 470,
"area_km2": "4.25687479300052",
"ID": 181,
"GRIDCODE": 140
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.68388133728554,
53.48080143707567
],
[
-113.68402976548444,
53.48077776584678
],
[
-113.6840900493998,
53.4809122683552
],
[
-113.68394162076447,
53.480935939657805
],
[
-113.68388133728554,
53.48080143707567
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.49781400000e+000",
"Liters": 22050,
"number": "4462",
"FID_Catchm": 15401,
"Gal": "5.82600000000e+003",
"Area_1": "1.70100000000e+003",
"Showers": 490,
"area_km2": "4.25687479300052",
"ID": 181,
"GRIDCODE": 140
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.68087316423205,
53.48048911497957
],
[
-113.6810327208645,
53.480486944846255
],
[
-113.68103656288656,
53.48058748467907
],
[
-113.68087700588384,
53.48058965391826
],
[
-113.68087316423205,
53.48048911497957
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.49781400000e+000",
"Liters": 16540,
"number": "4462",
"FID_Catchm": 15403,
"Gal": "4.37000000000e+003",
"Area_1": "1.27600000000e+003",
"Showers": 368,
"area_km2": "4.25687479300052",
"ID": 181,
"GRIDCODE": 140
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.68126870340724,
53.4802489014593
],
[
-113.68132597059228,
53.48017137250368
],
[
-113.68146265358618,
53.48020729824971
],
[
-113.68140538810778,
53.480284827274595
],
[
-113.68126870340724,
53.4802489014593
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.49781400000e+000",
"Liters": 13040,
"number": "4462",
"FID_Catchm": 15404,
"Gal": "3.44600000000e+003",
"Area_1": "1.00600000000e+003",
"Showers": 290,
"area_km2": "4.25687479300052",
"ID": 181,
"GRIDCODE": 140
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.67990245073918,
53.48031431679582
],
[
-113.67996326324966,
53.480311498982374
],
[
-113.67996978144063,
53.48036155253443
],
[
-113.679908968859,
53.48036437035099
],
[
-113.67990245073918,
53.48031431679582
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.49781400000e+000",
"Liters": 3157,
"number": "4462",
"FID_Catchm": 15405,
"Gal": "8.34000000000e+002",
"Area_1": "2.43500000000e+002",
"Showers": 70,
"area_km2": "4.25687479300052",
"ID": 181,
"GRIDCODE": 140
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.68146728560805,
53.48035253496836
],
[
-113.68147868039779,
53.48024589918504
],
[
-113.68161622775618,
53.4802511298295
],
[
-113.68161328927943,
53.48027862558974
],
[
-113.68173409776274,
53.480283218426344
],
[
-113.6817373082444,
53.4802531830327
],
[
-113.68183243965417,
53.48025680069887
],
[
-113.68181925919247,
53.48038014131117
],
[
-113.68157451074234,
53.48037083591871
],
[
-113.68157602380136,
53.48035666985572
],
[
-113.68146728560805,
53.48035253496836
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.49781400000e+000",
"Liters": 39440,
"number": "4462",
"FID_Catchm": 15406,
"Gal": "1.04200000000e+004",
"Area_1": "3.04100000000e+003",
"Showers": 876,
"area_km2": "4.25687479300052",
"ID": 181,
"GRIDCODE": 140
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.67740788308619,
53.481587090325505
],
[
-113.67759748122836,
53.48158691718711
],
[
-113.67759772795517,
53.481682936429
],
[
-113.67740812937807,
53.48168311046579
],
[
-113.67740788308619,
53.481587090325505
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.49781400000e+000",
"Liters": 18780,
"number": "4462",
"FID_Catchm": 15407,
"Gal": "4.96000000000e+003",
"Area_1": "1.44800000000e+003",
"Showers": 417,
"area_km2": "4.25687479300052",
"ID": 181,
"GRIDCODE": 140
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.67777183811569,
53.481603896554
],
[
-113.67780932346527,
53.48152732688615
],
[
-113.67792522794967,
53.48154751641069
],
[
-113.67788774128427,
53.48162408611087
],
[
-113.67777183811569,
53.481603896554
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.49781400000e+000",
"Liters": 9933,
"number": "4462",
"FID_Catchm": 15408,
"Gal": "2.62400000000e+003",
"Area_1": "7.66000000000e+002",
"Showers": 221,
"area_km2": "4.25687479300052",
"ID": 181,
"GRIDCODE": 140
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.67707146233592,
53.48168151565262
],
[
-113.6770734702183,
53.48161350031792
],
[
-113.67724926453377,
53.481615346441
],
[
-113.67724815322504,
53.48165299945788
],
[
-113.6772652200663,
53.48165317853845
],
[
-113.67726455073807,
53.48167586828951
],
[
-113.67724748388774,
53.481675689208934
],
[
-113.67724725693932,
53.481683360880496
],
[
-113.67707146233592,
53.48168151565262
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.49781400000e+000",
"Liters": 12730,
"number": "4462",
"FID_Catchm": 15409,
"Gal": "3.36300000000e+003",
"Area_1": "9.82000000000e+002",
"Showers": 283,
"area_km2": "4.25687479300052",
"ID": 181,
"GRIDCODE": 140
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.6777016246458,
53.48146799370334
],
[
-113.67774664842811,
53.48138862186526
],
[
-113.67785240231828,
53.48140996665546
],
[
-113.67786013883327,
53.481396326923715
],
[
-113.67798499555272,
53.481421526876154
],
[
-113.67793223567128,
53.48151453854092
],
[
-113.6777016246458,
53.48146799370334
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.49781400000e+000",
"Liters": 22990,
"number": "4462",
"FID_Catchm": 15410,
"Gal": "6.07300000000e+003",
"Area_1": "1.77300000000e+003",
"Showers": 511,
"area_km2": "4.25687479300052",
"ID": 181,
"GRIDCODE": 140
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.67849024704492,
53.481558500888376
],
[
-113.67856865852427,
53.481536128967704
],
[
-113.67861988336588,
53.48160001102086
],
[
-113.67854147179541,
53.48162238297466
],
[
-113.67849024704492,
53.481558500888376
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.49781400000e+000",
"Liters": 6348,
"number": "4462",
"FID_Catchm": 15411,
"Gal": "1.67700000000e+003",
"Area_1": "4.89500000000e+002",
"Showers": 141,
"area_km2": "4.25687479300052",
"ID": 181,
"GRIDCODE": 140
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.67859775636894,
53.48198033972912
],
[
-113.67861909228287,
53.48184701636264
],
[
-113.67878527156324,
53.48185647789873
],
[
-113.67876393615852,
53.48198980219398
],
[
-113.67859775636894,
53.48198033972912
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.49781400000e+000",
"Liters": 23050,
"number": "4462",
"FID_Catchm": 15412,
"Gal": "6.09000000000e+003",
"Area_1": "1.77800000000e+003",
"Showers": 512,
"area_km2": "4.25687479300052",
"ID": 181,
"GRIDCODE": 140
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.67816073300975,
53.48213822386102
],
[
-113.67816463822244,
53.48209258437905
],
[
-113.67831885684494,
53.48209727870949
],
[
-113.67831698780348,
53.48211911964841
],
[
-113.6782499921151,
53.48211708009846
],
[
-113.6782479560715,
53.4821408786455
],
[
-113.67816073300975,
53.48213822386102
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.49781400000e+000",
"Liters": 5629,
"number": "4462",
"FID_Catchm": 15413,
"Gal": "1.48700000000e+003",
"Area_1": "4.34100000000e+002",
"Showers": 125,
"area_km2": "4.25687479300052",
"ID": 181,
"GRIDCODE": 140
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.6784168538017,
53.48218384797866
],
[
-113.67846994329975,
53.48209642541765
],
[
-113.6786370775819,
53.482132538736565
],
[
-113.67858398838166,
53.48221996137174
],
[
-113.6784168538017,
53.48218384797866
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.49781400000e+000",
"Liters": 17040,
"number": "4462",
"FID_Catchm": 15414,
"Gal": "4.50100000000e+003",
"Area_1": "1.31400000000e+003",
"Showers": 379,
"area_km2": "4.25687479300052",
"ID": 181,
"GRIDCODE": 140
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.67874912792112,
53.48237522499308
],
[
-113.67875556678115,
53.482301022080286
],
[
-113.67890739398014,
53.48230570922234
],
[
-113.67890095537742,
53.48237991304222
],
[
-113.67874912792112,
53.48237522499308
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.49781400000e+000",
"Liters": 11650,
"number": "4462",
"FID_Catchm": 15415,
"Gal": "3.07700000000e+003",
"Area_1": "8.98400000000e+002",
"Showers": 259,
"area_km2": "4.25687479300052",
"ID": 181,
"GRIDCODE": 140
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.67813474816951,
53.48193415812276
],
[
-113.67814320625637,
53.4819036040903
],
[
-113.67823998957418,
53.481913137382946
],
[
-113.67823153155491,
53.48194369142242
],
[
-113.67813474816951,
53.48193415812276
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.49781400000e+000",
"Liters": 3132,
"number": "4462",
"FID_Catchm": 15416,
"Gal": "8.27500000000e+002",
"Area_1": "2.41600000000e+002",
"Showers": 70,
"area_km2": "4.25687479300052",
"ID": 181,
"GRIDCODE": 140
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.67843659314555,
53.48271697649919
],
[
-113.67847577840016,
53.482630340552774
],
[
-113.67849761409384,
53.48263385442552
],
[
-113.67852760806791,
53.48256754083233
],
[
-113.67851022168873,
53.4825647434389
],
[
-113.67854711461717,
53.48248317751653
],
[
-113.6787343816912,
53.48251331341022
],
[
-113.67869926324305,
53.48259095815792
],
[
-113.67867853949997,
53.48258762343795
],
[
-113.67864528697302,
53.482661143200495
],
[
-113.67866194664666,
53.482663823598976
],
[
-113.6786242478702,
53.48274717471112
],
[
-113.67843659314555,
53.48271697649919
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.49781400000e+000",
"Liters": 45650,
"number": "4462",
"FID_Catchm": 15417,
"Gal": "1.20600000000e+004",
"Area_1": "3.52200000000e+003",
"Showers": 1014,
"area_km2": "4.25687479300052",
"ID": 181,
"GRIDCODE": 140
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.67768251467548,
53.48270335329103
],
[
-113.67756848307035,
53.48268292237363
],
[
-113.67756290336183,
53.482694001488944
],
[
-113.67738725099115,
53.4826625301324
],
[
-113.6774503825402,
53.482537164610434
],
[
-113.67743887200953,
53.482535102700325
],
[
-113.67745330619876,
53.48250643753862
],
[
-113.67775450126489,
53.48256040333969
],
[
-113.67768251467548,
53.48270335329103
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.49781400000e+000",
"Liters": 49100,
"number": "4462",
"FID_Catchm": 15418,
"Gal": "1.29700000000e+004",
"Area_1": "3.78800000000e+003",
"Showers": 1091,
"area_km2": "4.25687479300052",
"ID": 181,
"GRIDCODE": 140
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.67612695699246,
53.477847119351345
],
[
-113.67637124621253,
53.477841644210294
],
[
-113.67636756119836,
53.477917091750776
],
[
-113.67612374600411,
53.477912853920245
],
[
-113.67612695699246,
53.477847119351345
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.49781400000e+000",
"Liters": 17760,
"number": "4462",
"FID_Catchm": 15419,
"Gal": "4.69200000000e+003",
"Area_1": "1.37000000000e+003",
"Showers": 395,
"area_km2": "4.25687479300052",
"ID": 181,
"GRIDCODE": 140
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.67637124621253,
53.477841644210294
],
[
-113.67612695699246,
53.477847119351345
],
[
-113.67613188694172,
53.477746194636005
],
[
-113.67610506289029,
53.47774572835317
],
[
-113.67610978468632,
53.477649071017254
],
[
-113.67634266243336,
53.4776531184083
],
[
-113.67633799627194,
53.47774867061924
],
[
-113.6763018161804,
53.47774804155578
],
[
-113.67629853466613,
53.47781523394547
],
[
-113.67637247338946,
53.47781651880285
],
[
-113.67637124621253,
53.477841644210294
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 40500,
"number": "4462",
"FID_Catchm": 15420,
"Gal": "1.07000000000e+004",
"Area_1": "3.26400000000e+003",
"Showers": 900,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.67699460739333,
53.477456423475424
],
[
-113.67714991477229,
53.47736188932514
],
[
-113.6772262562036,
53.477406523462236
],
[
-113.67707095033676,
53.47750105771511
],
[
-113.67699460739333,
53.477456423475424
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 13960,
"number": "4462",
"FID_Catchm": 15421,
"Gal": "3.68800000000e+003",
"Area_1": "1.12500000000e+003",
"Showers": 310,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.67526697280611,
53.4762574720555
],
[
-113.67532359713418,
53.476243773002324
],
[
-113.67536537292483,
53.47630522708095
],
[
-113.67530874852127,
53.47631892705224
],
[
-113.67526697280611,
53.4762574720555
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 4001,
"number": "4462",
"FID_Catchm": 15422,
"Gal": "1.05700000000e+003",
"Area_1": "3.22300000000e+002",
"Showers": 89,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.67625582251819,
53.47716479686839
],
[
-113.67611703254791,
53.477061252865326
],
[
-113.67634343761168,
53.47695325002123
],
[
-113.67648060266939,
53.47705558163908
],
[
-113.6764006927484,
53.4770937015869
],
[
-113.6764284334695,
53.47711439788695
],
[
-113.67636360197288,
53.47714532486171
],
[
-113.67633748637529,
53.477125840673224
],
[
-113.67625582251819,
53.47716479686839
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 39820,
"number": "4462",
"FID_Catchm": 15423,
"Gal": "1.05200000000e+004",
"Area_1": "3.20900000000e+003",
"Showers": 885,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.6759766186801,
53.47718479978504
],
[
-113.67600954475004,
53.477155361785
],
[
-113.67612079885119,
53.47719964826082
],
[
-113.67608787282359,
53.477229086291416
],
[
-113.6759766186801,
53.47718479978504
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 4671,
"number": "4462",
"FID_Catchm": 15424,
"Gal": "1.23400000000e+003",
"Area_1": "3.76500000000e+002",
"Showers": 104,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.68085029881307,
53.47932336878391
],
[
-113.68086630934366,
53.479162670928886
],
[
-113.6808583939578,
53.47916239009584
],
[
-113.68086723334737,
53.47907365941188
],
[
-113.68102447154565,
53.479079234468834
],
[
-113.68101641777442,
53.4791600694241
],
[
-113.68107575758525,
53.47916217326644
],
[
-113.6810691130088,
53.4792288598594
],
[
-113.68100977461168,
53.479226756017674
],
[
-113.68099962100786,
53.47932866303641
],
[
-113.68085029881307,
53.47932336878391
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.49781400000e+000",
"Liters": 43380,
"number": "4462",
"FID_Catchm": 16478,
"Gal": "1.14600000000e+004",
"Area_1": "3.34500000000e+003",
"Showers": 964,
"area_km2": "4.25687479300052",
"ID": 181,
"GRIDCODE": 140
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.68563942974738,
53.479195406668424
],
[
-113.68554661275249,
53.47912576865467
],
[
-113.68574493764731,
53.4790317022846
],
[
-113.68573265053438,
53.479022484439625
],
[
-113.68578992900986,
53.47899531656376
],
[
-113.68592382467241,
53.47909577216067
],
[
-113.68576823329228,
53.47916956994056
],
[
-113.68573944343342,
53.47914796996639
],
[
-113.68563942974738,
53.479195406668424
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.49781400000e+000",
"Liters": 36500,
"number": "4462",
"FID_Catchm": 22070,
"Gal": "9.64200000000e+003",
"Area_1": "2.81500000000e+003",
"Showers": 811,
"area_km2": "4.25687479300052",
"ID": 181,
"GRIDCODE": 140
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.68378142270156,
53.47053352344672
],
[
-113.68378244090673,
53.47049703734884
],
[
-113.68381517583695,
53.470497362094854
],
[
-113.6838154897869,
53.47048612406124
],
[
-113.68384831054634,
53.47048644992386
],
[
-113.683846680115,
53.47054493407276
],
[
-113.68382057135885,
53.47054467449312
],
[
-113.6838208712126,
53.47053391448059
],
[
-113.68378142270156,
53.47053352344672
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.49781400000e+000",
"Liters": 3138,
"number": "4462",
"FID_Catchm": 25526,
"Gal": "8.28900000000e+002",
"Area_1": "2.42000000000e+002",
"Showers": 70,
"area_km2": "4.25687479300052",
"ID": 181,
"GRIDCODE": 140
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.68511520613673,
53.47014484159744
],
[
-113.68526311119231,
53.47008151287899
],
[
-113.68528709662168,
53.47010145590702
],
[
-113.68513919152561,
53.470164785553436
],
[
-113.68511520613673,
53.47014484159744
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.49781400000e+000",
"Liters": 4611,
"number": "4462",
"FID_Catchm": 25527,
"Gal": "1.21800000000e+003",
"Area_1": "3.55500000000e+002",
"Showers": 102,
"area_km2": "4.25687479300052",
"ID": 181,
"GRIDCODE": 140
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.68419642569637,
53.47043488010514
],
[
-113.68421078375982,
53.4704341686101
],
[
-113.68422513069777,
53.470434955958595
],
[
-113.68423903144135,
53.47043721763735
],
[
-113.6842520617905,
53.47044088513024
],
[
-113.68426382647974,
53.47044584686473
],
[
-113.68427396969311,
53.47045195183379
],
[
-113.68428218104205,
53.47045901590241
],
[
-113.6842882121247,
53.47046682274922
],
[
-113.68429187945168,
53.47047513555646
],
[
-113.68429307043019,
53.4704837024172
],
[
-113.6842917523537,
53.47049226264945
],
[
-113.68428796178664,
53.47050055665254
],
[
-113.68428181506707,
53.47050833132686
],
[
-113.6842734991901,
53.47051535083255
],
[
-113.68426326573788,
53.47052140286441
],
[
-113.68425142784037,
53.47052630223784
],
[
-113.68423834353598,
53.47052990072984
],
[
-113.6842244097336,
53.47053208886014
],
[
-113.68421005163728,
53.47053280035678
],
[
-113.68419570466665,
53.47053201300641
],
[
-113.68418180540047,
53.470529751326595
],
[
-113.68416877503026,
53.470526083826066
],
[
-113.68415700882395,
53.470521122078345
],
[
-113.68414686712366,
53.47051501620467
],
[
-113.68413865577979,
53.470507953025475
],
[
-113.68413262471881,
53.4705001461712
],
[
-113.68412895742753,
53.47049183246059
],
[
-113.6841277649758,
53.47048326559426
],
[
-113.68412908459106,
53.47047470536787
],
[
-113.68413287518005,
53.47046641226833
],
[
-113.68413902192077,
53.47045863760173
],
[
-113.68414733781542,
53.470451617206706
],
[
-113.68415756975453,
53.470445566079285
],
[
-113.6841694091463,
53.47044066671908
],
[
-113.68418249342903,
53.47043706823464
],
[
-113.68419642569637,
53.47043488010514
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.49781400000e+000",
"Liters": 13150,
"number": "4462",
"FID_Catchm": 25528,
"Gal": "3.47300000000e+003",
"Area_1": "1.01400000000e+003",
"Showers": 292,
"area_km2": "4.25687479300052",
"ID": 181,
"GRIDCODE": 140
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.68450569858376,
53.47024623852101
],
[
-113.68450928823981,
53.46976217524523
],
[
-113.6845380214024,
53.46976225109842
],
[
-113.68453819079411,
53.46973940628474
],
[
-113.68450906759061,
53.46973932940188
],
[
-113.68451181848337,
53.46936836333122
],
[
-113.68477543554835,
53.46936905899723
],
[
-113.68477480706122,
53.46945388395478
],
[
-113.68481759851711,
53.46945399682352
],
[
-113.68481600431892,
53.46966918809792
],
[
-113.68489110887012,
53.46966938616064
],
[
-113.68489145909975,
53.46962209973919
],
[
-113.6850145991039,
53.469622424376844
],
[
-113.68501608230491,
53.46942208946072
],
[
-113.68516790647469,
53.46942248954362
],
[
-113.68516783541757,
53.46943209186078
],
[
-113.6853124383631,
53.469432472735136
],
[
-113.68531237713555,
53.469440750532875
],
[
-113.68539946301227,
53.46944097982679
],
[
-113.68539863880544,
53.46955244074977
],
[
-113.68541138862335,
53.4695524743143
],
[
-113.68540976414698,
53.46977216572861
],
[
-113.68494595062205,
53.46977094383775
],
[
-113.68494523852101,
53.469867104484216
],
[
-113.68543136770032,
53.46986838512061
],
[
-113.6854298337025,
53.47007585122766
],
[
-113.68490066007261,
53.470074457097965
],
[
-113.68490074654548,
53.470062781738704
],
[
-113.68481462475934,
53.47006255462562
],
[
-113.6848132579223,
53.47024705009892
],
[
-113.68450569858376,
53.47024623852101
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.49781400000e+000",
"Liters": 581800,
"number": "4462",
"FID_Catchm": 25529,
"Gal": "1.53700000000e+005",
"Area_1": "4.48600000000e+004",
"Showers": 12929,
"area_km2": "4.25687479300052",
"ID": 181,
"GRIDCODE": 140
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.68430576698414,
53.47054818577176
],
[
-113.68437271565234,
53.47054764911953
],
[
-113.68437356848818,
53.47058555636612
],
[
-113.6843066197602,
53.4705860930187
],
[
-113.68430576698414,
53.47054818577176
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.49781400000e+000",
"Liters": 2618,
"number": "4462",
"FID_Catchm": 25530,
"Gal": "6.91500000000e+002",
"Area_1": "2.01900000000e+002",
"Showers": 58,
"area_km2": "4.25687479300052",
"ID": 181,
"GRIDCODE": 140
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.66186252423633,
53.47590820222227
],
[
-113.661864924954,
53.47586313944662
],
[
-113.66194964664517,
53.475864745004266
],
[
-113.6619472460172,
53.475909807781775
],
[
-113.66186252423633,
53.47590820222227
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 3773,
"number": "4462",
"FID_Catchm": 77881,
"Gal": "9.96600000000e+002",
"Area_1": "3.04000000000e+002",
"Showers": 84,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.66132824134186,
53.47640909078348
],
[
-113.66132883421544,
53.476334631305605
],
[
-113.66143647458104,
53.47633493629035
],
[
-113.66143588189594,
53.476409395769025
],
[
-113.66132824134186,
53.47640909078348
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 7912,
"number": "4462",
"FID_Catchm": 77882,
"Gal": "2.09000000000e+003",
"Area_1": "6.37500000000e+002",
"Showers": 176,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.6608963618227,
53.47596171381263
],
[
-113.66095615399081,
53.47595551863066
],
[
-113.66096729940784,
53.47599380479219
],
[
-113.6609075071875,
53.47599999997958
],
[
-113.6608963618227,
53.47596171381263
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 2328,
"number": "4462",
"FID_Catchm": 77883,
"Gal": "6.15000000000e+002",
"Area_1": "1.87600000000e+002",
"Showers": 52,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.66146658421174,
53.476027309355935
],
[
-113.66152124901997,
53.476026799222936
],
[
-113.66152564239061,
53.476194176969884
],
[
-113.66142030424237,
53.47619516089758
],
[
-113.66141926295461,
53.47615548091357
],
[
-113.66146993603216,
53.47615500712101
],
[
-113.66146658421174,
53.476027309355935
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 11020,
"number": "4462",
"FID_Catchm": 77884,
"Gal": "2.91100000000e+003",
"Area_1": "8.87900000000e+002",
"Showers": 245,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.66091577860901,
53.47582836998909
],
[
-113.66097762137841,
53.475827179558316
],
[
-113.66097976244883,
53.47586677999698
],
[
-113.66091791962198,
53.475867970428816
],
[
-113.66091577860901,
53.47582836998909
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 2420,
"number": "4462",
"FID_Catchm": 77885,
"Gal": "6.39300000000e+002",
"Area_1": "1.95000000000e+002",
"Showers": 54,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.66111082743552,
53.47594434464981
],
[
-113.66116237963502,
53.475939368770455
],
[
-113.66117239138173,
53.47597628581783
],
[
-113.66112083913863,
53.47598126170136
],
[
-113.66111082743552,
53.47594434464981
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 1927,
"number": "4462",
"FID_Catchm": 77886,
"Gal": "5.09100000000e+002",
"Area_1": "1.55300000000e+002",
"Showers": 43,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.66175300053449,
53.47632783497313
],
[
-113.66177739174248,
53.47629637373027
],
[
-113.66190623578787,
53.47633192679539
],
[
-113.66188184315541,
53.4763633871617
],
[
-113.66175300053449,
53.47632783497313
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 4857,
"number": "4462",
"FID_Catchm": 77887,
"Gal": "1.28300000000e+003",
"Area_1": "3.91400000000e+002",
"Showers": 108,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.661047839768,
53.475945531902596
],
[
-113.66110010086771,
53.475941382082105
],
[
-113.66110894455075,
53.4759810284824
],
[
-113.66105668340316,
53.47598517830662
],
[
-113.661047839768,
53.475945531902596
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 2081,
"number": "4462",
"FID_Catchm": 77888,
"Gal": "5.49800000000e+002",
"Area_1": "1.67700000000e+002",
"Showers": 46,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.68067982829625,
53.481538667271934
],
[
-113.68068201357212,
53.48146190623983
],
[
-113.6808045723524,
53.48146314750168
],
[
-113.68080418995989,
53.48147656174473
],
[
-113.68082981129872,
53.48147682067316
],
[
-113.68082876389691,
53.481513607636415
],
[
-113.6808093742742,
53.481513411179606
],
[
-113.6808086175333,
53.48153997100417
],
[
-113.68067982829625,
53.481538667271934
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.49781400000e+000",
"Liters": 10850,
"number": "4462",
"FID_Catchm": 85389,
"Gal": "2.86500000000e+003",
"Area_1": "8.36500000000e+002",
"Showers": 241,
"area_km2": "4.25687479300052",
"ID": 181,
"GRIDCODE": 140
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.68039886022807,
53.48162550952151
],
[
-113.68039893404493,
53.48162029781373
],
[
-113.68034529710692,
53.48162002407376
],
[
-113.68034851899102,
53.481395213563644
],
[
-113.68051175784368,
53.48139604632275
],
[
-113.6805099836594,
53.481519911494736
],
[
-113.68051989726428,
53.48151996225733
],
[
-113.68051911148572,
53.48157482714081
],
[
-113.68050547254002,
53.48157475743355
],
[
-113.68050481149724,
53.481620836995404
],
[
-113.68045863425326,
53.481620602118134
],
[
-113.68045856044377,
53.48162581382591
],
[
-113.68039886022807,
53.48162550952151
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.49781400000e+000",
"Liters": 38540,
"number": "4462",
"FID_Catchm": 85390,
"Gal": "1.01800000000e+004",
"Area_1": "2.97300000000e+003",
"Showers": 856,
"area_km2": "4.25687479300052",
"ID": 181,
"GRIDCODE": 140
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.68090584175415,
53.48164711061682
],
[
-113.68094414110176,
53.48164682916027
],
[
-113.68094638925764,
53.48175558964675
],
[
-113.680908089812,
53.48175587110392
],
[
-113.68090584175415,
53.48164711061682
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.49781400000e+000",
"Liters": 4296,
"number": "4462",
"FID_Catchm": 85391,
"Gal": "1.13500000000e+003",
"Area_1": "3.31300000000e+002",
"Showers": 95,
"area_km2": "4.25687479300052",
"ID": 181,
"GRIDCODE": 140
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.6799626148104,
53.48263022360739
],
[
-113.67998688985718,
53.482586464578546
],
[
-113.68014808039463,
53.482618279811305
],
[
-113.68012380549538,
53.48266203887283
],
[
-113.6799626148104,
53.48263022360739
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.49781400000e+000",
"Liters": 8070,
"number": "4462",
"FID_Catchm": 85392,
"Gal": "2.13200000000e+003",
"Area_1": "6.22400000000e+002",
"Showers": 179,
"area_km2": "4.25687479300052",
"ID": 181,
"GRIDCODE": 140
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.68018680552032,
53.482712136611326
],
[
-113.6802358428745,
53.4826274800199
],
[
-113.68056895108235,
53.48269613090967
],
[
-113.68051991431109,
53.4827807876377
],
[
-113.68018680552032,
53.482712136611326
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.49781400000e+000",
"Liters": 32540,
"number": "4462",
"FID_Catchm": 85393,
"Gal": "8.59700000000e+003",
"Area_1": "2.51000000000e+003",
"Showers": 723,
"area_km2": "4.25687479300052",
"ID": 181,
"GRIDCODE": 140
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.67973079092872,
53.48248178582577
],
[
-113.67973653580636,
53.48248150198473
],
[
-113.67974227617675,
53.48248181660177
],
[
-113.67974783885161,
53.482482722023995
],
[
-113.67975305231123,
53.48248418903646
],
[
-113.67975776020869,
53.48248617408734
],
[
-113.6797618183775,
53.48248861658386
],
[
-113.67976510384266,
53.482491442511176
],
[
-113.67976751632105,
53.48249456533442
],
[
-113.67976898269961,
53.48249789140317
],
[
-113.6797694600623,
53.48250131816152
],
[
-113.6797689311095,
53.482504742223526
],
[
-113.67976741469674,
53.48250806030036
],
[
-113.67976495528247,
53.48251117007005
],
[
-113.67976162738691,
53.48251397827758
],
[
-113.67975753259245,
53.48251639892891
],
[
-113.67975279498383,
53.482518358670966
],
[
-113.67974755963479,
53.48251979768592
],
[
-113.67974198354896,
53.48252067236269
],
[
-113.67973623865934,
53.482520957102565
],
[
-113.67973049829035,
53.482520641586596
],
[
-113.67972493560423,
53.48251973706223
],
[
-113.67971972214123,
53.48251827004852
],
[
-113.679715014242,
53.48251628499622
],
[
-113.67971095607327,
53.482513842498015
],
[
-113.6797076706099,
53.48251101656928
],
[
-113.67970525813506,
53.482507893744796
],
[
-113.67970379025458,
53.48250456767124
],
[
-113.67970331440367,
53.48250114091672
],
[
-113.67970384185526,
53.48249771685098
],
[
-113.67970535977909,
53.482494398779025
],
[
-113.67970781919674,
53.4824912890105
],
[
-113.67971114709407,
53.48248848080447
],
[
-113.67971524188845,
53.48248606015475
],
[
-113.6797199794951,
53.48248410041411
],
[
-113.67972521484077,
53.482482661400404
],
[
-113.67973079092872,
53.48248178582577
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.49781400000e+000",
"Liters": 2103,
"number": "4462",
"FID_Catchm": 85394,
"Gal": "5.55600000000e+002",
"Area_1": "1.62200000000e+002",
"Showers": 47,
"area_km2": "4.25687479300052",
"ID": 181,
"GRIDCODE": 140
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.68050765629818,
53.48239454647367
],
[
-113.68052976613258,
53.48226512119917
],
[
-113.68084889236185,
53.48228451828693
],
[
-113.68082678198165,
53.48241394361747
],
[
-113.68050765629818,
53.48239454647367
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.49781400000e+000",
"Liters": 43040,
"number": "4462",
"FID_Catchm": 85395,
"Gal": "1.13700000000e+004",
"Area_1": "3.31900000000e+003",
"Showers": 956,
"area_km2": "4.25687479300052",
"ID": 181,
"GRIDCODE": 140
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.66170488180877,
53.47699627659607
],
[
-113.66171036275007,
53.47688289348437
],
[
-113.66170324949849,
53.47688277180695
],
[
-113.66170623696209,
53.47682097147836
],
[
-113.66179091354056,
53.47682242784965
],
[
-113.66179233948002,
53.47679294144806
],
[
-113.66183920728378,
53.476793748025536
],
[
-113.66183783344559,
53.47682217961204
],
[
-113.66186058284883,
53.47682257107277
],
[
-113.66186229541874,
53.47678715019179
],
[
-113.66199530816543,
53.47678943868873
],
[
-113.66199368933458,
53.47682293412494
],
[
-113.66203674527588,
53.476823675028896
],
[
-113.6620320134358,
53.476921564720364
],
[
-113.66192414290516,
53.4769197086297
],
[
-113.6619212242165,
53.47698009654899
],
[
-113.66194850853876,
53.476980566419535
],
[
-113.66194754762839,
53.477000452537354
],
[
-113.66170488180877,
53.47699627659607
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 54660,
"number": "4462",
"FID_Catchm": 85852,
"Gal": "1.44400000000e+004",
"Area_1": "4.40500000000e+003",
"Showers": 1215,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.66183863967223,
53.47659156286341
],
[
-113.66192454556627,
53.47658839030733
],
[
-113.66192752425174,
53.47661709929691
],
[
-113.66184161829987,
53.476620271855126
],
[
-113.66183863967223,
53.47659156286341
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 2443,
"number": "4462",
"FID_Catchm": 85853,
"Gal": "6.45500000000e+002",
"Area_1": "1.96900000000e+002",
"Showers": 54,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.6622053301511,
53.4772791389759
],
[
-113.66220628499326,
53.477158911856705
],
[
-113.66229791883359,
53.47715917082014
],
[
-113.66229696425043,
53.477279397940485
],
[
-113.6622053301511,
53.4772791389759
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 10880,
"number": "4462",
"FID_Catchm": 85854,
"Gal": "2.87300000000e+003",
"Area_1": "8.76300000000e+002",
"Showers": 242,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.66194849212948,
53.47715149282181
],
[
-113.66195513466144,
53.47706188110394
],
[
-113.66221616071927,
53.47706876740445
],
[
-113.66220951873603,
53.47715837913751
],
[
-113.66194849212948,
53.47715149282181
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 23130,
"number": "4462",
"FID_Catchm": 85855,
"Gal": "6.11100000000e+003",
"Area_1": "1.86400000000e+003",
"Showers": 514,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.66157138179541,
53.477050036017694
],
[
-113.66157757361722,
53.477009216423504
],
[
-113.66165769529603,
53.4770135418183
],
[
-113.66165150355043,
53.477054361416755
],
[
-113.66157138179541,
53.477050036017694
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 3255,
"number": "4462",
"FID_Catchm": 85856,
"Gal": "8.59900000000e+002",
"Area_1": "2.62300000000e+002",
"Showers": 72,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.66194057656564,
53.47658843565514
],
[
-113.66202762719466,
53.4765852662631
],
[
-113.66203205803578,
53.47662856821801
],
[
-113.66194500581221,
53.47663173760898
],
[
-113.66194057656564,
53.47658843565514
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 3734,
"number": "4462",
"FID_Catchm": 85857,
"Gal": "9.86500000000e+002",
"Area_1": "3.00900000000e+002",
"Showers": 83,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.66246101805137,
53.4773816464322
],
[
-113.66247182272008,
53.47731883027966
],
[
-113.66252896086417,
53.4773223272604
],
[
-113.66251815627174,
53.47738514431676
],
[
-113.66246101805137,
53.4773816464322
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 3580,
"number": "4462",
"FID_Catchm": 85858,
"Gal": "9.45800000000e+002",
"Area_1": "2.88500000000e+002",
"Showers": 80,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.67839132519723,
53.479683476096945
],
[
-113.67839153511491,
53.479655716966036
],
[
-113.67841403961407,
53.479642696534015
],
[
-113.67841429784058,
53.47960854665634
],
[
-113.67844047381725,
53.47960861708666
],
[
-113.67844103364791,
53.47953457446485
],
[
-113.67856670131673,
53.47953491251222
],
[
-113.67856614702261,
53.47960825154191
],
[
-113.67858568146858,
53.479608304077935
],
[
-113.67858528878678,
53.47966026304031
],
[
-113.67857346085196,
53.479660231230554
],
[
-113.67857331480364,
53.47967955533127
],
[
-113.67858517588367,
53.4796795872302
],
[
-113.67858477673504,
53.479732401646245
],
[
-113.6784133647872,
53.47973194054025
],
[
-113.67841361850337,
53.47969838732448
],
[
-113.67839132519723,
53.479683476096945
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.49781400000e+000",
"Liters": 32140,
"number": "4462",
"FID_Catchm": 93598,
"Gal": "8.49100000000e+003",
"Area_1": "2.47900000000e+003",
"Showers": 714,
"area_km2": "4.25687479300052",
"ID": 181,
"GRIDCODE": 140
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.67748420210805,
53.479551188643505
],
[
-113.67748062338921,
53.47945935685929
],
[
-113.67754823545957,
53.47945841963485
],
[
-113.67754849256421,
53.47946504034959
],
[
-113.67760498787833,
53.47946425641489
],
[
-113.67760830975826,
53.479549466582704
],
[
-113.67748420210805,
53.479551188643505
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.49781400000e+000",
"Liters": 11370,
"number": "4462",
"FID_Catchm": 93599,
"Gal": "3.00400000000e+003",
"Area_1": "8.77100000000e+002",
"Showers": 253,
"area_km2": "4.25687479300052",
"ID": 181,
"GRIDCODE": 140
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.67837946750277,
53.479831197260246
],
[
-113.67838088121022,
53.479796244444756
],
[
-113.67843601830297,
53.479797038005884
],
[
-113.67843460464073,
53.479831990822085
],
[
-113.67837946750277,
53.479831197260246
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.49781400000e+000",
"Liters": 1989,
"number": "4462",
"FID_Catchm": 93600,
"Gal": "5.25400000000e+002",
"Area_1": "1.53400000000e+002",
"Showers": 44,
"area_km2": "4.25687479300052",
"ID": 181,
"GRIDCODE": 140
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.67852160060734,
53.48029790154195
],
[
-113.67852143960306,
53.48027276803725
],
[
-113.67851290562757,
53.48027278821498
],
[
-113.6785127403468,
53.48024682618521
],
[
-113.6785247406202,
53.48024679915643
],
[
-113.67852433525611,
53.48018344554359
],
[
-113.67852722592079,
53.480183463203595
],
[
-113.67852929071313,
53.480066148737095
],
[
-113.67866024680141,
53.48006696908187
],
[
-113.67865969472561,
53.48009836663975
],
[
-113.67867191712665,
53.48009844263443
],
[
-113.67867061304031,
53.480172548847065
],
[
-113.67868421526383,
53.48017263394184
],
[
-113.67868327550613,
53.48022603638484
],
[
-113.67870899171858,
53.480226198076124
],
[
-113.67870827919432,
53.4802666747028
],
[
-113.67868582869633,
53.48026653437158
],
[
-113.67868509445762,
53.480308286958035
],
[
-113.67852174072858,
53.480307264480025
],
[
-113.6785219048897,
53.48029790325907
],
[
-113.67852160060734,
53.48029790154195
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.49781400000e+000",
"Liters": 38950,
"number": "4462",
"FID_Catchm": 93601,
"Gal": "1.02900000000e+004",
"Area_1": "3.00400000000e+003",
"Showers": 866,
"area_km2": "4.25687479300052",
"ID": 181,
"GRIDCODE": 140
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.67848538899291,
53.48079590961833
],
[
-113.67848555126729,
53.48069374591035
],
[
-113.6788084328714,
53.48069392843279
],
[
-113.67880827136602,
53.480796093040944
],
[
-113.67848538899291,
53.48079590961833
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.49781400000e+000",
"Liters": 34010,
"number": "4462",
"FID_Catchm": 93602,
"Gal": "8.98400000000e+003",
"Area_1": "2.62300000000e+003",
"Showers": 756,
"area_km2": "4.25687479300052",
"ID": 181,
"GRIDCODE": 140
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.67818334508942,
53.4808574355902
],
[
-113.6781843141476,
53.48083050522524
],
[
-113.67820406908572,
53.48083075790694
],
[
-113.67820416815688,
53.48082801742994
],
[
-113.67827195552557,
53.480828885562175
],
[
-113.67827088745602,
53.480858556405025
],
[
-113.67818334508942,
53.4808574355902
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.49781400000e+000",
"Liters": 2624,
"number": "4462",
"FID_Catchm": 93603,
"Gal": "6.93200000000e+002",
"Area_1": "2.02400000000e+002",
"Showers": 58,
"area_km2": "4.25687479300052",
"ID": 181,
"GRIDCODE": 140
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.67851744703198,
53.4805952772581
],
[
-113.67851668599764,
53.48047654618681
],
[
-113.6787101903603,
53.48047610502619
],
[
-113.67871034235472,
53.48049985375575
],
[
-113.67873313487948,
53.48049980180158
],
[
-113.67873328399726,
53.480523135367946
],
[
-113.67882007189414,
53.48052293729767
],
[
-113.6788205325604,
53.48059458517375
],
[
-113.67851744703198,
53.4805952772581
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.49781400000e+000",
"Liters": 32330,
"number": "4462",
"FID_Catchm": 93604,
"Gal": "8.54200000000e+003",
"Area_1": "2.49400000000e+003",
"Showers": 718,
"area_km2": "4.25687479300052",
"ID": 181,
"GRIDCODE": 140
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.68288441582186,
53.46907094311352
],
[
-113.6828767989295,
53.46895023828596
],
[
-113.68298460222334,
53.46895052432844
],
[
-113.6829845410528,
53.468958733832274
],
[
-113.68305360685788,
53.46895891703151
],
[
-113.68305356334629,
53.46896475785631
],
[
-113.68313123735165,
53.46896496384141
],
[
-113.6831308638251,
53.469015116757184
],
[
-113.68314981662417,
53.46901516701085
],
[
-113.68314913494092,
53.46910670082116
],
[
-113.68302702202826,
53.46910637698376
],
[
-113.6830271497763,
53.46908923011992
],
[
-113.68290322370831,
53.46908890134655
],
[
-113.68290335717879,
53.469070993378466
],
[
-113.68288441582186,
53.46907094311352
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.49781400000e+000",
"Liters": 37250,
"number": "4462",
"FID_Catchm": 102313,
"Gal": "9.84000000000e+003",
"Area_1": "2.87300000000e+003",
"Showers": 828,
"area_km2": "4.25687479300052",
"ID": 181,
"GRIDCODE": 140
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.6828767989295,
53.46895023828596
],
[
-113.68288441582186,
53.46907094311352
],
[
-113.6828515136391,
53.46907085580052
],
[
-113.68285241324278,
53.46895017358163
],
[
-113.6828767989295,
53.46895023828596
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 3413,
"number": "4462",
"FID_Catchm": 102314,
"Gal": "9.01500000000e+002",
"Area_1": "2.75000000000e+002",
"Showers": 76,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.68319032546569,
53.46919009733876
],
[
-113.68323629385861,
53.46916195803339
],
[
-113.68323627169278,
53.46915866458308
],
[
-113.68318844274229,
53.469158775923525
],
[
-113.68318825493226,
53.46912999756374
],
[
-113.68323608385033,
53.46912988622338
],
[
-113.68323525170611,
53.46900215793579
],
[
-113.68326161792359,
53.4690020966259
],
[
-113.68329724384323,
53.46898028842043
],
[
-113.68323474991355,
53.468943941303564
],
[
-113.68338079492901,
53.46885454050924
],
[
-113.68373191754088,
53.46905875208267
],
[
-113.68372999162483,
53.46905993044994
],
[
-113.68373005128244,
53.46906892295952
],
[
-113.68379562279794,
53.46906877028769
],
[
-113.68379595433754,
53.46911960261839
],
[
-113.6837282878423,
53.46911975963057
],
[
-113.6837283262704,
53.469125732767225
],
[
-113.68373174820425,
53.4691277232502
],
[
-113.68362604010694,
53.469192432432834
],
[
-113.68361940916733,
53.46918857603222
],
[
-113.68353271500463,
53.46924164550299
],
[
-113.68359698358336,
53.46927902336832
],
[
-113.68342875668526,
53.46938200290806
],
[
-113.6831686689802,
53.46923073689679
],
[
-113.68321326370322,
53.469203438648066
],
[
-113.68319032546569,
53.46919009733876
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.49781400000e+000",
"Liters": 180100,
"number": "4462",
"FID_Catchm": 102315,
"Gal": "4.75800000000e+004",
"Area_1": "1.38900000000e+004",
"Showers": 4002,
"area_km2": "4.25687479300052",
"ID": 181,
"GRIDCODE": 140
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.6817877727266,
53.48278788568838
],
[
-113.68178761950205,
53.482753602634475
],
[
-113.68174615712948,
53.48275366836252
],
[
-113.68174616632346,
53.482755660592275
],
[
-113.681578753042,
53.48275592818045
],
[
-113.68157881452127,
53.48276964733346
],
[
-113.68152477571043,
53.48276973429288
],
[
-113.68152475130408,
53.48276434350169
],
[
-113.68150186428682,
53.48276437956298
],
[
-113.68150126560776,
53.4826309029025
],
[
-113.68176265167423,
53.482630485798815
],
[
-113.68176259596058,
53.482618001343035
],
[
-113.68187665103015,
53.482617818833205
],
[
-113.68187685620221,
53.482663291444744
],
[
-113.68194929845546,
53.48266317512242
],
[
-113.68194959772453,
53.482729916146326
],
[
-113.68192430029531,
53.48272995665747
],
[
-113.6819245586085,
53.482787666600345
],
[
-113.6817877727266,
53.48278788568838
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.49781400000e+000",
"Liters": 61590,
"number": "4462",
"FID_Catchm": 262718,
"Gal": "1.62700000000e+004",
"Area_1": "4.74900000000e+003",
"Showers": 1369,
"area_km2": "4.25687479300052",
"ID": 181,
"GRIDCODE": 140
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.68257740744092,
53.482802707872125
],
[
-113.68249182538409,
53.482744091950764
],
[
-113.6826384458953,
53.482667926585464
],
[
-113.68263330528265,
53.48265022301459
],
[
-113.6827403052669,
53.48263916940305
],
[
-113.68274609363526,
53.48265910502411
],
[
-113.68299074419009,
53.482633831248954
],
[
-113.68301342666342,
53.48271195224973
],
[
-113.68274416762861,
53.48273976850143
],
[
-113.68274889648086,
53.482751284983514
],
[
-113.68266747931364,
53.482760963371824
],
[
-113.68266604406492,
53.482756664233534
],
[
-113.68257740744092,
53.482802707872125
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.49781400000e+000",
"Liters": 44930,
"number": "4462",
"FID_Catchm": 262880,
"Gal": "1.18700000000e+004",
"Area_1": "3.46600000000e+003",
"Showers": 998,
"area_km2": "4.25687479300052",
"ID": 181,
"GRIDCODE": 140
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.68240430396652,
53.481843021301735
],
[
-113.68241711316023,
53.48176902921905
],
[
-113.68245871011605,
53.48177159113587
],
[
-113.68244590099394,
53.48184558322299
],
[
-113.68240430396652,
53.481843021301735
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.49781400000e+000",
"Liters": 3208,
"number": "4462",
"FID_Catchm": 262881,
"Gal": "8.47400000000e+002",
"Area_1": "2.47400000000e+002",
"Showers": 71,
"area_km2": "4.25687479300052",
"ID": 181,
"GRIDCODE": 140
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.68245447991534,
53.481621498605904
],
[
-113.68251365140607,
53.48154390945942
],
[
-113.68255565070992,
53.48155530569182
],
[
-113.68249647927985,
53.481632894859004
],
[
-113.68245447991534,
53.481621498605904
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.49781400000e+000",
"Liters": 4054,
"number": "4462",
"FID_Catchm": 262882,
"Gal": "1.07100000000e+003",
"Area_1": "3.12800000000e+002",
"Showers": 90,
"area_km2": "4.25687479300052",
"ID": 181,
"GRIDCODE": 140
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.68234993472532,
53.48132743829123
],
[
-113.68251551231536,
53.48132733548813
],
[
-113.68251580262394,
53.48149366522167
],
[
-113.68235022438633,
53.48149376802433
],
[
-113.68234993472532,
53.48132743829123
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.49781400000e+000",
"Liters": 28390,
"number": "4462",
"FID_Catchm": 262883,
"Gal": "7.50100000000e+003",
"Area_1": "2.19000000000e+003",
"Showers": 631,
"area_km2": "4.25687479300052",
"ID": 181,
"GRIDCODE": 140
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.68290998737197,
53.481214687704586
],
[
-113.68294302462856,
53.481213756333695
],
[
-113.68295142643704,
53.48131979056833
],
[
-113.68291839060467,
53.48132072194535
],
[
-113.68290998737197,
53.481214687704586
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.49781400000e+000",
"Liters": 3620,
"number": "4462",
"FID_Catchm": 262884,
"Gal": "9.56300000000e+002",
"Area_1": "2.79200000000e+002",
"Showers": 80,
"area_km2": "4.25687479300052",
"ID": 181,
"GRIDCODE": 140
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.6824491602024,
53.48187494119584
],
[
-113.6824550880399,
53.48185094893593
],
[
-113.68266420971588,
53.4818693362675
],
[
-113.68265828049397,
53.481893327635326
],
[
-113.6824491602024,
53.48187494119584
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.49781400000e+000",
"Liters": 5284,
"number": "4462",
"FID_Catchm": 262885,
"Gal": "1.39600000000e+003",
"Area_1": "4.07700000000e+002",
"Showers": 117,
"area_km2": "4.25687479300052",
"ID": 181,
"GRIDCODE": 140
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.67616833207308,
53.46907581342141
],
[
-113.67629886941215,
53.46907575552612
],
[
-113.67629903108673,
53.46920672334236
],
[
-113.67592148113872,
53.46920688890965
],
[
-113.67592134794161,
53.46909863074811
],
[
-113.67616835952694,
53.469098522176466
],
[
-113.67616833207308,
53.46907581342141
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 43270,
"number": "4462",
"FID_Catchm": 309700,
"Gal": "1.14300000000e+004",
"Area_1": "3.48700000000e+003",
"Showers": 962,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.68812467290371,
53.457610683190694
],
[
-113.68813253203129,
53.45761029303994
],
[
-113.68814038514101,
53.457610724200556
],
[
-113.6881479929513,
53.45761196167015
],
[
-113.6881551253657,
53.45761396980266
],
[
-113.68816156452938,
53.457616686025546
],
[
-113.68816711681521,
53.457620028959035
],
[
-113.68817161133757,
53.457623895715905
],
[
-113.68817491193754,
53.45762817002055
],
[
-113.68817692020123,
53.4576327213182
],
[
-113.68817757239535,
53.457637411955496
],
[
-113.68817685150587,
53.457642098110874
],
[
-113.68817477662623,
53.45764663965126
],
[
-113.68817141352301,
53.457650896565546
],
[
-113.68816686251242,
53.45765473971579
],
[
-113.68816126145803,
53.4576580526427
],
[
-113.68815478272707,
53.45766073605051
],
[
-113.6881476211584,
53.457662705978464
],
[
-113.68813999548993,
53.457663904587854
],
[
-113.68813213635909,
53.45766429384048
],
[
-113.68812428323302,
53.4576638635779
],
[
-113.68811667542069,
53.45766262520823
],
[
-113.6881095429935,
53.457660617972074
],
[
-113.68810310383301,
53.45765790084777
],
[
-113.6880975515407,
53.45765455880992
],
[
-113.68809305702189,
53.4576506920503
],
[
-113.68808975642841,
53.45764641774343
],
[
-113.68808774818,
53.457641865545796
],
[
-113.68808709448352,
53.457637175802624
],
[
-113.68808781689498,
53.457632488753205
],
[
-113.68808989177667,
53.45762794811281
],
[
-113.6880932548862,
53.45762369120083
],
[
-113.68809780590007,
53.45761984805343
],
[
-113.68810340696085,
53.457616534230795
],
[
-113.68810988568187,
53.457613851724396
],
[
-113.68811704725054,
53.457611880900004
],
[
-113.68812467290371,
53.457610683190694
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 3770,
"number": "4462",
"FID_Catchm": 321780,
"Gal": "9.96000000000e+002",
"Area_1": "3.03800000000e+002",
"Showers": 84,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.68790167399239,
53.45750885478943
],
[
-113.68791035276688,
53.45746608126222
],
[
-113.68796385918155,
53.45746994842996
],
[
-113.68795518046,
53.45751272196108
],
[
-113.68790167399239,
53.45750885478943
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 2293,
"number": "4462",
"FID_Catchm": 321781,
"Gal": "6.05800000000e+002",
"Area_1": "1.84800000000e+002",
"Showers": 51,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.68759909016994,
53.45755285606272
],
[
-113.68770157307246,
53.45754700983557
],
[
-113.68771757042586,
53.45764690943519
],
[
-113.68761508879041,
53.45765275567957
],
[
-113.68759909016994,
53.45755285606272
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 10200,
"number": "4462",
"FID_Catchm": 321782,
"Gal": "2.69500000000e+003",
"Area_1": "8.22100000000e+002",
"Showers": 227,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.68797417711598,
53.457513485064794
],
[
-113.68797449084147,
53.45747068968839
],
[
-113.6880283874315,
53.457470830421066
],
[
-113.6880280737601,
53.45751362579773
],
[
-113.68797417711598,
53.457513485064794
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 2277,
"number": "4462",
"FID_Catchm": 321783,
"Gal": "6.01600000000e+002",
"Area_1": "1.83500000000e+002",
"Showers": 51,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.6548095737652,
53.46863473569498
],
[
-113.65489833601742,
53.4686219155328
],
[
-113.65490783273897,
53.468645324710955
],
[
-113.65481907044065,
53.46865814488006
],
[
-113.6548095737652,
53.46863473569498
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 2172,
"number": "4462",
"FID_Catchm": 323934,
"Gal": "5.73700000000e+002",
"Area_1": "1.75000000000e+002",
"Showers": 48,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.66932069441839,
53.467682851648995
],
[
-113.66931645507458,
53.46766716282489
],
[
-113.66927624131648,
53.4676710314662
],
[
-113.6692609762009,
53.46761454413468
],
[
-113.66934008491027,
53.46760693259901
],
[
-113.6693359480349,
53.4675916232709
],
[
-113.66951870674866,
53.467574038986555
],
[
-113.6695269821365,
53.46760465763426
],
[
-113.66956462019112,
53.46760103699074
],
[
-113.669576198122,
53.4676438822238
],
[
-113.66958310210322,
53.46764321837251
],
[
-113.66958338316843,
53.467644258837645
],
[
-113.66956534389169,
53.46764630450839
],
[
-113.66958832646993,
53.467718439011115
],
[
-113.66930039300797,
53.46774614274971
],
[
-113.66928423782429,
53.46768635956526
],
[
-113.66932069441839,
53.467682851648995
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 40730,
"number": "4462",
"FID_Catchm": 324653,
"Gal": "1.07600000000e+004",
"Area_1": "3.28200000000e+003",
"Showers": 905,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.66938736081791,
53.467751423675274
],
[
-113.66960255325021,
53.46774269310168
],
[
-113.66960856355998,
53.46779544535207
],
[
-113.66959124245055,
53.467796148696735
],
[
-113.66959612356801,
53.467838972714226
],
[
-113.66931631912466,
53.46785032455609
],
[
-113.66930812246575,
53.46777839446665
],
[
-113.66939005497737,
53.46777507077573
],
[
-113.66938736081791,
53.467751423675274
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 25510,
"number": "4462",
"FID_Catchm": 324654,
"Gal": "6.74000000000e+003",
"Area_1": "2.05600000000e+003",
"Showers": 567,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.6694111538125,
53.46795258509755
],
[
-113.66941080125825,
53.46794097592108
],
[
-113.66931602678562,
53.46794199870312
],
[
-113.66931337787582,
53.467854598277825
],
[
-113.6694375722872,
53.46785325790237
],
[
-113.66943775930062,
53.467859425557464
],
[
-113.66961628322791,
53.467857498413686
],
[
-113.6696167317168,
53.46787227544342
],
[
-113.66963639383896,
53.46787206381448
],
[
-113.6696378001462,
53.46791845377924
],
[
-113.66962059595888,
53.467918638955474
],
[
-113.6696215562891,
53.467950313901426
],
[
-113.6694111538125,
53.46795258509755
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 28410,
"number": "4462",
"FID_Catchm": 324655,
"Gal": "7.50400000000e+003",
"Area_1": "2.28900000000e+003",
"Showers": 631,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.669307549758,
53.46805572177648
],
[
-113.66930456623098,
53.46799044861618
],
[
-113.66937658665492,
53.467989276624785
],
[
-113.66937506123975,
53.467955925110616
],
[
-113.6696217381637,
53.46795191032966
],
[
-113.66962233108985,
53.468004524490865
],
[
-113.66964259465357,
53.46800444302439
],
[
-113.66964468781912,
53.46805023551623
],
[
-113.669307549758,
53.46805572177648
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 29470,
"number": "4462",
"FID_Catchm": 324656,
"Gal": "7.78600000000e+003",
"Area_1": "2.37500000000e+003",
"Showers": 655,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.66939635384858,
53.468165097877986
],
[
-113.66939572710655,
53.46813799686331
],
[
-113.66931723027359,
53.46813864323222
],
[
-113.66931557806758,
53.468067162587886
],
[
-113.66963974894136,
53.468064493533575
],
[
-113.66964047401409,
53.46809582456051
],
[
-113.66965421094426,
53.46809571156973
],
[
-113.66965576704838,
53.4681629622012
],
[
-113.66939635384858,
53.468165097877986
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 30370,
"number": "4462",
"FID_Catchm": 324657,
"Gal": "8.02200000000e+003",
"Area_1": "2.44700000000e+003",
"Showers": 675,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.66931188039528,
53.46826757578557
],
[
-113.66931116809066,
53.468204793560105
],
[
-113.66935992889175,
53.46820459689849
],
[
-113.66935982616681,
53.4681955296732
],
[
-113.66941701019455,
53.46819529878305
],
[
-113.66941676260149,
53.46817347543575
],
[
-113.66958161425985,
53.46817280990394
],
[
-113.66958209061418,
53.468214830966126
],
[
-113.66962568875431,
53.46821465406816
],
[
-113.66962627561385,
53.46826630490395
],
[
-113.66931188039528,
53.46826757578557
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 24550,
"number": "4462",
"FID_Catchm": 324658,
"Gal": "6.48500000000e+003",
"Area_1": "1.97800000000e+003",
"Showers": 546,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.66935527772074,
53.46837560594452
],
[
-113.66935504545845,
53.46835297659004
],
[
-113.66931771241406,
53.46835311231694
],
[
-113.66931702267486,
53.46828568166281
],
[
-113.66934772762224,
53.4682855698312
],
[
-113.66934766518854,
53.46827945733616
],
[
-113.66961303825606,
53.46827848845838
],
[
-113.66961351067035,
53.468324511902544
],
[
-113.66961903630488,
53.46832449123508
],
[
-113.6696195041756,
53.46837013096139
],
[
-113.66939715791845,
53.46837094212657
],
[
-113.66939720418873,
53.46837545325981
],
[
-113.66935527772074,
53.46837560594452
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 26370,
"number": "4462",
"FID_Catchm": 324659,
"Gal": "6.96600000000e+003",
"Area_1": "2.12500000000e+003",
"Showers": 586,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.66980454723043,
53.46840131274521
],
[
-113.66981016352248,
53.4683680717318
],
[
-113.66999655734321,
53.46837928541885
],
[
-113.66999093968923,
53.468412526436964
],
[
-113.66980454723043,
53.46840131274521
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 6178,
"number": "4462",
"FID_Catchm": 324660,
"Gal": "1.63200000000e+003",
"Area_1": "4.97900000000e+002",
"Showers": 137,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
},
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-113.6741070683722,
53.47534821410346
],
[
-113.67410580923024,
53.47531498024051
],
[
-113.67409013371328,
53.47531519179875
],
[
-113.67408825445288,
53.47526558455155
],
[
-113.67410539115463,
53.475265352715844
],
[
-113.67410376750159,
53.47522248660509
],
[
-113.67421451418755,
53.47522099314134
],
[
-113.67421927658425,
53.47534670125663
],
[
-113.6741070683722,
53.47534821410346
]
]
]
},
"type": "Feature",
"properties": {
"FID_Neighb": 110,
"name": "Edgemont",
"Inches": "5.26219340000e+000",
"Liters": 14630,
"number": "4462",
"FID_Catchm": 324678,
"Gal": "3.86500000000e+003",
"Area_1": "1.17900000000e+003",
"Showers": 325,
"area_km2": "4.25687479300052",
"ID": 191,
"GRIDCODE": 134
}
}
]
}; | EsriCanada-CE/ecce-app-challenge-2016 | maraudersmApp/maraudersmApp/GeoJsonBuild/Edgemont.js | JavaScript | gpl-2.0 | 207,547 |
!function($){$.view=function(t,a){var e={root:"",pages:[]},i=this;i.settings={};var n=$(t),t=t;i.init=function(){i.settings=$.extend({},e,a);for(var t=[],s=0;s<i.settings.pages.length;s++)t.push(i.settings.root+"/"+i.settings.pages[s]);n.hide();for(var s=0;s<t.length;s++)$.ajax({url:t[s],async:!1}).done(function(a){var e=t[s],i=[];i=e.split("/"),n.append($("<div>").attr("class","page").attr("data-behavior","pagesize").attr("id",i[i.length-1]).append(a)),DLN.LoadBehavior(n)});n.show();var r=[];r=document.URL.split("/"),r[r.length-1]?($('[role="main"]').addClass(r[r.length-1]),$('[data-behavior="pageName"]').html(r[r.length-1])):$('[data-behavior="pageName"]').hide()};var s=function(){};i.init()},$.fn.view=function(t){return this.each(function(){if(void 0==$(this).data("view")){var a=new $.view(this,t);$(this).data("view",a)}})}}(jQuery); | adrianjonmiller/adrianjmiller | wp-content/themes/starkers-child/js/plugins/view.min.js | JavaScript | gpl-2.0 | 848 |
(function () {
UI.registerHelper('venue', function _helperVenue(venueId) {
if (!venueId) {
venueId = UserSession.get("venueId");
}
return venueId ? Venues.find({_id: venueId}) : null;
});
});
| pwujek/boats | client/helpers/venue.js | JavaScript | gpl-2.0 | 203 |
function set_login_registration_frm(val)
{
if(val=='existing_user')
{
document.getElementById('contact_detail_id').style.display = 'none';
document.getElementById('login_user_frm_id').style.display = '';
//document.getElementById('user_login_or_not').value = val;
}else //new_user
{
document.getElementById('contact_detail_id').style.display = '';
document.getElementById('login_user_frm_id').style.display = 'none';
//document.getElementById('user_login_or_not').value = val;
}
}
function check_frm()
{
if(eval(document.getElementById('new_user_id')))
{
if(document.getElementById('new_user_id').checked)
{
if(document.getElementById('reg_username').value == '')
{
alert("Please enter Username");
document.getElementById('reg_username').focus();
return false;
}
if(document.getElementById('reg_email').value == '')
{
alert("Please enter Email");
document.getElementById('reg_email').focus();
return false;
}else
{
if (echeck(document.getElementById('reg_email').value)==false){
document.getElementById('reg_email').focus();
return false
}
}
if(document.getElementById('reg_pass').value == '')
{
alert("Please enter Password");
document.getElementById('reg_pass').focus();
return false;
}else
if(document.getElementById('reg_pass').value.length < 5)
{
alert("Password should minimum of 5 charecters");
document.getElementById('reg_pass').focus();
return false;
return false;
}
}
}
if(document.getElementById('company_name').value == '')
{
alert("Please enter Company Name");
document.getElementById('company_name').focus();
return false;
}
if(document.getElementById('company_email').value == '')
{
alert("Please enter Company Email");
document.getElementById('company_email').focus();
return false;
}
if (echeck(document.getElementById('company_email').value)==false){
document.getElementById('company_email').focus();
return false
}
if(document.getElementById('job_location').value == '')
{
alert("Please select Location");
document.getElementById('job_location').focus();
return false;
}
var chklength = document.getElementsByName("category[]").length;
var flag = false;
var temp ='';
for(i=1;i<=chklength;i++)
{
temp = document.getElementById("category_"+i+"").checked;
if(temp == true)
{
flag = true;
break;
}
}
if(flag == false)
{
alert("Please select atleast one Job Category");
return false;
}
if(document.getElementById('post_title').value == '')
{
alert("Please enter Position Title");
document.getElementById('post_title').focus();
return false;
}
if(post_id == '' || renewal_flag==1)
{
if(!document.getElementById('termandconditions').checked)
{
alert("Are you agree with terms and conditions?");
document.getElementById('termandconditions').focus();
return false;
}
//document.createjob_frm.submit();
}
}
function echeck(str) {
var at="@"
var dot="."
var lat=str.indexOf(at)
var lstr=str.length
var ldot=str.indexOf(dot)
if (str.indexOf(at)==-1){
alert("Invalid E-mail ID")
return false
}
if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
alert("Invalid E-mail ID")
return false
}
if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
alert("Invalid E-mail ID")
return false
}
if (str.indexOf(at,(lat+1))!=-1){
alert("Invalid E-mail ID")
return false
}
if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
alert("Invalid E-mail ID")
return false
}
if (str.indexOf(dot,(lat+2))==-1){
alert("Invalid E-mail ID")
return false
}
if (str.indexOf(" ")!=-1){
alert("Invalid E-mail ID")
return false
}
return true
}
if(eval(document.getElementById('new_user_id')))
{
if(document.getElementById('new_user_id').checked)
{
set_login_registration_frm(document.getElementById('new_user_id').value);
}
}
if(eval(document.getElementById('existing_user_id')))
{
if(document.getElementById('existing_user_id').checked)
{
set_login_registration_frm(document.getElementById('existing_user_id').value);
}
} | joglomedia/masedi.net | wp-content/themes/JobBoard/js/createjobs.js | JavaScript | gpl-2.0 | 4,443 |
{"filter":false,"title":"User.js","tooltip":"/server/models/User.js","undoManager":{"mark":-1,"position":-1,"stack":[]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":0,"column":0},"end":{"row":0,"column":0},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1422132271633,"hash":"7dc45d35e63e42b31b67c1268395e605acc7b708"} | mrubart/captainLottery | .c9/metadata/workspace/server/models/User.js | JavaScript | gpl-2.0 | 423 |
module.exports = {
themeColor: '#fdfdfd',
gFonts: {
monospace: 'https://fonts.googleapis.com/css?family=Anonymous+Pro:400,700&display=swap',
sansSerif: 'https://fonts.googleapis.com/css?family=Inter:700&display=swap'
}
}
| berkandirim/berkandirim.github.io | config.js | JavaScript | gpl-2.0 | 235 |
// imported packages
var express = require('express');
var path = require('path');
var favicon = require('serve-favicon');
var logger = require('morgan');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');
var session = require('express-session')
// routers
var routes = require('./routes/index');
var users = require('./routes/users');
var postdetail = require('./routes/postdetail');
var usermanage = require('./routes/usermanage');
var ajax = require('./routes/ajax');
var Login = require('./routes/Login');
//authencation
//express init
var app = express();
// view engine setup
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'jade');
//middleware setting
//configuration
app.use(favicon(path.join(__dirname, 'public', 'favicon.ico')));
app.use(logger('dev'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
app.use(cookieParser('Reddit Clone Project'));
app.use(express.static(path.join(__dirname, 'public')));
app.use(session({ secret: 'keyboard cat', cookie: { maxAge: 60000 }}));
//Auth
//print session information
//routers
app.use('/', routes);
app.use('/users', users);
app.use('/post', postdetail);
app.use('/usermanage', usermanage);
app.use('/ajax', ajax);
app.use('/Login', Login);
// catch 404 and forward to error handler
app.use(function(req, res, next) {
var err = new Error('Not Found');
err.status = 404;
next(err);
});
// error handlers
// development error handler
// will print stacktrace
if (app.get('env') === 'development') {
app.use(function(err, req, res, next) {
res.status(err.status || 500);
res.render('error', {
message: err.message,
error: err
});
});
}
// production error handler
// no stacktraces leaked to user
app.use(function(err, req, res, next) {
res.status(err.status || 500);
res.render('error', {
message: err.message,
error: {}
});
});
var server =app.listen(1991, function(){
var hostname = server.address().address
var port = server.address().port
console.log(' Server running at'+ port);
});
module.exports = app; | xinhuafan/Reddit-Clone | app.js | JavaScript | gpl-2.0 | 2,139 |
var searchData=
[
['abortacquisition',['AbortAcquisition',['../atmcd_l_xd_8h.html#a578bb8b70b59fbbadce11bb4ab1d2747',1,'atmcdLXd.h']]],
['abortsequence',['abortsequence',['../observe_8tcl.html#af5c63ef7286830263baf4e085391d971',1,'observe.tcl']]],
['ac_5facqmode_5faccumulate',['AC_ACQMODE_ACCUMULATE',['../atmcd_l_xd_8h.html#adcfa69bb480ca6d1de7cbc0f098ebaac',1,'atmcdLXd.h']]],
['ac_5facqmode_5ffastkinetics',['AC_ACQMODE_FASTKINETICS',['../atmcd_l_xd_8h.html#a908bcce3b6cfad8753e0849859390bf6',1,'atmcdLXd.h']]],
['ac_5facqmode_5fframetransfer',['AC_ACQMODE_FRAMETRANSFER',['../atmcd_l_xd_8h.html#a5eae65000b2d20a59a842e2465b3cdf8',1,'atmcdLXd.h']]],
['ac_5facqmode_5fkinetic',['AC_ACQMODE_KINETIC',['../atmcd_l_xd_8h.html#afbe7dc2fbb93518e421056f5ff45b2b0',1,'atmcdLXd.h']]],
['ac_5facqmode_5foverlap',['AC_ACQMODE_OVERLAP',['../atmcd_l_xd_8h.html#a4a77d4a46a794d8659f3bf5ff98bee66',1,'atmcdLXd.h']]],
['ac_5facqmode_5fsingle',['AC_ACQMODE_SINGLE',['../atmcd_l_xd_8h.html#a1fa602010ee58cc62b3aca19ac051d70',1,'atmcdLXd.h']]],
['ac_5facqmode_5fvideo',['AC_ACQMODE_VIDEO',['../atmcd_l_xd_8h.html#a10d12824f2fa9cb7fbff83a8892e42b0',1,'atmcdLXd.h']]],
['ac_5fcameratype_5falta',['AC_CAMERATYPE_ALTA',['../atmcd_l_xd_8h.html#a96f8e6326c00135a3ed128dede597556',1,'atmcdLXd.h']]],
['ac_5fcameratype_5faltaf',['AC_CAMERATYPE_ALTAF',['../atmcd_l_xd_8h.html#a2c762065b7380e9767f3c7e322ded73a',1,'atmcdLXd.h']]],
['ac_5fcameratype_5fascent',['AC_CAMERATYPE_ASCENT',['../atmcd_l_xd_8h.html#a1c7d0773533cb2bbe418f28ed7d211e6',1,'atmcdLXd.h']]],
['ac_5fcameratype_5faspen',['AC_CAMERATYPE_ASPEN',['../atmcd_l_xd_8h.html#a2f9741c952c7435e2d59470f8f81d553',1,'atmcdLXd.h']]],
['ac_5fcameratype_5fccd',['AC_CAMERATYPE_CCD',['../atmcd_l_xd_8h.html#ad55b9f8bb095a21d07511d1893642537',1,'atmcdLXd.h']]],
['ac_5fcameratype_5fclara',['AC_CAMERATYPE_CLARA',['../atmcd_l_xd_8h.html#a5efe2bc15f71f6a0afcb93abfce60813',1,'atmcdLXd.h']]],
['ac_5fcameratype_5femccd',['AC_CAMERATYPE_EMCCD',['../atmcd_l_xd_8h.html#a911191fa4c836050706f6badff1b07b4',1,'atmcdLXd.h']]],
['ac_5fcameratype_5ficcd',['AC_CAMERATYPE_ICCD',['../atmcd_l_xd_8h.html#a902dedde74678a31f73ef244a2afefa1',1,'atmcdLXd.h']]],
['ac_5fcameratype_5fidus',['AC_CAMERATYPE_IDUS',['../atmcd_l_xd_8h.html#a8806f8354b64cc897eac7d35fba587b7',1,'atmcdLXd.h']]],
['ac_5fcameratype_5fikon',['AC_CAMERATYPE_IKON',['../atmcd_l_xd_8h.html#a9d6966c8adfa30f0ef008e62161bd79b',1,'atmcdLXd.h']]],
['ac_5fcameratype_5fikonxl',['AC_CAMERATYPE_IKONXL',['../atmcd_l_xd_8h.html#a327cfef82de83c2fd9e01a2cbf5f4801',1,'atmcdLXd.h']]],
['ac_5fcameratype_5fingaas',['AC_CAMERATYPE_INGAAS',['../atmcd_l_xd_8h.html#a745393504f50fdb215a624b745b7eab7',1,'atmcdLXd.h']]],
['ac_5fcameratype_5fistar',['AC_CAMERATYPE_ISTAR',['../atmcd_l_xd_8h.html#a9c3b3a9fd9360e46dc01d8f0848a2cc6',1,'atmcdLXd.h']]],
['ac_5fcameratype_5fivac',['AC_CAMERATYPE_IVAC',['../atmcd_l_xd_8h.html#a06182ee087115143efe05aea3fcfdbd8',1,'atmcdLXd.h']]],
['ac_5fcameratype_5fivac_5fccd',['AC_CAMERATYPE_IVAC_CCD',['../atmcd_l_xd_8h.html#a78468c795acc4855c74edde4637ac421',1,'atmcdLXd.h']]],
['ac_5fcameratype_5fixon',['AC_CAMERATYPE_IXON',['../atmcd_l_xd_8h.html#a87fc0a5712801b4ba47f71f9cee1dd47',1,'atmcdLXd.h']]],
['ac_5fcameratype_5fixonultra',['AC_CAMERATYPE_IXONULTRA',['../atmcd_l_xd_8h.html#a827f15d89ad2541485197cd10f730601',1,'atmcdLXd.h']]],
['ac_5fcameratype_5fluca',['AC_CAMERATYPE_LUCA',['../atmcd_l_xd_8h.html#ae1c5d44d1b9716d3d587e8ae34caefda',1,'atmcdLXd.h']]],
['ac_5fcameratype_5fneo',['AC_CAMERATYPE_NEO',['../atmcd_l_xd_8h.html#a45e188d5de961dca40ef967fae5258cc',1,'atmcdLXd.h']]],
['ac_5fcameratype_5fnewton',['AC_CAMERATYPE_NEWTON',['../atmcd_l_xd_8h.html#a776f0fdc8512299dae34ab0424f68f55',1,'atmcdLXd.h']]],
['ac_5fcameratype_5fpda',['AC_CAMERATYPE_PDA',['../atmcd_l_xd_8h.html#a14df932f093cf6ccb70ddb2eb94d14db',1,'atmcdLXd.h']]],
['ac_5fcameratype_5fres1',['AC_CAMERATYPE_RES1',['../atmcd_l_xd_8h.html#a4015669c5226b55fe5dc271417562a2d',1,'atmcdLXd.h']]],
['ac_5fcameratype_5freserved',['AC_CAMERATYPE_RESERVED',['../atmcd_l_xd_8h.html#ab13e9d681956892d4011877a3d775bab',1,'atmcdLXd.h']]],
['ac_5fcameratype_5fsimcam',['AC_CAMERATYPE_SIMCAM',['../atmcd_l_xd_8h.html#a33de9b477cd84cecdec9238f3a24365d',1,'atmcdLXd.h']]],
['ac_5fcameratype_5fsurcam',['AC_CAMERATYPE_SURCAM',['../atmcd_l_xd_8h.html#afd794f639d10412b400d3d40eb1a8ece',1,'atmcdLXd.h']]],
['ac_5fcameratype_5funprogrammed',['AC_CAMERATYPE_UNPROGRAMMED',['../atmcd_l_xd_8h.html#ae9cb7fdeb8fef46556ebf9832ea7ceac',1,'atmcdLXd.h']]],
['ac_5fcameratype_5fusbiccd',['AC_CAMERATYPE_USBICCD',['../atmcd_l_xd_8h.html#a809830c15374bf668462fbd8c5d63c13',1,'atmcdLXd.h']]],
['ac_5fcameratype_5fusbistar',['AC_CAMERATYPE_USBISTAR',['../atmcd_l_xd_8h.html#ac2e3db6fac45a3aa5a3d36b67a702d0d',1,'atmcdLXd.h']]],
['ac_5fcameratype_5fvideo',['AC_CAMERATYPE_VIDEO',['../atmcd_l_xd_8h.html#a568c8047e74c52ad9c27450fac7d7cc7',1,'atmcdLXd.h']]],
['ac_5fcameratype_5fvolmos',['AC_CAMERATYPE_VOLMOS',['../atmcd_l_xd_8h.html#a1c06d78e72a7bbc2989854b70977e679',1,'atmcdLXd.h']]],
['ac_5femgain_5f12bit',['AC_EMGAIN_12BIT',['../atmcd_l_xd_8h.html#a21d7d37ddc726afd890d7dead5982c86',1,'atmcdLXd.h']]],
['ac_5femgain_5f8bit',['AC_EMGAIN_8BIT',['../atmcd_l_xd_8h.html#a879da72a47a001b3643f3343a7fa98d0',1,'atmcdLXd.h']]],
['ac_5femgain_5flinear12',['AC_EMGAIN_LINEAR12',['../atmcd_l_xd_8h.html#a62f0ac0c35d22444b309226e5ba19914',1,'atmcdLXd.h']]],
['ac_5femgain_5freal12',['AC_EMGAIN_REAL12',['../atmcd_l_xd_8h.html#a034a7395692277adeca71398dd8dcdf9',1,'atmcdLXd.h']]],
['ac_5ffeatures_5fcameralink',['AC_FEATURES_CAMERALINK',['../atmcd_l_xd_8h.html#ae61eceda6d0d0c2705b6772c48888730',1,'atmcdLXd.h']]],
['ac_5ffeatures_5fcountconvert',['AC_FEATURES_COUNTCONVERT',['../atmcd_l_xd_8h.html#a996bd7f300845cee90ccb2d99d46152c',1,'atmcdLXd.h']]],
['ac_5ffeatures_5fdaccontrol',['AC_FEATURES_DACCONTROL',['../atmcd_l_xd_8h.html#a2f669f4937f01415a006f298cb1e9acb',1,'atmcdLXd.h']]],
['ac_5ffeatures_5fddglite',['AC_FEATURES_DDGLITE',['../atmcd_l_xd_8h.html#aedf7af84d025e044c3d6d351cdb83794',1,'atmcdLXd.h']]],
['ac_5ffeatures_5fdefect_5fcorrection',['AC_FEATURES_DEFECT_CORRECTION',['../atmcd_l_xd_8h.html#a91634499cd6359aadca282c23bbe313f',1,'atmcdLXd.h']]],
['ac_5ffeatures_5fdualmode',['AC_FEATURES_DUALMODE',['../atmcd_l_xd_8h.html#ad6ce99326fada1cb2923a016a02ae863',1,'atmcdLXd.h']]],
['ac_5ffeatures_5fdualpreampgain',['AC_FEATURES_DUALPREAMPGAIN',['../atmcd_l_xd_8h.html#a6e89ae69a0f4fa3821fb005053dfe54a',1,'atmcdLXd.h']]],
['ac_5ffeatures_5fendofexposure_5fevent',['AC_FEATURES_ENDOFEXPOSURE_EVENT',['../atmcd_l_xd_8h.html#a67242d775ac043f5db0aba4e91832f5a',1,'atmcdLXd.h']]],
['ac_5ffeatures_5fevents',['AC_FEATURES_EVENTS',['../atmcd_l_xd_8h.html#abd74737e64c0268c9bc13281956363c4',1,'atmcdLXd.h']]],
['ac_5ffeatures_5fexternal_5fi2c',['AC_FEATURES_EXTERNAL_I2C',['../atmcd_l_xd_8h.html#a54d2f7e47bcb6c2af694ef8054a8bb96',1,'atmcdLXd.h']]],
['ac_5ffeatures_5ffancontrol',['AC_FEATURES_FANCONTROL',['../atmcd_l_xd_8h.html#a69c86fa0115df79a3cbbd3ee93eda839',1,'atmcdLXd.h']]],
['ac_5ffeatures_5ffifofull_5fevent',['AC_FEATURES_FIFOFULL_EVENT',['../atmcd_l_xd_8h.html#a836a2d1e2f0e29733dcfb652d50642ce',1,'atmcdLXd.h']]],
['ac_5ffeatures_5fftexternalexposure',['AC_FEATURES_FTEXTERNALEXPOSURE',['../atmcd_l_xd_8h.html#ad9b593c0c62b04bfd9b7edd9311ecffa',1,'atmcdLXd.h']]],
['ac_5ffeatures_5fiocontrol',['AC_FEATURES_IOCONTROL',['../atmcd_l_xd_8h.html#a32bdf8f56a8e1e59282f1d2034274b42',1,'atmcdLXd.h']]],
['ac_5ffeatures_5firig_5fsupport',['AC_FEATURES_IRIG_SUPPORT',['../atmcd_l_xd_8h.html#a6d3b87e4261b8370fee132284763454c',1,'atmcdLXd.h']]],
['ac_5ffeatures_5fkeepcleancontrol',['AC_FEATURES_KEEPCLEANCONTROL',['../atmcd_l_xd_8h.html#a56b0cfdb773ad56dcc3f71a24f2fdbc4',1,'atmcdLXd.h']]],
['ac_5ffeatures_5fkineticexternalexposure',['AC_FEATURES_KINETICEXTERNALEXPOSURE',['../atmcd_l_xd_8h.html#aeffb39b84ada3908ffde92b6d22a75cc',1,'atmcdLXd.h']]],
['ac_5ffeatures_5fmetadata',['AC_FEATURES_METADATA',['../atmcd_l_xd_8h.html#ac36181cba5f942e53a8f7a2e780ac027',1,'atmcdLXd.h']]],
['ac_5ffeatures_5fmidfancontrol',['AC_FEATURES_MIDFANCONTROL',['../atmcd_l_xd_8h.html#a3ddb1a7ebefbc3cca81488d76eaa5165',1,'atmcdLXd.h']]],
['ac_5ffeatures_5foptacquire',['AC_FEATURES_OPTACQUIRE',['../atmcd_l_xd_8h.html#ac3381b805ccf10b1847d90046800f774',1,'atmcdLXd.h']]],
['ac_5ffeatures_5fphotoncounting',['AC_FEATURES_PHOTONCOUNTING',['../atmcd_l_xd_8h.html#a30567bdeae4c8cde71fc6d38f65d6536',1,'atmcdLXd.h']]],
['ac_5ffeatures_5fpolling',['AC_FEATURES_POLLING',['../atmcd_l_xd_8h.html#a9c23a1335b6a923b7f7097c87cdeec1d',1,'atmcdLXd.h']]],
['ac_5ffeatures_5fpostprocessspuriousnoisefilter',['AC_FEATURES_POSTPROCESSSPURIOUSNOISEFILTER',['../atmcd_l_xd_8h.html#a400081fae34758f815e6264ad49e92a2',1,'atmcdLXd.h']]],
['ac_5ffeatures_5frealtimespuriousnoisefilter',['AC_FEATURES_REALTIMESPURIOUSNOISEFILTER',['../atmcd_l_xd_8h.html#a48229df385f6267f155fedd6ead1052f',1,'atmcdLXd.h']]],
['ac_5ffeatures_5fsaturationevent',['AC_FEATURES_SATURATIONEVENT',['../atmcd_l_xd_8h.html#a02bcd38d8bded10803d88b558eba414b',1,'atmcdLXd.h']]],
['ac_5ffeatures_5fsensor_5fcompensation',['AC_FEATURES_SENSOR_COMPENSATION',['../atmcd_l_xd_8h.html#a59343bbaaf9ead653a09cf4e8c81ed97',1,'atmcdLXd.h']]],
['ac_5ffeatures_5fsensor_5fport_5fconfiguration',['AC_FEATURES_SENSOR_PORT_CONFIGURATION',['../atmcd_l_xd_8h.html#ac4170f0457990d91ee7e9209f9fbb5fa',1,'atmcdLXd.h']]],
['ac_5ffeatures_5fshutter',['AC_FEATURES_SHUTTER',['../atmcd_l_xd_8h.html#a620cdaa7904efddac73b71f027ed024c',1,'atmcdLXd.h']]],
['ac_5ffeatures_5fshutterex',['AC_FEATURES_SHUTTEREX',['../atmcd_l_xd_8h.html#a77c005d381784ba2d123cc6228db511e',1,'atmcdLXd.h']]],
['ac_5ffeatures_5fspooling',['AC_FEATURES_SPOOLING',['../atmcd_l_xd_8h.html#ab7a53a5e4f431e6fa60257bee4ccc812',1,'atmcdLXd.h']]],
['ac_5ffeatures_5fstartofexposure_5fevent',['AC_FEATURES_STARTOFEXPOSURE_EVENT',['../atmcd_l_xd_8h.html#a30a9c31efa91ed774083bd43698be253',1,'atmcdLXd.h']]],
['ac_5ffeatures_5ftemperatureduringacquisition',['AC_FEATURES_TEMPERATUREDURINGACQUISITION',['../atmcd_l_xd_8h.html#af4ceb81916eee68f517b045bc7cf0c69',1,'atmcdLXd.h']]],
['ac_5fgetfunction_5fbaselineclamp',['AC_GETFUNCTION_BASELINECLAMP',['../atmcd_l_xd_8h.html#a1a0654ecbde36fb5c2c68345f3f44c2e',1,'atmcdLXd.h']]],
['ac_5fgetfunction_5fddgtimes',['AC_GETFUNCTION_DDGTIMES',['../atmcd_l_xd_8h.html#a6de7cfb6835df6f4a5bc4fc429ac4d9d',1,'atmcdLXd.h']]],
['ac_5fgetfunction_5fdetectorsize',['AC_GETFUNCTION_DETECTORSIZE',['../atmcd_l_xd_8h.html#abcbe068d7718d2c4fa287b6787c0325c',1,'atmcdLXd.h']]],
['ac_5fgetfunction_5femccdgain',['AC_GETFUNCTION_EMCCDGAIN',['../atmcd_l_xd_8h.html#aef03b853fb578393fd5856e5b6acb77d',1,'atmcdLXd.h']]],
['ac_5fgetfunction_5fgain',['AC_GETFUNCTION_GAIN',['../atmcd_l_xd_8h.html#abbf06dcf0a1b2868862757f2e35e743e',1,'atmcdLXd.h']]],
['ac_5fgetfunction_5fgatedelaystep',['AC_GETFUNCTION_GATEDELAYSTEP',['../atmcd_l_xd_8h.html#aa1b7900347c88e69b21c73082b68f9e2',1,'atmcdLXd.h']]],
['ac_5fgetfunction_5fgatemode',['AC_GETFUNCTION_GATEMODE',['../atmcd_l_xd_8h.html#a7b64812538fb9f0d569944d7f2342c01',1,'atmcdLXd.h']]],
['ac_5fgetfunction_5fgatestep',['AC_GETFUNCTION_GATESTEP',['../atmcd_l_xd_8h.html#abe6f0ef2856a43b146b09bc56bf19215',1,'atmcdLXd.h']]],
['ac_5fgetfunction_5fgatewidthstep',['AC_GETFUNCTION_GATEWIDTHSTEP',['../atmcd_l_xd_8h.html#ae0dbc0e2a5cb1b3ae3827fffe19cb97b',1,'atmcdLXd.h']]],
['ac_5fgetfunction_5fhvflag',['AC_GETFUNCTION_HVFLAG',['../atmcd_l_xd_8h.html#ab66f38ca43a4e3ff405c4fcd48d0cc83',1,'atmcdLXd.h']]],
['ac_5fgetfunction_5ficcdgain',['AC_GETFUNCTION_ICCDGAIN',['../atmcd_l_xd_8h.html#a56fc4a6e235594dbf2fc686f5d647c9f',1,'atmcdLXd.h']]],
['ac_5fgetfunction_5finsertion_5fdelay',['AC_GETFUNCTION_INSERTION_DELAY',['../atmcd_l_xd_8h.html#abf3c2837eac38b16352c2738f1491e65',1,'atmcdLXd.h']]],
['ac_5fgetfunction_5fintelligate',['AC_GETFUNCTION_INTELLIGATE',['../atmcd_l_xd_8h.html#aaf97765578c450d234ad63bc0a5771f7',1,'atmcdLXd.h']]],
['ac_5fgetfunction_5fioc',['AC_GETFUNCTION_IOC',['../atmcd_l_xd_8h.html#ae1174ae15ff51af24d5435b8ee580af5',1,'atmcdLXd.h']]],
['ac_5fgetfunction_5fmcpgain',['AC_GETFUNCTION_MCPGAIN',['../atmcd_l_xd_8h.html#a007ea720b629fbaf05949054bc43e510',1,'atmcdLXd.h']]],
['ac_5fgetfunction_5fmcpgaintable',['AC_GETFUNCTION_MCPGAINTABLE',['../atmcd_l_xd_8h.html#ade54abe36a9542df4995ee3d893b9e37',1,'atmcdLXd.h']]],
['ac_5fgetfunction_5fphosphorstatus',['AC_GETFUNCTION_PHOSPHORSTATUS',['../atmcd_l_xd_8h.html#a980ef18300cac65e8b4c091f71130d06',1,'atmcdLXd.h']]],
['ac_5fgetfunction_5ftargettemperature',['AC_GETFUNCTION_TARGETTEMPERATURE',['../atmcd_l_xd_8h.html#a636fee68ce69239bd6cb2d8d6e2baf33',1,'atmcdLXd.h']]],
['ac_5fgetfunction_5ftemperature',['AC_GETFUNCTION_TEMPERATURE',['../atmcd_l_xd_8h.html#afe1cc25efa6b2c5728d59ce38c25bda1',1,'atmcdLXd.h']]],
['ac_5fgetfunction_5ftemperaturerange',['AC_GETFUNCTION_TEMPERATURERANGE',['../atmcd_l_xd_8h.html#aef76150dc17d9bc005f4ecb998ce95c1',1,'atmcdLXd.h']]],
['ac_5fpixelmode_5f14bit',['AC_PIXELMODE_14BIT',['../atmcd_l_xd_8h.html#afe098f0fd0c0f2746ba488b6a689cded',1,'atmcdLXd.h']]],
['ac_5fpixelmode_5f16bit',['AC_PIXELMODE_16BIT',['../atmcd_l_xd_8h.html#a56ea06ca114cf5e9077850ff865ea299',1,'atmcdLXd.h']]],
['ac_5fpixelmode_5f32bit',['AC_PIXELMODE_32BIT',['../atmcd_l_xd_8h.html#a823ee2729be835d26b9d1c3d8a90e582',1,'atmcdLXd.h']]],
['ac_5fpixelmode_5f8bit',['AC_PIXELMODE_8BIT',['../atmcd_l_xd_8h.html#a076631c147cef1f3c2d1698d3d0a7780',1,'atmcdLXd.h']]],
['ac_5fpixelmode_5fcmy',['AC_PIXELMODE_CMY',['../atmcd_l_xd_8h.html#aa58cdf1519a69099187efa180ed48a54',1,'atmcdLXd.h']]],
['ac_5fpixelmode_5fmono',['AC_PIXELMODE_MONO',['../atmcd_l_xd_8h.html#a50dce9579d127a6d048108a1f4cb55ce',1,'atmcdLXd.h']]],
['ac_5fpixelmode_5frgb',['AC_PIXELMODE_RGB',['../atmcd_l_xd_8h.html#a4aad5ee36aee32a206ed6bb3fcbd9b67',1,'atmcdLXd.h']]],
['ac_5freadmode_5ffullimage',['AC_READMODE_FULLIMAGE',['../atmcd_l_xd_8h.html#a0439fc379ae65531f00b2f1261f3c2bf',1,'atmcdLXd.h']]],
['ac_5freadmode_5ffvb',['AC_READMODE_FVB',['../atmcd_l_xd_8h.html#a439ff3ab7ccd64be77556b2342a88c95',1,'atmcdLXd.h']]],
['ac_5freadmode_5fmultitrack',['AC_READMODE_MULTITRACK',['../atmcd_l_xd_8h.html#ab6455f34cd2f5cb8ad0c882dae2d8b33',1,'atmcdLXd.h']]],
['ac_5freadmode_5fmultitrackscan',['AC_READMODE_MULTITRACKSCAN',['../atmcd_l_xd_8h.html#a47c423c548ea02905537f3898c7cde6f',1,'atmcdLXd.h']]],
['ac_5freadmode_5frandomtrack',['AC_READMODE_RANDOMTRACK',['../atmcd_l_xd_8h.html#a9b7e3c912af7253cca033887eade51ee',1,'atmcdLXd.h']]],
['ac_5freadmode_5fsingletrack',['AC_READMODE_SINGLETRACK',['../atmcd_l_xd_8h.html#aba8fd1108dfe6aee0a391809440a8104',1,'atmcdLXd.h']]],
['ac_5freadmode_5fsubimage',['AC_READMODE_SUBIMAGE',['../atmcd_l_xd_8h.html#aaad815a0e5e78307bd6e540bd2273bce',1,'atmcdLXd.h']]],
['ac_5fsetfunction_5fbaselineclamp',['AC_SETFUNCTION_BASELINECLAMP',['../atmcd_l_xd_8h.html#ace550e9d5b4d66602fe5a32716a6d2e1',1,'atmcdLXd.h']]],
['ac_5fsetfunction_5fbaselineoffset',['AC_SETFUNCTION_BASELINEOFFSET',['../atmcd_l_xd_8h.html#aadc3df84233a9c4dec7656d5192490e6',1,'atmcdLXd.h']]],
['ac_5fsetfunction_5fcropmode',['AC_SETFUNCTION_CROPMODE',['../atmcd_l_xd_8h.html#a66d171116c90376839034551c6fee651',1,'atmcdLXd.h']]],
['ac_5fsetfunction_5fddgtimes',['AC_SETFUNCTION_DDGTIMES',['../atmcd_l_xd_8h.html#adaac4575fd8234b9f48a529427857854',1,'atmcdLXd.h']]],
['ac_5fsetfunction_5fdmaparameters',['AC_SETFUNCTION_DMAPARAMETERS',['../atmcd_l_xd_8h.html#a109322cb17063fa9206fccc178e1f73b',1,'atmcdLXd.h']]],
['ac_5fsetfunction_5femadvanced',['AC_SETFUNCTION_EMADVANCED',['../atmcd_l_xd_8h.html#a15f53530c4a94d5c9bc073400b022fb3',1,'atmcdLXd.h']]],
['ac_5fsetfunction_5femccdgain',['AC_SETFUNCTION_EMCCDGAIN',['../atmcd_l_xd_8h.html#a840dc723300c65cdfeab1b5e67fb5666',1,'atmcdLXd.h']]],
['ac_5fsetfunction_5fextended_5fcrop_5fmode',['AC_SETFUNCTION_EXTENDED_CROP_MODE',['../atmcd_l_xd_8h.html#a779b6b4b0510b6232a1409d5838503f6',1,'atmcdLXd.h']]],
['ac_5fsetfunction_5fextendednir',['AC_SETFUNCTION_EXTENDEDNIR',['../atmcd_l_xd_8h.html#abb63186e91ed9f3202665887ea286be5',1,'atmcdLXd.h']]],
['ac_5fsetfunction_5fgain',['AC_SETFUNCTION_GAIN',['../atmcd_l_xd_8h.html#a84e2fdf3c56544bef2fb9cc77ac862b1',1,'atmcdLXd.h']]],
['ac_5fsetfunction_5fgatedelaystep',['AC_SETFUNCTION_GATEDELAYSTEP',['../atmcd_l_xd_8h.html#a8cb37f60e97f00875cd4ae918e6e03aa',1,'atmcdLXd.h']]],
['ac_5fsetfunction_5fgatemode',['AC_SETFUNCTION_GATEMODE',['../atmcd_l_xd_8h.html#a6a701eb3d8d04fcf1dc6ece1462d523e',1,'atmcdLXd.h']]],
['ac_5fsetfunction_5fgatestep',['AC_SETFUNCTION_GATESTEP',['../atmcd_l_xd_8h.html#abe2398d21844598130be8920e300d77f',1,'atmcdLXd.h']]],
['ac_5fsetfunction_5fgatewidthstep',['AC_SETFUNCTION_GATEWIDTHSTEP',['../atmcd_l_xd_8h.html#ab014e3ee43177139ff66da8f4b1db3e4',1,'atmcdLXd.h']]],
['ac_5fsetfunction_5fhighcapacity',['AC_SETFUNCTION_HIGHCAPACITY',['../atmcd_l_xd_8h.html#a7c05919be7947af2a64bb4f05075c1e8',1,'atmcdLXd.h']]],
['ac_5fsetfunction_5fhorizontalbin',['AC_SETFUNCTION_HORIZONTALBIN',['../atmcd_l_xd_8h.html#af4ebe4ec393bd706ef951ffbb3c359ff',1,'atmcdLXd.h']]],
['ac_5fsetfunction_5fhreadout',['AC_SETFUNCTION_HREADOUT',['../atmcd_l_xd_8h.html#a1a75f0a4ee64929a0b79fb9dbe973665',1,'atmcdLXd.h']]],
['ac_5fsetfunction_5ficcdgain',['AC_SETFUNCTION_ICCDGAIN',['../atmcd_l_xd_8h.html#a46e4c3040a18cccc7225e054000e1bf5',1,'atmcdLXd.h']]],
['ac_5fsetfunction_5finsertion_5fdelay',['AC_SETFUNCTION_INSERTION_DELAY',['../atmcd_l_xd_8h.html#a591be15861f8a98c432b2fa604ab885b',1,'atmcdLXd.h']]],
['ac_5fsetfunction_5fintelligate',['AC_SETFUNCTION_INTELLIGATE',['../atmcd_l_xd_8h.html#ad81e718126f977720c871ee936febabc',1,'atmcdLXd.h']]],
['ac_5fsetfunction_5fioc',['AC_SETFUNCTION_IOC',['../atmcd_l_xd_8h.html#a255061bfa1e4d469dfe1cc459e09e34f',1,'atmcdLXd.h']]],
['ac_5fsetfunction_5fmcpgain',['AC_SETFUNCTION_MCPGAIN',['../atmcd_l_xd_8h.html#a8296d060bc3ae3724de8109227442962',1,'atmcdLXd.h']]],
['ac_5fsetfunction_5fmultitrackhrange',['AC_SETFUNCTION_MULTITRACKHRANGE',['../atmcd_l_xd_8h.html#a93e04ce2ea7f4e2930d7d4d673fe18d4',1,'atmcdLXd.h']]],
['ac_5fsetfunction_5fpreampgain',['AC_SETFUNCTION_PREAMPGAIN',['../atmcd_l_xd_8h.html#a534ea9bc7e45be43c0bc9b8fac7898d5',1,'atmcdLXd.h']]],
['ac_5fsetfunction_5fprescans',['AC_SETFUNCTION_PRESCANS',['../atmcd_l_xd_8h.html#a379e719e44d2767e59d7d6799269bfcd',1,'atmcdLXd.h']]],
['ac_5fsetfunction_5frandomtracknogaps',['AC_SETFUNCTION_RANDOMTRACKNOGAPS',['../atmcd_l_xd_8h.html#a73f6054deb21d408c5a72922b458c0a8',1,'atmcdLXd.h']]],
['ac_5fsetfunction_5fregisterpack',['AC_SETFUNCTION_REGISTERPACK',['../atmcd_l_xd_8h.html#aa1e3a792a9585eb83b45d031b2a40fc1',1,'atmcdLXd.h']]],
['ac_5fsetfunction_5fspoolthreadcount',['AC_SETFUNCTION_SPOOLTHREADCOUNT',['../atmcd_l_xd_8h.html#a05ec2dffe6b7873ff34e02025bec563c',1,'atmcdLXd.h']]],
['ac_5fsetfunction_5fsuperkinetics',['AC_SETFUNCTION_SUPERKINETICS',['../atmcd_l_xd_8h.html#a806b6ced5113fe5ecde103f59254b1c3',1,'atmcdLXd.h']]],
['ac_5fsetfunction_5ftemperature',['AC_SETFUNCTION_TEMPERATURE',['../atmcd_l_xd_8h.html#af17227d1be71fbc948d267f2b2df6c93',1,'atmcdLXd.h']]],
['ac_5fsetfunction_5ftimescan',['AC_SETFUNCTION_TIMESCAN',['../atmcd_l_xd_8h.html#a9c2fa650a0da8578c8472520a51d515c',1,'atmcdLXd.h']]],
['ac_5fsetfunction_5ftriggertermination',['AC_SETFUNCTION_TRIGGERTERMINATION',['../atmcd_l_xd_8h.html#ad0009ec89dfd307516f27f33b9a4d7f7',1,'atmcdLXd.h']]],
['ac_5fsetfunction_5fvreadout',['AC_SETFUNCTION_VREADOUT',['../atmcd_l_xd_8h.html#aa5fa5dc122c24b61ba374ac30be8637f',1,'atmcdLXd.h']]],
['ac_5fsetfunction_5fvsamplitude',['AC_SETFUNCTION_VSAMPLITUDE',['../atmcd_l_xd_8h.html#a4da73c117d6fed9204d62fdf4ad69bd2',1,'atmcdLXd.h']]],
['ac_5ftriggermode_5fbulb',['AC_TRIGGERMODE_BULB',['../atmcd_l_xd_8h.html#a98d574b834d820b35a95e07469b4cb44',1,'atmcdLXd.h']]],
['ac_5ftriggermode_5fcontinuous',['AC_TRIGGERMODE_CONTINUOUS',['../atmcd_l_xd_8h.html#a63cfaf4758aecb2f5fb726f06b006701',1,'atmcdLXd.h']]],
['ac_5ftriggermode_5fexternal',['AC_TRIGGERMODE_EXTERNAL',['../atmcd_l_xd_8h.html#afeed98899096dd95e549007f838c95e3',1,'atmcdLXd.h']]],
['ac_5ftriggermode_5fexternal_5fchargeshifting',['AC_TRIGGERMODE_EXTERNAL_CHARGESHIFTING',['../atmcd_l_xd_8h.html#a9bd25056562a26d4ee4e6cc505e96bf8',1,'atmcdLXd.h']]],
['ac_5ftriggermode_5fexternal_5ffvb_5fem',['AC_TRIGGERMODE_EXTERNAL_FVB_EM',['../atmcd_l_xd_8h.html#a9f13ac857da1fe1ac034afe26d47ecb5',1,'atmcdLXd.h']]],
['ac_5ftriggermode_5fexternalexposure',['AC_TRIGGERMODE_EXTERNALEXPOSURE',['../atmcd_l_xd_8h.html#aa0c6dd6d3bbf83df4d41c291d7dade36',1,'atmcdLXd.h']]],
['ac_5ftriggermode_5fexternalstart',['AC_TRIGGERMODE_EXTERNALSTART',['../atmcd_l_xd_8h.html#a7a48ea634dc3079723e450c91c82c708',1,'atmcdLXd.h']]],
['ac_5ftriggermode_5finternal',['AC_TRIGGERMODE_INTERNAL',['../atmcd_l_xd_8h.html#a437e4e5664c4a209f31e85c7c482fc39',1,'atmcdLXd.h']]],
['ac_5ftriggermode_5finverted',['AC_TRIGGERMODE_INVERTED',['../atmcd_l_xd_8h.html#acc354e84b7a9acbcba2416f3379526cf',1,'atmcdLXd.h']]],
['acc',['acc',['../guider__calc_8c.html#af37ca83f06ee60dbc0ea580b860ba8a1',1,'guider_calc.c']]],
['accept',['accept',['../andor_camera_server_8tcl.html#ab86c749dd689fb6bd8e1226a9373d0cc',1,'acceptsock addr port: andorCameraServer.tcl'],['../filter_wheel_server_8tcl.html#ab86c749dd689fb6bd8e1226a9373d0cc',1,'acceptsock addr port: filterWheelServer.tcl']]],
['accumulateoption',['accumulateOption',['../speckle__gui_8tcl.html#adeda5b15f5e2e3a2151ad4fccd9a8778',1,'speckle_gui.tcl']]],
['acquirecubes',['acquireCubes',['../andor_8tcl.html#a179feea78dd79b455e009a405fea90e4',1,'andor.tcl']]],
['acquiredatacube',['acquireDataCube',['../andor_camera_cli_8tcl.html#a22b00db3f35a0a2936a6d9f4bf310ced',1,'acquireDataCubeexp x y npix n: andorCameraCli.tcl'],['../andor_camera_server_8tcl.html#a22b00db3f35a0a2936a6d9f4bf310ced',1,'acquireDataCubeexp x y npix n: andorCameraServer.tcl']]],
['acquiredatacubes',['acquireDataCubes',['../andor_wrapper_8tcl.html#ad4c986df2e7b723432c188b56d1bebef',1,'andorWrapper.tcl']]],
['acquiredataframe',['acquireDataFrame',['../andor_camera_cli_8tcl.html#ae12090fb09afa8e769f46c4c70a3f544',1,'acquireDataFrameexp: andorCameraCli.tcl'],['../andor_camera_server_8tcl.html#ae12090fb09afa8e769f46c4c70a3f544',1,'acquireDataFrameexp: andorCameraServer.tcl']]],
['acquiredataroi',['acquireDataROI',['../andor_camera_cli_8tcl.html#a4ece6629529b314153c73efd879145d0',1,'acquireDataROIexp x y n: andorCameraCli.tcl'],['../andor_camera_server_8tcl.html#a4ece6629529b314153c73efd879145d0',1,'acquireDataROIexp x y n: andorCameraServer.tcl']]],
['acquirefastvideo',['acquireFastVideo',['../andor_camera_cli_8tcl.html#a0e8581c512b72e7d71aacd3b970506b8',1,'acquireFastVideoexp x y npix n: andorCameraCli.tcl'],['../andor_camera_server_8tcl.html#a0e8581c512b72e7d71aacd3b970506b8',1,'acquireFastVideoexp x y npix n: andorCameraServer.tcl']]],
['acquireframes',['acquireFrames',['../andor_8tcl.html#a5982c0995b72b0ba0a861a95394665c9',1,'andor.tcl']]],
['acquiretest',['acquireTest',['../andor_8tcl.html#abb0a84a474e5383e7894098a8e79b2d8',1,'andor.tcl']]],
['acquisition_5fmode',['acquisition_mode',['../structandor__setup.html#aabee411df2ef8c0aeecc63c27438f278',1,'andor_setup']]],
['acquisitionmode',['acquisitionmode',['../observe_8tcl.html#a6d91c4b1ae25f88c2c4ba052948e7eac',1,'observe.tcl']]],
['activatestreams',['activatestreams',['../header_builder_8tcl.html#ac43b5c4acb669634aef52fbd4a4a15e8',1,'headerBuilder.tcl']]],
['active',['ACTIVE',['../guider_8h.html#a3a6d3cd70078e6046471ec528a09cd19',1,'guider.h']]],
['addavg',['addavg',['../andor__tcl_8c.html#a4dfc35643e2710a74fd5f5a6e44c2526',1,'andor_tcl.c']]],
['addr',['addr',['../structswig__var__info.html#a8aefe7e94367ddbab2d090d913232b4f',1,'swig_var_info']]],
['addrotationpair',['addRotationPair',['../derotate_8c.html#a11d28e61b9f9373f61380abc2ea76370',1,'derotate.c']]],
['addrotationpt',['addRotationPt',['../derotate_8c.html#a3c2577f695631bd3246f32c60ff8ffda',1,'derotate.c']]],
['adjustfocus',['adjustFocus',['../execengine__plugins_8tcl.html#a3924e0c28e58e16af172530f5f234ef1',1,'execengine_plugins.tcl']]],
['algorithm',['algorithm',['../struct_g_u_i_d_e_r.html#addb21dab266c51d3fe5f2fc7130f787b',1,'GUIDER']]],
['alim',['alim',['../guider__calc_8c.html#a60388c896684d0cfa1eb62f3408cd4e5',1,'guider_calc.c']]],
['allocrotationpr',['allocRotationPr',['../derotate_8c.html#a212c077d74740080c3b6727e6353f3df',1,'derotate.c']]],
['allocrotationpt',['allocRotationPt',['../derotate_8c.html#aec693a5626060a63969a96a959ad4f40',1,'derotate.c']]],
['alpha',['alpha',['../newstar_8c.html#afb37fb8f65c9e7eac8963eb09c3f40b2',1,'newstar.c']]],
['amax',['AMAX',['../chisq_lib_8h.html#a84541e068dab8da4869443bd71047506',1,'chisqLib.h']]],
['amplifier',['amplifier',['../structandor__setup.html#a37e83fc9447beacf50d22e3b3a6755de',1,'andor_setup']]],
['andor_2etcl',['andor.tcl',['../andor_8tcl.html',1,'']]],
['andor_5fabort_5facquisition',['andor_abort_acquisition',['../andor__tcl_8h.html#a84d1d075ff6772acde0cc8976bd9f053',1,'andor_tcl.h']]],
['andor_5facqmode_5faccumulate',['ANDOR_ACQMODE_ACCUMULATE',['../andor__tcl_8h.html#a55ebbfd2dad148f9d1a8b2cca4da221c',1,'andor_tcl.h']]],
['andor_5facqmode_5ffast_5fkinetics',['ANDOR_ACQMODE_FAST_KINETICS',['../andor__tcl_8h.html#a7408a84b07157d0035f20c747e7905c2',1,'andor_tcl.h']]],
['andor_5facqmode_5fkinetics',['ANDOR_ACQMODE_KINETICS',['../andor__tcl_8h.html#addc4bcad4c85270669c0a7094c96efab',1,'andor_tcl.h']]],
['andor_5facqmode_5frun_5ftill_5fabort',['ANDOR_ACQMODE_RUN_TILL_ABORT',['../andor__tcl_8h.html#aac0f3e905fc27c27e989dfd9e0c56405',1,'andor_tcl.h']]],
['andor_5facqmode_5fsingle_5fscan',['ANDOR_ACQMODE_SINGLE_SCAN',['../andor__tcl_8h.html#aacb248c66456a3c40679a56d65f65ba2',1,'andor_tcl.h']]],
['andor_5fccd',['ANDOR_CCD',['../andor__tcl_8h.html#a883a2bcf031bff7041bd1dcf602fa661',1,'andor_tcl.h']]],
['andor_5fclose',['andor_close',['../andor__tcl_8h.html#a683a90bc434d341648577f91587613c9',1,'andor_tcl.h']]],
['andor_5fcooler_5foff',['andor_cooler_off',['../andor__tcl_8h.html#a34846351e8f4b32c9a2ab4e9ae73163d',1,'andor_tcl.h']]],
['andor_5fcooler_5fon',['andor_cooler_on',['../andor__tcl_8h.html#abbfb6797ab7226256f9bbce10a600a7a',1,'andor_tcl.h']]],
['andor_5femccd',['ANDOR_EMCCD',['../andor__tcl_8h.html#a2c591c199010f2d7727c70e5051b5476',1,'andor_tcl.h']]],
['andor_5fget_5facquired_5fdata',['andor_get_acquired_data',['../andor__tcl_8h.html#a8fd2a5cea11bb0b55d8eef646950d211',1,'andor_tcl.h']]],
['andor_5fget_5fhorizontal_5fspeed',['andor_get_horizontal_speed',['../andor__tcl_8h.html#a1cd82d1d4a9295cee7613f4e152681e7',1,'andor_tcl.h']]],
['andor_5fget_5foldest_5fimage',['andor_get_oldest_image',['../andor__tcl_8h.html#a57caa2da0ebd4d7ceab58ff98728aba2',1,'andor_tcl.h']]],
['andor_5fget_5fpreamp_5fgain',['andor_get_preamp_gain',['../andor__tcl_8h.html#a9c459dedd887cc63901e88c1f874f5a4',1,'andor_tcl.h']]],
['andor_5fget_5fsingle_5fframe',['andor_get_single_frame',['../andor__tcl_8h.html#af263dac0603f5f4fb922aa635d66f350',1,'andor_tcl.h']]],
['andor_5fget_5fstatus',['andor_get_status',['../andor__tcl_8h.html#a45a1d93d3686e7d6cdabf3c1a6cd43ba',1,'andor_tcl.h']]],
['andor_5fget_5ftemperature',['andor_get_temperature',['../andor__tcl_8h.html#a7fe728169ec7f19d72d68ecfbde32e03',1,'andor_tcl.h']]],
['andor_5fget_5ftotal_5fnumber_5fimages_5facquired',['andor_get_total_number_images_acquired',['../andor__tcl_8h.html#a5c3ba4f34f576cb69eed7efc86bc0eee',1,'andor_tcl.h']]],
['andor_5fget_5fvertical_5fspeed',['andor_get_vertical_speed',['../andor__tcl_8h.html#acc80f06e9c248edf19faee396924b1d8',1,'andor_tcl.h']]],
['andor_5fimage',['andor_image',['../structandor__image.html',1,'']]],
['andor_5fnum_5facqmodes',['ANDOR_NUM_ACQMODES',['../andor__tcl_8h.html#a6c1c3e84ecf01da2af1fd41ad2574c4e',1,'andor_tcl.h']]],
['andor_5fnum_5famplifiers',['ANDOR_NUM_AMPLIFIERS',['../andor__tcl_8h.html#a18351c78da9c85f804a640d87af9dfda',1,'andor_tcl.h']]],
['andor_5fnum_5freadmodes',['ANDOR_NUM_READMODES',['../andor__tcl_8h.html#afab51a68a3c60d9456a77c19540cf5d3',1,'andor_tcl.h']]],
['andor_5fnum_5fshutters',['ANDOR_NUM_SHUTTERS',['../andor__tcl_8h.html#acfdfc35311c56bd0e7fc707a00c10a24',1,'andor_tcl.h']]],
['andor_5fnum_5ftemperature_5fstatus',['ANDOR_NUM_TEMPERATURE_STATUS',['../andor__tcl_8h.html#aa28bfdb0592984345c661bcd9d35de3c',1,'andor_tcl.h']]],
['andor_5fopen',['andor_open',['../andor__tcl_8h.html#aa7f63342c1dda7cdc873bf9c116033a0',1,'andor_tcl.h']]],
['andor_5freadmode_5ffull_5fvertical_5fbinning',['ANDOR_READMODE_FULL_VERTICAL_BINNING',['../andor__tcl_8h.html#a9318bd43ca067042bba70b3b8dc5b2bf',1,'andor_tcl.h']]],
['andor_5freadmode_5fimage',['ANDOR_READMODE_IMAGE',['../andor__tcl_8h.html#a556a5b765e686f764fb49568605b1a86',1,'andor_tcl.h']]],
['andor_5freadmode_5fmulti_5ftrack',['ANDOR_READMODE_MULTI_TRACK',['../andor__tcl_8h.html#ab1ffb1cb6269413aa62d8261baaeec65',1,'andor_tcl.h']]],
['andor_5freadmode_5frandom_5ftrack',['ANDOR_READMODE_RANDOM_TRACK',['../andor__tcl_8h.html#aa4ae56786006b419cb3ed338280c08cb',1,'andor_tcl.h']]],
['andor_5freadmode_5fsingle_5ftrack',['ANDOR_READMODE_SINGLE_TRACK',['../andor__tcl_8h.html#a0ae397441e2cb055ae61ebf156785665',1,'andor_tcl.h']]],
['andor_5fsend_5fsetup',['andor_send_setup',['../andor__tcl_8h.html#a6d9c4d87e5342a5017b59b16430f892d',1,'andor_tcl.h']]],
['andor_5fset_5facqmode',['andor_set_acqmode',['../andor__tcl_8h.html#af5081df01ec4589e3a6cde2353598c1d',1,'andor_tcl.h']]],
['andor_5fset_5famplifier',['andor_set_amplifier',['../andor__tcl_8h.html#a85ad10f2d885e6ed9c5990f800ce63ab',1,'andor_tcl.h']]],
['andor_5fset_5fcamera_5flink',['andor_set_camera_link',['../andor__tcl_8h.html#a6db3d52c552d3b881622f650d648dd15',1,'andor_tcl.h']]],
['andor_5fset_5fcrop_5fmode',['andor_set_crop_mode',['../andor__tcl_8h.html#afedfd19dfec994a246864c85c65f52d3',1,'andor_tcl.h']]],
['andor_5fset_5fem_5fadvanced',['andor_set_em_advanced',['../andor__tcl_8h.html#a7fbf865665ff62500d8b29f8a3eec24e',1,'andor_tcl.h']]],
['andor_5fset_5fem_5fgain',['andor_set_em_gain',['../andor__tcl_8h.html#adfeb503290857d79c1de44b01001582b',1,'andor_tcl.h']]],
['andor_5fset_5fexptime',['andor_set_exptime',['../andor__tcl_8h.html#a4084325a88e6fb668d803aa0b5a66ba8',1,'andor_tcl.h']]],
['andor_5fset_5fhorizontal_5fspeed',['andor_set_horizontal_speed',['../andor__tcl_8h.html#a27911b2ed832527782ee6d55da365f5d',1,'andor_tcl.h']]],
['andor_5fset_5fimage',['andor_set_image',['../andor__tcl_8h.html#a4ef63dd32985eab8f975871c44323cb9',1,'andor_tcl.h']]],
['andor_5fset_5fpreamp_5fgain',['andor_set_preamp_gain',['../andor__tcl_8h.html#a3b9ed1ea0ea985ed01eaf3bce7e633b6',1,'andor_tcl.h']]],
['andor_5fset_5fshutter',['andor_set_shutter',['../andor__tcl_8h.html#a05023ac4a02c47195d10a50f47a2d872',1,'andor_tcl.h']]],
['andor_5fset_5ftemperature',['andor_set_temperature',['../andor__tcl_8h.html#a51e7e85f40095f94faa64a7582bfc9bf',1,'andor_tcl.h']]],
['andor_5fset_5fvertical_5fspeed',['andor_set_vertical_speed',['../andor__tcl_8h.html#a2a640a9208582f29e8d1bd4c812d52cd',1,'andor_tcl.h']]],
['andor_5fsetup',['andor_setup',['../structandor__setup.html',1,'']]],
['andor_5fsetup_5fcamera',['andor_setup_camera',['../andor__tcl_8h.html#a50666eedc128f2e1ca577aebb84f9524',1,'andor_tcl.h']]],
['andor_5fshutter_5fauto',['ANDOR_SHUTTER_AUTO',['../andor__tcl_8h.html#a72e8bccd9f1412d5f208bebbd751061d',1,'andor_tcl.h']]],
['andor_5fshutter_5fclose',['ANDOR_SHUTTER_CLOSE',['../andor__tcl_8h.html#a72501df6dadccb976755109a7c4bf3ab',1,'andor_tcl.h']]],
['andor_5fshutter_5fopen',['ANDOR_SHUTTER_OPEN',['../andor__tcl_8h.html#a0affb349abb11e001ad2342b640585e5',1,'andor_tcl.h']]],
['andor_5fstart_5facquisition',['andor_start_acquisition',['../andor__tcl_8h.html#ad3047c1591e85647b7a7e583a621752d',1,'andor_tcl.h']]],
['andor_5fstart_5fusb',['andor_start_usb',['../andor__tcl_8h.html#a478ef79b0432b48c146c8e977ac0aa8e',1,'andor_tcl.h']]],
['andor_5fstart_5fusb_5fthread',['andor_start_usb_thread',['../andor__tcl_8h.html#af17c3c1d69a0030de45cd159f17c19b0',1,'andor_tcl.h']]],
['andor_5fstop_5fusb',['andor_stop_usb',['../andor__tcl_8h.html#adede4c662ad2c4023f345a07a5d0e5ac',1,'andor_tcl.h']]],
['andor_5fstop_5fusb_5fthread',['andor_stop_usb_thread',['../andor__tcl_8h.html#a985faf890afbf35b1b6f2bdbd78f2193',1,'andor_tcl.h']]],
['andor_5ftcl_2ec',['andor_tcl.c',['../andor__tcl_8c.html',1,'']]],
['andor_5ftcl_2eh',['andor_tcl.h',['../andor__tcl_8h.html',1,'']]],
['andor_5ftemperature_5fdrift',['ANDOR_TEMPERATURE_DRIFT',['../andor__tcl_8h.html#a91e748261f140213300e1818f848feea',1,'andor_tcl.h']]],
['andor_5ftemperature_5fnot_5freached',['ANDOR_TEMPERATURE_NOT_REACHED',['../andor__tcl_8h.html#a440c695c9f6ab47e2ae82cd75a6966eb',1,'andor_tcl.h']]],
['andor_5ftemperature_5fnot_5fstabilized',['ANDOR_TEMPERATURE_NOT_STABILIZED',['../andor__tcl_8h.html#a888a72172bb31a9504e66b2b96e402e1',1,'andor_tcl.h']]],
['andor_5ftemperature_5foff',['ANDOR_TEMPERATURE_OFF',['../andor__tcl_8h.html#a8d15cb7b4f5000e22d5cf138d5c66e14',1,'andor_tcl.h']]],
['andor_5ftemperature_5fstabilized',['ANDOR_TEMPERATURE_STABILIZED',['../andor__tcl_8h.html#a02e1a436568d45886ed2b599e163f989',1,'andor_tcl.h']]],
['andor_5fusb_5fthread',['andor_usb_thread',['../andor__tcl_8h.html#af7ddf11b7f1fcecd7b04e9b981b3fdf0',1,'andor_tcl.h']]],
['andor_5fwait_5ffor_5fdata',['andor_wait_for_data',['../andor__tcl_8h.html#ab46c980e9703f819d1e9e6b840635df3',1,'andor_tcl.h']]],
['andor_5fwait_5ffor_5fidle',['andor_wait_for_idle',['../andor__tcl_8h.html#a7b41b5a716131009a370e82f4d17fe3a',1,'andor_tcl.h']]],
['andorcameracli_2etcl',['andorCameraCli.tcl',['../andor_camera_cli_8tcl.html',1,'']]],
['andorcameraserver_2etcl',['andorCameraServer.tcl',['../andor_camera_server_8tcl.html',1,'']]],
['andorcapabilities',['AndorCapabilities',['../atmcd_l_xd_8h.html#ab1543a200c42750b4762121ef1d6d5c5',1,'atmcdLXd.h']]],
['andorcaps',['ANDORCAPS',['../struct_a_n_d_o_r_c_a_p_s.html',1,'']]],
['andorcodegen_2etcl',['andorCodeGen.tcl',['../andor_code_gen_8tcl.html',1,'']]],
['andorcreatetclcmds_2ec',['andorCreateTclCmds.c',['../andor_create_tcl_cmds_8c.html',1,'']]],
['andorgentclinterfaces_2ec',['andorGenTclInterfaces.c',['../andor_gen_tcl_interfaces_8c.html',1,'']]],
['andorgentclinterfaces_2eh',['andorGenTclInterfaces.h',['../andor_gen_tcl_interfaces_8h.html',1,'']]],
['andorsavedata',['andorSaveData',['../andor_camera_cli_8tcl.html#a8d999c53d2c7845388abf3f6bcf38ccd',1,'andorSaveDatacid fname nx ny count n: andorCameraCli.tcl'],['../andor_camera_server_8tcl.html#a8d999c53d2c7845388abf3f6bcf38ccd',1,'andorSaveDatacid fname nx ny count n: andorCameraServer.tcl']]],
['andorset',['andorset',['../speckle__gui_8tcl.html#a69af67a8ff71ed06797d3755287d84a9',1,'speckle_gui.tcl']]],
['andorsetpoint',['andorsetpoint',['../speckle__gui_8tcl.html#abe6010b0a7490057b66e044a793ddd65',1,'speckle_gui.tcl']]],
['andorsetup',['andorSetup',['../andor__tcl_8c.html#aac1343413566ee4a2c336dcc5f32e7cd',1,'andor_tcl.c']]],
['andortclinit_5finit',['Andortclinit_Init',['../andor__tcl_8c.html#a70e45ea6c54755fce02079bb807d1e20',1,'andor_tcl.c']]],
['andortelemetry_2etcl',['andorTelemetry.tcl',['../andor_telemetry_8tcl.html',1,'']]],
['andorwrap_5fsafeinit',['Andorwrap_SafeInit',['../tcl__andor_wrap_8cpp.html#a5f438dabe1a7082518f093b0eeb3ee2d',1,'tcl_andorWrap.cpp']]],
['andorwrapper_2etcl',['andorWrapper.tcl',['../andor_wrapper_8tcl.html',1,'']]],
['aoixsize',['AOIXSIZE',['../guider_8h.html#aa27dd1084fddf9f50e4f5aad7c5ae6de',1,'guider.h']]],
['aoiysize',['AOIYSIZE',['../guider_8h.html#abba8198fc90759394386cbf1467c64a6',1,'guider.h']]],
['apoint',['aPoint',['../structa_point.html',1,'']]],
['append_5ffitstimings',['append_fitsTimings',['../andor__tcl_8c.html#ab5a3bc4c83a5919d5200ea59e1ec79f9',1,'andor_tcl.c']]],
['appendheader',['appendHeader',['../header_builder_8tcl.html#ac1e96bf76642818f530aee8b6e82669e',1,'headerBuilder.tcl']]],
['astrometry_2etcl',['astrometry.tcl',['../astrometry_8tcl.html',1,'']]],
['astrometryv2_2etcl',['astrometryv2.tcl',['../astrometryv2_8tcl.html',1,'']]],
['at_5f32',['at_32',['../atmcd_l_xd_8h.html#a0c8363ae6d3c6af8c834e402f95ce85b',1,'atmcdLXd.h']]],
['at_5f64',['at_64',['../atmcd_l_xd_8h.html#a141c96fd54fd7a368f8ed854286c804a',1,'atmcdLXd.h']]],
['at_5fcontroller_5fcard_5fmodel_5flen',['AT_CONTROLLER_CARD_MODEL_LEN',['../atmcd_l_xd_8h.html#a28d16a4276bc9cc831b64f385392e772',1,'atmcdLXd.h']]],
['at_5fddg_5fpolarity_5fnegative',['AT_DDG_POLARITY_NEGATIVE',['../atmcd_l_xd_8h.html#ae0340abd68162826a3d69e56b9c9a092',1,'atmcdLXd.h']]],
['at_5fddg_5fpolarity_5fpositive',['AT_DDG_POLARITY_POSITIVE',['../atmcd_l_xd_8h.html#aef95e06920f69de68304911aca46bf9f',1,'atmcdLXd.h']]],
['at_5fddg_5ftermination_5f50ohms',['AT_DDG_TERMINATION_50OHMS',['../atmcd_l_xd_8h.html#ab2e386c913dc6643ab60a472bbaa45fc',1,'atmcdLXd.h']]],
['at_5fddg_5ftermination_5fhighz',['AT_DDG_TERMINATION_HIGHZ',['../atmcd_l_xd_8h.html#ae0a0881deec07072ff7ba6d45d8d745b',1,'atmcdLXd.h']]],
['at_5fddglite_5fchannela',['AT_DDGLite_ChannelA',['../atmcd_l_xd_8h.html#a5e57f68e14d35855ab3879cc995de9e6a1d6dfd56e14b55050396362366db80c7',1,'atmcdLXd.h']]],
['at_5fddglite_5fchannelb',['AT_DDGLite_ChannelB',['../atmcd_l_xd_8h.html#a5e57f68e14d35855ab3879cc995de9e6a1df753391b3628f4fd37c8f97b0d3f7b',1,'atmcdLXd.h']]],
['at_5fddglite_5fchannelc',['AT_DDGLite_ChannelC',['../atmcd_l_xd_8h.html#a5e57f68e14d35855ab3879cc995de9e6a2abac0ae7a89a3d53da7dd04a6212589',1,'atmcdLXd.h']]],
['at_5fddglite_5fcontrolbit_5fchannelenable',['AT_DDGLite_ControlBit_ChannelEnable',['../atmcd_l_xd_8h.html#aab406cb14a091591929899b726daff8e',1,'atmcdLXd.h']]],
['at_5fddglite_5fcontrolbit_5fdisableonframe',['AT_DDGLite_ControlBit_DisableOnFrame',['../atmcd_l_xd_8h.html#a97175e57a9cb0c4576daed9d0bf98a74',1,'atmcdLXd.h']]],
['at_5fddglite_5fcontrolbit_5fenableonfire',['AT_DDGLite_ControlBit_EnableOnFire',['../atmcd_l_xd_8h.html#af2f2327068f5c0b56bac05d708bbbf53',1,'atmcdLXd.h']]],
['at_5fddglite_5fcontrolbit_5ffreerun',['AT_DDGLite_ControlBit_FreeRun',['../atmcd_l_xd_8h.html#a579c0c163ce92d8eac4d4658f54841c5',1,'atmcdLXd.h']]],
['at_5fddglite_5fcontrolbit_5fglobalenable',['AT_DDGLite_ControlBit_GlobalEnable',['../atmcd_l_xd_8h.html#a63b9fe8f4288fc123e118653262ebfe0',1,'atmcdLXd.h']]],
['at_5fddglite_5fcontrolbit_5finvert',['AT_DDGLite_ControlBit_Invert',['../atmcd_l_xd_8h.html#a3462dcd8d579f507cc14d1169cb84d1f',1,'atmcdLXd.h']]],
['at_5fddglite_5fcontrolbit_5frestartonfire',['AT_DDGLite_ControlBit_RestartOnFire',['../atmcd_l_xd_8h.html#a69e7c5f7212b727b47f5316a11047870',1,'atmcdLXd.h']]],
['at_5fddglitechannelid',['AT_DDGLiteChannelId',['../atmcd_l_xd_8h.html#a5e57f68e14d35855ab3879cc995de9e6',1,'atmcdLXd.h']]],
['at_5fdevicedriverversion',['AT_DeviceDriverVersion',['../atmcd_l_xd_8h.html#ab65a647fb827b7c627ec733b7da608aaaed2abb92a06f65c2582e4cc11edd4ec7',1,'atmcdLXd.h']]],
['at_5fgatemode_5fcw_5foff',['AT_GATEMODE_CW_OFF',['../atmcd_l_xd_8h.html#a8e135e8e05fa329f20cf38ffa492da73',1,'atmcdLXd.h']]],
['at_5fgatemode_5fcw_5fon',['AT_GATEMODE_CW_ON',['../atmcd_l_xd_8h.html#a38e29bc80e74944697c474db9b9934a7',1,'atmcdLXd.h']]],
['at_5fgatemode_5fddg',['AT_GATEMODE_DDG',['../atmcd_l_xd_8h.html#a34f849c586d73ada0c97beb29640372f',1,'atmcdLXd.h']]],
['at_5fgatemode_5ffire_5fand_5fgate',['AT_GATEMODE_FIRE_AND_GATE',['../atmcd_l_xd_8h.html#a6da2406486a34f2d6d9f247a56f6dba7',1,'atmcdLXd.h']]],
['at_5fgatemode_5ffire_5fonly',['AT_GATEMODE_FIRE_ONLY',['../atmcd_l_xd_8h.html#ad0955d4b610e73dcf1540a33cbe86302',1,'atmcdLXd.h']]],
['at_5fgatemode_5fgate_5fonly',['AT_GATEMODE_GATE_ONLY',['../atmcd_l_xd_8h.html#a6f1c765c84edfe6b5ba0afaac42937a7',1,'atmcdLXd.h']]],
['at_5fnoofversioninfoids',['AT_NoOfVersionInfoIds',['../atmcd_l_xd_8h.html#a0f83c85f84364fd071b5efe64be67ac1',1,'atmcdLXd.h']]],
['at_5fsdkversion',['AT_SDKVersion',['../atmcd_l_xd_8h.html#ab65a647fb827b7c627ec733b7da608aaa243af9e6aec8336867265d26a54c6cea',1,'atmcdLXd.h']]],
['at_5fstepmode_5fconstant',['AT_STEPMODE_CONSTANT',['../atmcd_l_xd_8h.html#afbd5ec65b12e140b5e131f459cf24275',1,'atmcdLXd.h']]],
['at_5fstepmode_5fexponential',['AT_STEPMODE_EXPONENTIAL',['../atmcd_l_xd_8h.html#a886b8a599564de3150d1d976a56fe11f',1,'atmcdLXd.h']]],
['at_5fstepmode_5flinear',['AT_STEPMODE_LINEAR',['../atmcd_l_xd_8h.html#a53b069699fa041e90a26654d96b26c77',1,'atmcdLXd.h']]],
['at_5fstepmode_5flogarithmic',['AT_STEPMODE_LOGARITHMIC',['../atmcd_l_xd_8h.html#a91784be642e1c5aaf18e83f2dfdad96e',1,'atmcdLXd.h']]],
['at_5fstepmode_5foff',['AT_STEPMODE_OFF',['../atmcd_l_xd_8h.html#a9e1da816279960504188bc05e3d80842',1,'atmcdLXd.h']]],
['at_5fu16',['at_u16',['../atmcd_l_xd_8h.html#a63a4e6cc5a9d42d5ce6539c03b50f15a',1,'atmcdLXd.h']]],
['at_5fu32',['at_u32',['../atmcd_l_xd_8h.html#a9e1bb63a8a4bd481ed3643b59dc5f7bd',1,'atmcdLXd.h']]],
['at_5fu64',['at_u64',['../atmcd_l_xd_8h.html#a50564362fb6cba7a38fe7a47cd8db03b',1,'atmcdLXd.h']]],
['at_5fversion_5finfo_5flen',['AT_VERSION_INFO_LEN',['../atmcd_l_xd_8h.html#a7c190f4c38388dca63c270a92fce2302',1,'atmcdLXd.h']]],
['at_5fversioninfoid',['AT_VersionInfoId',['../atmcd_l_xd_8h.html#ab65a647fb827b7c627ec733b7da608aa',1,'atmcdLXd.h']]],
['atmcdlxd_2eh',['atmcdLXd.h',['../atmcd_l_xd_8h.html',1,'']]],
['attributes',['attributes',['../structswig__class.html#a2a73cdf08c947e5ecce4138c0f9b69f1',1,'swig_class']]],
['audionote',['audioNote',['../speckle__gui_8tcl.html#acbb4dc0c9f1b7442b5d7b4486f5512b8',1,'speckle_gui.tcl']]],
['autoidentify',['autoIdentify',['../display_8tcl.html#a584c6c3425c5605017196a421c2539e5',1,'display.tcl']]],
['aveangle',['aveAngle',['../structrot_stats.html#ac43898f79d5591ab606c56afc5b6c13d',1,'rotStats']]],
['axisconfig',['AxisConfig',['../namespace_plotchart.html#a85c379af906a3fd9e44996ade4001cc6',1,'Plotchart']]]
];
| therandomfactory/nessi-control | doc/code/html/search/all_61.js | JavaScript | gpl-2.0 | 42,115 |
// Gulp core and plugins
var gulp = require('gulp'),
gutil = require('gulp-util');
// Settings
var config = require('./../config.json');
// Pipes
var json = require('./../pipes/json');
/* Compile application data */
gulp.task('data', 'Compile application data', function()
{
gutil.log( gutil.colors.magenta('Compiling application data') );
return gulp.src(config.tasks.jsonlint.src)
.pipe( json.pipeline() );
}); | Truemedia/Treasure-Chest | gulp/tasks/data.js | JavaScript | gpl-2.0 | 420 |
import { createSelector } from '@automattic/state-utils';
import { map, pickBy } from 'lodash';
import 'calypso/state/reader/init';
/**
* Returns a list of site IDs dismissed by the user
*
* @param {object} state Global state tree
* @returns {Array} Dimissed site IDs
*/
export const getDismissedSites = createSelector(
( state ) => map( Object.keys( pickBy( state.reader.siteDismissals.items ) ), Number ),
( state ) => [ state.reader.siteDismissals.items ]
);
| Automattic/wp-calypso | client/state/reader/site-dismissals/selectors.js | JavaScript | gpl-2.0 | 481 |
"use strict";!function(e){window.popMenus={activeLinks:function(i){var n=i.domain,t=i.pageSection,a=i.block;i.targets.each(function(){var i=e(this),s=popManager.getJsSettings(n,t,a,i)["active-link-menu-item-ids"]||[];e.each(s,function(e,n){i.find(".menu-item-object-id-"+n).addClass("active").parents(".menu-item").addClass("active")})})}}}(jQuery),popJSLibraryManager.register(popMenus,["activeLinks"]); | leoloso/PoP | layers/Legacy/Schema/packages/migrate-everythingelse/migrate/plugins/pop-mastercollection-webplatform/js/dist/libraries/menus.min.js | JavaScript | gpl-2.0 | 404 |
Ext.define('Rd.view.meshes.gridMeshes' ,{
extend:'Ext.grid.Panel',
alias : 'widget.gridMeshes',
multiSelect: true,
store : 'sMeshes',
stateful: true,
stateId: 'StateGridMeshes',
stateEvents:['groupclick','columnhide'],
border: false,
requires: [
'Rd.view.components.ajaxToolbar'
],
viewConfig: {
loadMask:true
},
urlMenu: '/cake2/rd_cake/meshes/menu_for_grid.json',
bbar: [
{ xtype: 'component', itemId: 'count', tpl: i18n('sResult_count_{count}'), style: 'margin-right:5px', cls: 'lblYfi' }
],
initComponent: function(){
var me = this;
var filters = {
ftype : 'filters',
encode : true,
local : false
};
me.tbar = Ext.create('Rd.view.components.ajaxToolbar',{'url': me.urlMenu});
me.features = [filters];
me.columns = [
{xtype: 'rownumberer'},
{ text: i18n('sOwner'), dataIndex: 'owner', tdCls: 'gridTree', flex: 1,filter: {type: 'string'}},
{ text: i18n('sName'), dataIndex: 'name', tdCls: 'gridTree', flex: 1,filter: {type: 'string'}},
{ text: 'SSID', dataIndex: 'ssid', tdCls: 'gridTree', flex: 1,filter: {type: 'string'},hidden: true},
{ text: 'BSSID', dataIndex: 'bssid', tdCls: 'gridTree', flex: 1,filter: {type: 'string'},hidden: true},
{ text: 'Node count', dataIndex: 'node_count', tdCls: 'gridTree', flex: 1},
{ text: 'Nodes up', dataIndex: 'nodes_up', tdCls: 'gridTree', flex: 1},
{ text: 'Nodes down', dataIndex: 'nodes_down', tdCls: 'gridTree', flex: 1},
{
text : i18n('sNotes'),
sortable: false,
width : 130,
xtype : 'templatecolumn',
tpl : new Ext.XTemplate(
"<tpl if='notes == true'><div class=\"note\">"+i18n("sExisting_Notes")+"</div></tpl>"
),
dataIndex: 'notes'
}
];
me.callParent(arguments);
}
});
| smartwifi/stores-rd | rd_legacy/app/view/meshes/gridMeshes.js | JavaScript | gpl-2.0 | 2,214 |
/*
Vaues considerd as False
0 -0 NaN
""
false
null
undefined
*/
const SPENDING_TRESHOLD = 200;
const TAX_RATE = 0.08;
const PTHONE_PRICE;
const ACCESSORY_PRICE = 9.99;
var banl_balance = 303.91;
var amount = 0;
function calculateTax(amount) {
return amount * TAX_RATE;
}
function formatAmount(amount) {
return "$" + amount.toFixed ( 2 );
}
while (amount < banl_balance) {
amount += PTHONE_PRICE;
if (amount < SPENDING_TRESHOLD) {
amount += ACCESSORY_PRICE;
}
}
amount += calculateTax( amount );
debug() | michalhrk/euler_practice | Basic of JavaScript.js | JavaScript | gpl-2.0 | 516 |
Namaste = {};
function namasteConfirmDelete(frm, msg) {
if(!confirm(msg)) return false;
frm.del.value=1;
frm.submit();
}
function namasteEnrollCourse(boxTitle, courseID, studentID, url) {
tb_show(boxTitle,
url + '&course_id=' + courseID +
'&student_id=' + studentID);
} | fawwaz/PPL | wp-content/plugins/namaste-lms/js/common.js | JavaScript | gpl-2.0 | 282 |
/*
* 员工开发情况表
*/
// global vars
col = -1;
proj_no = '';
proj_user = '';
last_col = -1;
last_proj_no = '';
var weeks;
var schdColModels = [ {
display : '人员',
name : 'emp_name',
width : 54,
align : 'center'
}, {
display : '状态',
name : 'proj_status',
width : 36
}, {
display : '类型',
name : 'proj_type',
width : 36
}, {
display : '项目编号',
name : 'proj_no',
sortable : true,
width : 60,
align : 'center'
}, {
display : '项目名称',
name : 'proj_name',
width : 280
} ];
function getProjInfo(id) {
var row = document.getElementById('schdgrid').rows[id-1];
var td = row.cells;
proj_no = $(td[3]).text();
// proj_name = $(td[4]).text();
// proj_schd = $(td[col + 5]).text();
proj_user = $(td[0]).text();
}
function getColumnId(tdDiv, id) { // start from 0 of schedule data
var row = document.getElementById('schdgrid').rows[id-1];
var td = row.cells;
for (j = 0; j < td.length; j++) {
if ($(td[j]).children(0).is($(tdDiv)))
return j - 5;
}
return str;
}
function editCell(tdDiv, id) {
var value = $(tdDiv).html();
$(tdDiv).click(function () {
col = getColumnId(tdDiv, id);
getProjInfo(id);
if ($(this).parent().attr('style') == null) {
return false;
}
if (getCookie('emp_yst_id') == '') {
$('#loginModal').modal('show');
return false;
}
if (last_col == col && last_proj_no == proj_no
&& $('.my-dropdown').css('display') != 'none') {
$('.my-dropdown').hide();
} else {
$('.my-dropdown').hide();
$('.my-dropdown').css("top", $(this).offset().top + 16).css("left", $(this).offset().left + 30).show();
}
last_col = col;
last_proj_no = proj_no;
return false;
});
}
$('#index-li').addClass('active');
$('#schd-li').addClass('active');
$('#top-container').html('<h4>' + SCHDTABLENAME + '</h4>');
$.post('getprojschd', function (data) {
if (data == '')
return;
weeks = data.split('|');
var len = schdColModels.length;
for (var i = 0; i < weeks.length; i++) {
schdColModels[len+i] = new Object();
schdColModels[len+i].display = weeks[i];
schdColModels[len+i].name = 'week' + (i+1);
schdColModels[len+i].width = 80;
schdColModels[len+i].process = editCell;
}
var Handle = function(com, grid) {
if (com == '导出Excel') {
$('#schdgrid').flexExport('exportexcel', 'schdtable');
} else if (com == '批量通过') {
if (getCookie('emp_yst_id') == '') {
$('#loginModal').modal('show');
return false;
}
$.each($('.trSelected', grid), function(key, value) {
for (var i = 5; i < schdColModels.length; i++) {
var cell = value.children[i];
if ($(cell).attr('style') == null) {
continue;
}
$.post('checkstate', {
emp_yst_id: getCookie('emp_yst_id'),
emp_pwd: getCookie('emp_pwd'),
emp_name: $(value.children[0]).text(),
proj_no: $(value.children[3]).text(),
col_id: i - 5,
check_state: 2
}, function(data) {
if (data == 'true') {
$('#schdgrid').flexReload();
return;
}
if ($('#infoModal').is(':hidden')) {
if (data == 'noauth') {
$('#glob-info').html('<h3>没有权限</h3>');
} else if (data == 'false') {
$('#glob-info').html('<h3>操作失败</h3>');
} else if (data == 'notlogged') {
$('#glob-info').html('<h3>请先登录</h3>');
}
$('#infoModal').modal('show');
setTimeout(function() {
$('#infoModal').modal('hide');
$('#glob-info').empty().removeClass('text-success').addClass('text-error');
}, 1200);
}
});
}
});
} else if (com == '显示本组') {
$('#schdgrid').flexOptions({params: [{name : 'team_name', value : getCookie('emp_yst_id')}]}).flexReload();
} else if (com == '显示全部') {
$('#schdgrid').flexOptions({params: [{name : 'team_name', value : 'all'}]}).flexReload();
}
};
$("#schdgrid").flexigrid( {
url : 'slctempschd',
dataType : 'json',
colModel : schdColModels,
buttons : [ {
name : '批量通过',
bclass : 'allpass',
onpress : Handle
}, {
name : '导出Excel',
bclass : 'export',
onpress : Handle
}, {
separator : true
}, {
name : '显示本组',
bclass : 'mygrp',
onpress : Handle
}, {
name : '显示全部',
bclass : 'allgrp',
onpress : Handle
}],
searchitems : [ {
display : '员工姓名',
name : 'emp_name'
}, {
display : '项目编号',
name : 'proj_no'
}, {
display : '项目名称',
name : 'proj_name',
isdefault : true
} ],
sortname : 'emp_name',
sortorder : 'asc',
usepager : true,
rp : 20,
rpOptions: [20, 30, 50, 100],
title : SCHDTABLENAME,
nomsg : '没有项目',
showTableToggleBtn : false,
//singleSelect : true,
width : 'auto',
height : document.documentElement.clientHeight - BOTTOMMARGIN
});
});
$('#dropdown-audit-pass').click(function() {
$('.my-dropdown').hide();
$.post('checkstate', {
emp_yst_id: getCookie('emp_yst_id'),
emp_pwd: getCookie('emp_pwd'),
emp_name: proj_user,
proj_no: proj_no,
col_id: col,
check_state: 2
}, function(data) {
if (data == 'true') {
$('#schdgrid').flexReload();
return;
}
if ($('#infoModal').is(':hidden')) {
if (data == 'noauth') {
$('#glob-info').html('<h3>没有权限</h3>');
} else if (data == 'false') {
$('#glob-info').html('<h3>操作失败</h3>');
} else if (data == 'notlogged') {
$('#glob-info').html('<h3>请先登录</h3>');
}
$('#infoModal').modal('show');
setTimeout(function() {
$('#infoModal').modal('hide');
$('#glob-info').empty().removeClass('text-success').addClass('text-error');
}, 1200);
}
});
});
$('#dropdown-audit-reject').click(function() {
$('.my-dropdown').hide();
$.post('checkstate', {
emp_yst_id: getCookie('emp_yst_id'),
emp_pwd: getCookie('emp_pwd'),
emp_name: proj_user,
proj_no: proj_no,
col_id: col,
check_state: 3
}, function(data) {
if (data == 'true') {
$('#schdgrid').flexReload();
return;
}
if ($('#infoModal').is(':hidden')) {
if (data == 'noauth') {
$('#glob-info').html('<h3>没有权限</h3>');
} else if (data == 'false') {
$('#glob-info').html('<h3>操作失败</h3>');
} else if (data == 'notlogged') {
$('#glob-info').html('<h3>请先登录</h3>');
}
$('#infoModal').modal('show');
setTimeout(function() {
$('#infoModal').modal('hide');
$('#glob-info').empty().removeClass('text-success').addClass('text-error');
}, 1200);
}
});
}); | chiphead/blabla | WebRoot/js/schdgrid.js | JavaScript | gpl-2.0 | 6,827 |
/*
jQuery Form Dependencies v2.0
http://github.com/digitalnature/Form-Dependencies
*/
;(function($, window, document, undefined){
$.fn.FormDependencies = function(opts){
var defaults = {
// the attribute which contains the rules
ruleAttr : 'data-depends-on',
// if given, this class will be applied to disabled elements
inactiveClass : false,
// clears input values from disabled fields
clearValues : false,
// attribute used to identify dependencies
identifyBy : 'data-depend-id'
},
opts = $.extend(defaults, opts),
disable = function(e){
if(!$(e).is(':input') && !$(e).hasClass('disabled'))
$(e).addClass('disabled');
if(!e.disabled){
e.disabled = true;
$('label[for="' + e.id + '"]').addClass('disabled');
if(opts.inactiveClass)
$(e, 'label[for="' + e.id + '"]').addClass(opts.inactiveClass);
// we don't want to "clear" submit buttons
if(opts.clearValues && !$(e).is(':submit'))
if($(e).is(':checkbox, :radio')) e.checked = false; else if(!$(e).is('select')) $(e).val('');
}
},
enable = function(e){
if(!$(e).is(':input') && $(e).hasClass('disabled'))
$(e).removeClass('disabled');
if(e.disabled){
e.disabled = false;
$('label[for="' + e.id + '"]').removeClass('disabled');
if(opts.inactiveClass || !$(e).is(':visible'))
$(e, 'label[for="' + e.id + '"]').removeClass(opts.inactiveClass);
}
},
// verifies if conditions are met
matches = function(key, values, block){
var i, v, invert = false, e = $('[' + opts.identifyBy + '="' + key + '"]', block);
e = e.is(':radio') ? e.filter(':checked') : e.filter('[type!="hidden"]')
for(i = 0; i < values.length; i++){
v = values[i];
invert = false;
if(v[0] === '!'){
invert = true;
v = v.substr(1);
}
if((e.val() == v) || (!v && e.is(':checked')) || ((e.is(':submit') || e.is(':button')) && !e.is(':disabled')))
return !invert;
}
return invert;
},
split = function(str, chr){
return $.map(str.split(chr), $.trim);
};
return this.each(function(){
var block = this, rules = [], keys = [];
// parse rules
$('[' + opts.ruleAttr + ']', this).each(function(){
var deps = $(this).attr(opts.ruleAttr), dep, values, parsedDeps = {}, i, invert;
if(!deps)
return this;
deps = split(deps, '+');
for(i = 0; i < deps.length; i++){
dep = deps[i];
invert = false;
// reverse conditional check if the name starts with '!'
// the rules should have any values specified in this case
if(dep[0] === '!'){
dep = dep.substr(1);
invert = true;
}
dep = split(dep, ':');
values = dep[1] || '';
if(!values && invert)
values = '!';
parsedDeps[dep[0]] = split(values, '|');
// store dep. elements in a separate array
$('[' + opts.identifyBy + '="' + dep[0] + '"]', block).filter('[type!="hidden"]').each(function(){
($.inArray(this, keys) !== -1) || keys.push(this);
parsedDeps[dep[0]].target = this;
});
}
rules.push({target: this, deps: parsedDeps});
});
if(!keys.length)
return this;
// attach our state checking function on keys (ie. elements on which other elements depend on)
$(keys).on('change.FormDependencies keyup', function(event){
// iterate trough all rules
$.each(rules, function(input, inputRules){
var hideIt = false;
$.each(inputRules.deps, function(key, values){
// we check only if a condition fails,
// in which case we know we need to disable the hooked element
if(!matches(key, values, block)){
hideIt = true;
return false;
}
});
hideIt ? disable(inputRules.target) : enable(inputRules.target);
});
}).trigger('change.FormDependencies');
return this;
});
};
})(jQuery, window, document); | ThemeSama/themesama-shortcodes | js/jquery.form-dependencies.js | JavaScript | gpl-2.0 | 4,534 |
YaVDR.TimersStore = Ext.extend(Ext.data.JsonStore, {
url: '/admin/dashboard_timers'
}); | yavdr/yavdr-webfrontend | yavdrweb-ng/static/javascripts/stores/timers.js | JavaScript | gpl-2.0 | 88 |
$(document).ready(function(){
//////Leaflet
var map = new L.Map('map');
var cloudmadeUrl = 'http://{s}.tile.cloudmade.com/d895100ab0a14523b3a3b34b6819e123/997/256/{z}/{x}/{y}.png',
cloudmadeAttrib = 'Map data © 2011 OpenStreetMap contributors, Imagery © 2011 CloudMade',
cloudmade = new L.TileLayer(cloudmadeUrl, {maxZoom: 18, attribution: cloudmadeAttrib});
var sydney = new L.LatLng(-33.859972, 151.211111); // geographical point (longitude and latitude)
map.setView(sydney, 13).addLayer(cloudmade);
//Set up popup containing information and instructions
//Popup and map load at the same time
var welcomePopup = new L.Popup();
welcomePopup.setLatLng(new L.LatLng(-33.859972, 151.211111));
welcomePopup.setContent("<b>Welcome to a brief tour of Sydney!</b>" +
"<p>Click any of the markers to learn more about Sydney. Click the "X" to close each pop up.</p>");
map.openPopup(welcomePopup);
//Set up map markers
//Sydney Olympic Park
var olympicPark = new L.LatLng(-33.84801, 151.06488);
var olympicParkMarker = new L.Marker(olympicPark);
map.addLayer(olympicParkMarker);
olympicParkMarker.bindPopup("<b>Sydney Olympic Park</b>" +
"<img src=\"http://upload.wikimedia.org/wikipedia/commons/thumb/c/cd/Stadium_Australia_2.jpg/320px-Stadium_Australia_2.jpg\">" +
"<p>Home of the 2000 Olympics. The facilities built continue to be used for sporting and cultural events, as well as commercial development and extensive parklands.</p>",
{ maxWidth: 358 });
//Sydney Opera House
var sydneyOperaHouse = new L.LatLng(-33.858667, 151.214028);
var sydneyOperaHouseMarker = new L.Marker(sydneyOperaHouse);
map.addLayer(sydneyOperaHouseMarker);
sydneyOperaHouseMarker.bindPopup("<b>Sydney Opera House</b>" +
"<img src=\"http://upload.wikimedia.org/wikipedia/commons/thumb/3/38/Sydney_opera_house_side_view.jpg/320px-Sydney_opera_house_side_view.jpg\" alt=\"Sydney Opera House\">" +
"<p>The Sydney Opera House is a multi-venue performing arts centre. As one of the busiest performing arts centres in the world, it hosts over 1,500 performances each year attended by some 1.2 million people, and more than seven million tourists visiting the site each year, 300,000 of whom take a guided tour.</p>",
{ maxWidth: 358 });
//Sydney Harbour Bridge
var sydneyHarbourBridge = new L.LatLng(-33.852222, 151.210556);
var sydneyHarbourBridgeMarker = new L.Marker(sydneyHarbourBridge);
map.addLayer(sydneyHarbourBridgeMarker);
sydneyHarbourBridgeMarker.bindPopup("<b>Sydney Harbour Bridge</b>" +
"<img src=\"http://upload.wikimedia.org/wikipedia/commons/thumb/d/d1/Sydney_Harbour_Bridge_from_Circular_Quay.jpg/320px-Sydney_Harbour_Bridge_from_Circular_Quay.jpg\" alt=\"Sydney Harbour Bridge\">" +
"<p>Crosses the harbour from the The Rocks to North Sydney. There are many different experiences centred around the bridge. You can walk or cycle across, picnic under, or climb over the Harbour Bridge.</p>",
{ maxWidth: 358 });
//Darling Habour
var darlingHarbour = new L.LatLng(-33.8723, 151.19896);
var darlingHarbourMarker = new L.Marker(darlingHarbour);
map.addLayer(darlingHarbourMarker);
darlingHarbourMarker.bindPopup("<b>Darling Harbour</b>" +
"<img src=\"http://upload.wikimedia.org/wikipedia/commons/thumb/4/44/Sydney_sunset_darling_harbour.jpg/320px-Sydney_sunset_darling_harbour.jpg\" alt=\"Darling Harbour\">" +
"<p>A large tourist precinct that includes a range of activities, restaurants, museums and shopping facilities.</p>",
{ maxWidth: 358 });
//St Mary's Cathedral
var cathedral = new L.LatLng(-33.871133, 151.213208);
var cathedralMarker = new L.Marker(cathedral);
map.addLayer(cathedralMarker);
cathedralMarker.bindPopup("<b>St. Mary's Cathedral</b>" +
"<img src=\"http://upload.wikimedia.org/wikipedia/commons/thumb/1/1d/StMarysCathedral_fromHydePark.JPG/320px-StMarysCathedral_fromHydePark.JPG\" alt=\"St. Mary's Cathedral\">" +
"<p>Sydney's main catholic cathedral. The cathedral is dedicated to \"Mary, Help of Christians\", Patron of Australia.</p>",
{ maxWidth: 358 });
//Sydney Tower Eye
var sydneyTower = new L.LatLng(-33.870456, 151.208889);
var sydneyTowerMarker = new L.Marker(sydneyTower);
map.addLayer(sydneyTowerMarker);
sydneyTowerMarker.bindPopup("<b>Sydney Tower Eye</b>" +
"<img src=\"http://upload.wikimedia.org/wikipedia/commons/thumb/a/a5/Centrepoint_evening_blues.jpg/159px-Centrepoint_evening_blues.jpg\" alt=\"Sydney Tower Eye\">" +
"<p>The tallest structure in Sydney. The tower contains a buffet, cafe and a rather large restaurant and attracts many visitors a year.</p>",
{ maxWidth: 278 });
//Royal Botanic Gardens
var botanicGardens = new L.LatLng(-33.863889, 151.216944);
var botanicGardensMarker = new L.Marker(botanicGardens);
map.addLayer(botanicGardensMarker);
botanicGardensMarker.bindPopup("<b>Royal Botanic Gardens, Sydney</b>" +
"<img src=\"http://upload.wikimedia.org/wikipedia/commons/1/1f/Sydney_Royal_Botanic_Gardens_01.jpg\" alt=\"Royal Botanic Gardens, Sydney\" width=320>" +
"<p>The gardens are at the north eastern corner of the City Centre and overlook Sydney harbour. The gardens cover 30 hectares and represent 7500 species of plants</p>",
{ maxWidth: 358 });
//Luna Park
var lunaPark = new L.LatLng(-33.848222, 151.209972);
var lunaParkMarker = new L.Marker(lunaPark);
map.addLayer(lunaParkMarker);
lunaParkMarker.bindPopup("<b>Luna Park, Sydney</b>" +
"<img src=\"http://upload.wikimedia.org/wikipedia/commons/thumb/9/9a/03.01.2009-luna_entrance2.jpg/320px-03.01.2009-luna_entrance2.jpg\" alt=\"Luna Park, Sydney\">" +
"<p>Luna Park is a large theme park situated near the Sydney Harbour Bridge. Its mouth-shaped entrance and ferris wheel can be seen from many areas of Sydney.</p>",
{ maxWidth: 358 });
//Sydney Aqaurium
var sydneyAquarium = new L.LatLng(-33.869444, 151.201944);
var sydneyAquariumMarker = new L.Marker(sydneyAquarium);
map.addLayer(sydneyAquariumMarker);
sydneyAquariumMarker.bindPopup("<b>Sydney Aquarium</b>" +
"<img src=\"http://upload.wikimedia.org/wikipedia/commons/thumb/8/86/Sydney_Aquarium.jpg/320px-Sydney_Aquarium.jpg\">" +
"<p>Located in New South Wales and open to the public, the aquarium contains a large variety of Australian aquatic life, displaying more than 650 species comprising more than 6,000 individual fish and other sea creatures.</p>",
{ maxWidth: 358 });
//The Rocks
var theRocks = new L.LatLng(-33.85985, 151.20901);
var theRocksMarker = new L.Marker(theRocks);
map.addLayer(theRocksMarker);
theRocksMarker.bindPopup("<b>The Rocks</b>" +
"<img src=\"http://upload.wikimedia.org/wikipedia/commons/thumb/b/b6/SydneyTheRocks1_gobeirne.jpg/320px-SydneyTheRocks1_gobeirne.jpg\">" +
"<p>The Rocks is Syndey's historic area and includes sites preserved from Sydney's earliest settlements in 1788.</p>",
{ maxWidth: 358 });
//Taronga Zoo
var tarongaZoo = new L.LatLng(-33.843333, 151.241111);
var tarongaZooMarker = new L.Marker(tarongaZoo);
map.addLayer(tarongaZooMarker);
tarongaZooMarker.bindPopup("<b>Taronga Zoo</b>" +
"<img src=\"http://upload.wikimedia.org/wikipedia/commons/thumb/7/79/Taronga_Park_Zoo_-7Sept2008.jpg/240px-Taronga_Park_Zoo_-7Sept2008.jpg\">" +
"<p>Taronga Zoo is home to over 2,600 animals on 21 hectares. Daily activities include bird and seal shows, up-close encounters with animals such as giraffes and koalas, and talks with animal trainers.</p>",
{ maxWidth: 278 });
//Sydney Cove
var sydneyCove = new L.LatLng(-33.858611, 151.211667);
var sydneyCoveMarker = new L.Marker(sydneyCove);
map.addLayer(sydneyCoveMarker);
sydneyCoveMarker.bindPopup("<b>Sydney Cove</b>" +
"<img src=\"http://upload.wikimedia.org/wikipedia/commons/thumb/a/ae/Circularkey.jpg/320px-Circularkey.jpg\">" +
"<p>Sydney Cove is the birthplace of Sydney, established as a penal colony by Arthur Phillip in 1788. Along with The Rocks, it is considered one of the most important historical settlements in Australia.</p>",
{ maxWidth: 358 });
//////End Leaflet
});//End ready | nledford/WebDesignPortfolio | Sydney/js/script.js | JavaScript | gpl-2.0 | 8,397 |
/**
* @file
* JavaScript behaviors for composite element builder.
*/
(function ($, Drupal) {
'use strict';
/**
* Initialize composite element builder.
*
* @type {Drupal~behavior}
*/
Drupal.behaviors.webformElementComposite = {
attach: function (context) {
$('[data-composite-types]').once('webform-composite-types').each(function() {
var $element = $(this);
var $type = $element.closest('tr').find('.js-webform-composite-type');
var types = $element.attr('data-composite-types').split(',');
var required = $element.attr('data-composite-required');
$type.on('change', function() {
if ($.inArray($(this).val(), types) === -1) {
$element.hide();
if (required) {
$element.removeAttr('required aria-required');
}
}
else {
$element.show();
if (required) {
$element.attr({ 'required': 'required', 'aria-required': 'aria-required' })
}
}
}).change();
})
}
};
})(jQuery, Drupal);
| dbethala/longwood-volunteers | modules/webform/js/webform.element.composite.js | JavaScript | gpl-2.0 | 1,108 |
module.exports = {
options: {
mangle: true,
banner : '/*! <%= app.name %> v<%= app.version %> */\n'
},
dist: {
files: {
'../assets/js/min/tipsy.min.js': [ '../assets/js/admin/tipsy.js'],
'../assets/js/min/colorpicker.min.js': [ '../assets/js/admin/colorpicker.js'],
'../assets/js/min/upload.min.js': [ '../assets/js/admin/upload.js'],
'../assets/js/min/jquery.jplayer.concat.min.js': ['../assets/js/src/jquery.jplayer.min.js', '../assets/js/src/jplayer.playlist.js','../assets/js/jquery.jplayer.custom.js',],
}
}
}; | brutaldesign/wolf-jplayer | dev/grunt/options/uglify.js | JavaScript | gpl-2.0 | 536 |
/**
* IRCAnywhere server/irchandler.js
*
* @title IRCHandler
* @copyright (c) 2013-2014 http://ircanywhere.com
* @license GPL v2
* @author Ricki Hastings
*/
var _ = require('lodash'),
hooks = require('hooks'),
helper = require('../lib/helpers').Helpers;
/**
* The object responsible for handling an event from IRCFactory
* none of these should be called directly, however they can be hooked onto
* or have their actions prevented or replaced. The function names equal directly
* to irc-factory events and are case sensitive to them.
*
* @class IRCHandler
* @method IRCHandler
* @return void
*/
function IRCHandler() {
}
/**
* @member {Array} blacklisted An array of blacklisted commands which should be ignored
*/
IRCHandler.prototype.blacklisted = ['PING', 'RPL_CREATIONTIME'];
/**
* Formats an array of RAW IRC strings, taking off the :leguin.freenode.net 251 ricki- :
* at the start, returns an array of strings with it removed
*
* @method _formatRaw
* @param {Array} raw An array of raw IRC strings to format
* @return {Array} A formatted array of the inputted strings
*/
IRCHandler.prototype._formatRaw = function(raw) {
var output = [];
raw.forEach(function(line) {
var split = line.split(' ');
split.splice(0, 3);
var string = split.join(' ');
string = (string.substr(0, 1) === ':') ? string.substr(1) : string;
output.push(string);
});
return output;
};
/**
* Handles the opened event from `irc-factory` which just tells us what localPort and any other
* information relating to the client so we can make sure the identd server is working.
*
* @method opened
* @param {Object} client A valid client object
* @param {Object} message A valid message object
* @return void
*/
IRCHandler.prototype.opened = function(client, message) {
if (!application.config.identd.enable) {
return;
}
// not enabled, don't fill the cache if it isn't needed
if (!message.username || !message.port || !message.localPort) {
return;
}
// we need to make sure we've got all our required items
IdentdCache[message.localPort] = message;
delete client.forcedDisconnect;
};
/**
* Handles the registered event, this will only ever be called when an IRC connection has been
* fully established and we've recieved the `registered` events. This means when we reconnect to
* an already established connection we won't get this event again.
*
* @method registered
* @param {Object} client A valid client object
* @param {Object} message A valid message object
* @return void
*/
IRCHandler.prototype.registered = function(client, message) {
client.internal.capabilities = message.capabilities;
// set this immediately so the other stuff works
application.Networks.update({_id: client._id}, {$set: {
'nick': message.nickname,
'name': message.capabilities.network.name,
'internal.status': networkManager.flags.connected,
'internal.capabilities': message.capabilities
}}, {safe: false});
//networkManager.changeStatus({_id: client._id}, networkManager.flags.connected);
// commented this out because we do other changes to the network object here
// so we don't use this but we use a straight update to utilise 1 query instead of 2
application.Tabs.update({target: client.name.toLowerCase(), network: client._id}, {$set: {
title: message.capabilities.network.name,
target: message.capabilities.network.name.toLowerCase(),
active: true
}}, {multi: true, safe: false});
// update the tab
application.Tabs.update({network: client._id, type: {$ne: 'channel'}}, {$set: {
networkName: message.capabilities.network.name,
active: true
}}, {multi: true, safe: false});
// update any sub tabs that are not channels
eventManager.insertEvent(client, {
nickname: message.nickname,
time: new Date(new Date(message.time).getTime() - 15).toJSON(),
message: this._formatRaw(message.raw),
raw: message.raw
}, 'registered', function() {
// a bit of a hack here we'll spin the timestamp back 15ms to make sure it
// comes in order, it's because we've gotta wait till we've recieved all the capab
// stuff in irc-factory before we send it out, which can create a race condition
// which causes lusers to be sent through first
// XXX - send our connect commands, things that the user defines
// nickserv identify or something
_.each(client.channels, function(channel) {
var chan = channel.channel,
password = channel.password || '';
ircFactory.send(client._id, 'join', [chan, password]);
ircFactory.send(client._id, 'mode', [chan]);
// request the mode aswell.. I thought this was sent out automatically anyway? Seems no.
});
// find our channels to automatically join from the network setup
});
};
/**
* Handles a closed connection
*
* @method closed
* @param {Object} client A valid client object
* @param {Object} message A valid message object
* @return void
*/
IRCHandler.prototype.closed = function(client, message) {
networkManager.changeStatus({_id: client._id, 'internal.status': {$ne: networkManager.flags.disconnected}}, networkManager.flags.closed);
// Whats happening is were looking for networks that match the id and their status has not been set to disconnected
// which means someone has clicked disconnected, if not, just set it as closed (means we've disconnected for whatever reason)
networkManager.activeTab(client, false);
// now lets update the tabs to inactive
eventManager.insertEvent(client, {
time: new Date().toJSON(),
message: (message.reconnecting) ? 'Connection closed. Attempting reconnect number ' + message.attempts : 'You have disconnected.',
}, networkManager.flags.closed);
if (!message.reconnecting) {
ircFactory.destroy(client._id, false);
}
// destroy the client if we're not coming back
};
/**
* Handles a failed event, which is emitted when the retry attempts are exhaused
*
* @method failed
* @param {Object} client A valid client object
* @param {Object} message A valid message object
* @return void
*/
IRCHandler.prototype.failed = function(client) {
networkManager.changeStatus({_id: client._id}, networkManager.flags.failed);
// mark tab as failed
networkManager.activeTab(client, false);
// now lets update the tabs to inactive
eventManager.insertEvent(client, {
time: new Date().toJSON(),
message: 'Connection closed. Retry attempts exhausted.',
}, networkManager.flags.closed);
ircFactory.destroy(client._id, false);
// destroy the client
};
/**
* Handles an incoming lusers event
*
* @method lusers
* @param {Object} client A valid client object
* @param {Object} message A valid message object
* @return void
*/
IRCHandler.prototype.lusers = function(client, message) {
eventManager.insertEvent(client, {
time: message.time,
message: this._formatRaw(message.raw),
raw: message.raw
}, 'lusers');
};
/**
* Handles an incoming motd event
*
* @method motd
* @param {Object} client A valid client object
* @param {Object} message A valid message object
* @return void
*/
IRCHandler.prototype.motd = function(client, message) {
eventManager.insertEvent(client, {
time: message.time,
message: this._formatRaw(message.raw),
raw: message.raw
}, 'motd');
// again spin this back 15ms to prevent a rare but possible race condition where
// motd is the last thing that comes through, because we wait till we've recieved
// it all before sending it out, javascripts async nature causes this.
};
/**
* Handles an incoming join event
*
* @method join
* @param {Object} client A valid client object
* @param {Object} message A valid message object
* @return void
*/
IRCHandler.prototype.join = function(client, message) {
if (!message.username || !message.hostname || !message.nickname || !message.channel) {
return false;
}
var user = {
username: message.username,
hostname: message.hostname,
nickname: message.nickname,
modes: {}
};
// just a standard user object, although with a modes object aswell
if (message.nickname === client.nick) {
networkManager.addTab(client, message.channel, 'channel', true);
ircFactory.send(client._id, 'mode', [message.channel]);
ircFactory.send(client._id, 'names', [message.channel]);
insertEvent();
} else {
channelManager.insertUsers(client._id, message.channel, [user])
.then(insertEvent);
}
// if it's us joining a channel we'll create a tab for it and request a mode
function insertEvent() {
eventManager.insertEvent(client, message, 'join');
}
};
/**
* Handles an incoming part event
*
* @method part
* @param {Object} client A valid client object
* @param {Object} message A valid message object
* @return void
*/
IRCHandler.prototype.part = function(client, message) {
if (!message.username || !message.hostname || !message.nickname || !message.channel) {
return false;
}
eventManager.insertEvent(client, message, 'part', function() {
channelManager.removeUsers(client._id, message.channel, [message.nickname]);
if (message.nickname === client.nick) {
networkManager.activeTab(client, message.channel, false);
}
// we're leaving, mark the tab as inactive
});
};
/**
* Handles an incoming kick event
*
* @method kick
* @param {Object} client A valid client object
* @param {Object} message A valid message object
* @return void
*/
IRCHandler.prototype.kick = function(client, message) {
if (!message.username || !message.hostname || !message.nickname || !message.channel || !message.kicked) {
return false;
}
eventManager.insertEvent(client, message, 'kick', function() {
channelManager.removeUsers(client._id, message.channel, [message.kicked]);
if (message.kicked === client.nick) {
networkManager.activeTab(client, message.channel, false);
}
// we're leaving, remove the tab
});
};
/**
* Handles an incoming quit event
*
* @method quit
* @param {Object} client A valid client object
* @param {Object} message A valid message object
* @return void
*/
IRCHandler.prototype.quit = function(client, message) {
if (!message.username || !message.hostname || !message.nickname) {
return false;
}
eventManager.insertEvent(client, message, 'quit', function() {
channelManager.removeUsers(client._id, [message.nickname]);
});
};
/**
* Handles an incoming nick change event
*
* @method nick
* @param {Object} client A valid client object
* @param {Object} message A valid message object
* @return void
*/
IRCHandler.prototype.nick = function(client, message) {
if (!message.username || !message.hostname || !message.nickname || !message.newnick) {
return false;
}
if (message.nickname === client.nick) {
application.Networks.update({_id: client._id}, {$set: {nick: message.newnick}}, {safe: false});
}
// update the nickname because its us changing our nick
if (_.has(client.internal.tabs, message.nickname)) {
var mlower = message.nickname.toLowerCase();
application.Tabs.update({user: client.internal.userId, network: client._id, target: mlower}, {$set: {title: message.nickname, target: mlower, url: client.url + '/' + mlower}}, {safe: false});
}
// is this a client we're chatting to whos changed their nickname?
eventManager.insertEvent(client, message, 'nick', function() {
channelManager.updateUsers(client._id, [message.nickname], {nickname: message.newnick});
});
};
/**
* Handles an incoming who event
*
* @method who
* @param {Object} client A valid client object
* @param {Object} message A valid message object
* @return void
*/
IRCHandler.prototype.who = function(client, message) {
if (!message.who || !message.channel) {
return false;
}
var users = [],
prefixes = _.invert(client.internal.capabilities.modes.prefixmodes);
networkManager.addTab(client, message.channel, 'channel');
// we'll update our internal channels cause we might be reconnecting after inactivity
_.each(message.who, function(u) {
var split = u.prefix.split('@'),
mode = u.mode.replace(/[a-z0-9]/i, ''),
user = {};
user.username = split[0];
user.hostname = split[1];
user.nickname = u.nickname;
user.modes = {};
for (var i = 0, len = mode.length; i < len; i++) {
var prefix = mode.charAt(i);
user.modes[prefix] = prefixes[prefix];
}
// set the modes
// normal for loop here cause we're just iterating a string, other cases I would use
// _.each()
user.prefix = eventManager.getPrefix(client, user).prefix;
// set the current most highest ranking prefix
users.push(user);
});
channelManager.insertUsers(client._id, message.channel, users, true)
.then(function(inserts) {
rpcHandler.push(client.internal.userId, 'channelUsers', inserts);
// burst emit these instead of letting the oplog tailer handle it, it's too heavy
});
};
/**
* Handles an incoming names event
*
* @method names
* @param {Object} client A valid client object
* @param {Object} message A valid message object
* @return void
*/
IRCHandler.prototype.names = function(client, message) {
if (!message.names || !message.channel) {
return false;
}
application.ChannelUsers.find({network: client._id, channel: message.channel.toLowerCase()}).toArray(function(err, channelUsers) {
if (err || !channelUsers) {
return false;
}
var users = [],
keys = [],
regex = new RegExp('[' + helper.escape(client.internal.capabilities.modes.prefixes) + ']', 'g');
channelUsers.forEach(function(u) {
keys.push(u.nickname);
});
_.each(message.names, function(user) {
users.push(user.replace(regex, ''));
});
// strip prefixes
keys.sort();
users.sort();
if (!_.isEqual(keys, users) && message.channel !== '*') {
ircFactory.send(client._id, 'raw', ['WHO', message.channel]);
}
// different lists.. lets do a /WHO
});
};
/**
* Handles an incoming mode notify event
*
* @method mode
* @param {Object} client A valid client object
* @param {Object} message A valid message object
* @return void
*/
IRCHandler.prototype.mode = function(client, message) {
if (!message.mode || !message.channel) {
return false;
}
channelManager.updateModes(client._id, client.internal.capabilities.modes, message.channel, message.mode);
};
/**
* Handles an incoming mode change event
*
* @method mode_change
* @param {Object} client A valid client object
* @param {Object} message A valid message object
* @return
*/
IRCHandler.prototype.mode_change = function(client, message) {
if (!message.username || !message.hostname || !message.nickname || !message.mode || !message.channel) {
return false;
}
eventManager.insertEvent(client, message, 'mode', function() {
channelManager.updateModes(client._id, client.internal.capabilities.modes, message.channel, message.mode);
});
};
/**
* Handles an incoming topic notify event
*
* @method topic
* @param {Object} client A valid client object
* @param {Object} message A valid message object
* @return void
*/
IRCHandler.prototype.topic = function(client, message) {
if (!message.topic || !message.topicBy || !message.channel) {
return false;
}
var split = message.topicBy.split(/[!@]/);
message.nickname = split[0];
message.username = split[1];
message.hostname = split[2];
// reform this object
eventManager.insertEvent(client, message, 'topic', function() {
channelManager.updateTopic(client._id, message.channel, message.topic, message.topicBy);
});
};
/**
* Handles an incoming topic change event
*
* @method topic_change
* @param {Object} client A valid client object
* @param {Object} message A valid message object
* @return void
*/
IRCHandler.prototype.topic_change = function(client, message) {
if (!message.topic || !message.topicBy || !message.channel) {
return false;
}
var split = message.topicBy.split(/[!@]/);
message.nickname = split[0];
message.username = split[1];
message.hostname = split[2];
// reform this object
eventManager.insertEvent(client, message, 'topic_change', function() {
channelManager.updateTopic(client._id, message.channel, message.topic, message.topicBy);
});
};
/**
* Handles an incoming privmsg event
*
* @method privmsg
* @param {Object} client A valid client object
* @param {Object} message A valid message object
* @return void
*/
IRCHandler.prototype.privmsg = function(client, message) {
if (!message.username || !message.hostname || !message.nickname || !message.target || !message.message) {
return false;
}
eventManager.insertEvent(client, message, 'privmsg');
};
/**
* Handles an incoming action event
*
* @method action
* @param {Object} client A valid client object
* @param {Object} message A valid message object
* @return void
*/
IRCHandler.prototype.action = function(client, message) {
if (!message.username || !message.hostname || !message.nickname || !message.target || !message.message) {
return false;
}
eventManager.insertEvent(client, message, 'action');
};
/**
* Handles an incoming notice event
*
* @method notice
* @param {Object} client A valid client object
* @param {Object} message A valid message object
* @return void
*/
IRCHandler.prototype.notice = function(client, message) {
if (!message.target || !message.message) {
return false;
}
eventManager.insertEvent(client, message, 'notice');
};
/**
* Handles an incoming usermode event
*
* @method usermode
* @param {Object} client A valid client object
* @param {Object} message A valid message object
* @return void
*/
IRCHandler.prototype.usermode = function(client, message) {
if (!message.nickname || !message.mode) {
return false;
}
eventManager.insertEvent(client, message, 'usermode');
};
/**
* Handles an incoming ctcp_response event
*
* @method ctcp_response
* @param {Object} client A valid client object
* @param {Object} message A valid message object
* @return void
*/
IRCHandler.prototype.ctcp_response = function(client, message) {
if (!message.username || !message.hostname || !message.nickname || !message.target || !message.type || !message.message) {
return false;
}
eventManager.insertEvent(client, message, 'ctcp_response');
};
/**
* Handles an incoming ctcp request event
*
* @method ctcp_request
* @param {Object} client A valid client object
* @param {Object} message A valid message object
* @return void
*/
IRCHandler.prototype.ctcp_request = function(client, message) {
if (!message.username || !message.hostname || !message.nickname || !message.target || !message.type || !message.message) {
return false;
}
if (message.type.toUpperCase() == 'VERSION') {
var version = 'IRCAnywhere v' + application.packagejson.version + ' ' + application.packagejson.homepage;
ircFactory.send(client._id, 'ctcp', [message.nickname, 'VERSION', version]);
}
eventManager.insertEvent(client, message, 'ctcp_request');
};
/**
* Handles an incoming unknown event
*
* @method unknown
* @param {Object} client A valid client object
* @param {Object} message A valid message object
* @return void
*/
IRCHandler.prototype.unknown = function(client, message) {
if (this.blacklisted.indexOf(message.command) === -1) {
message.message = message.params.join(' ');
eventManager.insertEvent(client, message, 'unknown');
}
};
/**
* Handles an incoming banlist event
*
* @method banlist
* @param {Object} client A valid client object
* @param {Object} message A valid message object
* @return void
*/
IRCHandler.prototype.banlist = function(client, message) {
if (!message.channel || !message.banlist) {
return false;
}
rpcHandler.push(client.internal.userId, 'banList', {channel: message.channel, items: message.banlist, type: 'banList'});
};
/**
* Handles an incoming invitelist event
*
* @method invitelist
* @param {Object} client A valid client object
* @param {Object} message A valid message object
* @return void
*/
IRCHandler.prototype.invitelist = function(client, message) {
if (!message.channel || !message.invitelist) {
return false;
}
rpcHandler.push(client.internal.userId, 'inviteList', {channel: message.channel, items: message.invitelist, type: 'inviteList'});
};
/**
* Handles an incoming exceptlist event
*
* @method exceptlist
* @param {Object} client A valid client object
* @param {Object} message A valid message object
* @return void
*/
IRCHandler.prototype.exceptlist = function(client, message) {
if (!message.channel || !message.exceptlist) {
return false;
}
rpcHandler.push(client.internal.userId, 'exceptList', {channel: message.channel, items: message.exceptlist, type: 'exceptList'});
};
/**
* Handles an incoming quietlist event
*
* @method quietlist
* @param {Object} client A valid client object
* @param {Object} message A valid message object
* @return void
*/
IRCHandler.prototype.quietlist = function(client, message) {
if (!message.channel || !message.quietlist) {
return false;
}
rpcHandler.push(client.internal.userId, 'quietList', {channel: message.channel, items: message.quietlist, type: 'quietList'});
};
/**
* Handles an incoming list event
*
* @method list
* @param {Object} client A valid client object
* @param {Object} message A valid message object
* @return void
*/
IRCHandler.prototype.list = function(client, message) {
if (!message.list || !message.search || !message.page || !message.limit) {
return false;
}
client.internal._listBlock = false;
// mark list block as false now we have the response
rpcHandler.push(client.internal.userId, 'list', {search: message.search, page: message.page, limit: message.limit, channels: message.list, network: client.name});
};
/**
* Handles an incoming whois event
*
* @method whois
* @param {Object} client A valid client object
* @param {Object} message A valid message object
* @return void
*/
IRCHandler.prototype.whois = function(client, message) {
if (!message.nickname || !message.username || !message.hostname) {
return false;
}
message.network = client._id;
rpcHandler.push(client.internal.userId, 'whois', message);
};
/* XXX - Events TODO
away - maybe this should alter the network status?
unaway - ^
names - kinda done, need to determine whether they've ran /names or not and show it as a model maybe
links - still needs to be implemented, although the basis in irc-factory is there
*/
IRCHandler.prototype = _.extend(IRCHandler.prototype, hooks);
exports.IRCHandler = IRCHandler;
| Alvuea/ircanywhere | server/irchandler.js | JavaScript | gpl-2.0 | 23,082 |
jQuery(document).ready(function(){
var date = new Date();
date.setTime(date.getTime() + 2*3600*1000);
document.cookie = "visited=true;expires=" + date.toGMTString();
}); | yangxuanxing/bubbfil | wp-content/themes/responsive/core/js/bubbfil.js | JavaScript | gpl-2.0 | 178 |
var fs = require('fs'),
path = require('path'),
async = require('../support/async.min.js'),
os = require('os').platform(),
exec = require('child_process').exec,
spawn = require('child_process').spawn,
Registry = require('./registry'),
exports = module.exports = function Processor(command) {
// constant for timeout checks
this.E_PROCESSTIMEOUT = -99;
this._codecDataAlreadySent = false;
this.saveToFile = function(targetfile, callback) {
callback = callback || function() {};
this.options.outputfile = targetfile;
var self = this;
var options = this.options;
// parse options to command
this._prepare(function(err, meta) {
if (err) {
return callback(null, null, err);
}
var args = self.buildFfmpegArgs(false, meta);
if (!args instanceof Array) {
return callback (null, null, args);
}
// start conversion of file using spawn
var ffmpegProc = self._spawnProcess(args);
if (options.inputstream) {
// pump input stream to stdin
options.inputstream.resume();
options.inputstream.pipe(ffmpegProc.stdin);
}
//handle timeout if set
var processTimer;
if (options.timeout) {
processTimer = setTimeout(function() {
ffmpegProc.removeAllListeners('exit');
ffmpegProc.kill('SIGKILL');
options.logger.warn('process ran into a timeout (' + self.options.timeout + 's)');
callback(self.E_PROCESSTIMEOUT, 'timeout');
}, options.timeout * 1000);
}
var stdout = '';
var stderr = '';
ffmpegProc.on('exit', function(code) {
if (processTimer) {
clearTimeout(processTimer);
}
// check if we have to run flvtool2 to update flash video meta data
if (self.options._updateFlvMetadata === true) {
// make sure we didn't try to determine this capability before
if (!Registry.instance.get('capabilityFlvTool2')) {
// check if flvtool2 is installed
exec('which flvtool2', function(whichErr, whichStdOut, whichStdErr) {
if (whichStdOut !== '') {
Registry.instance.set('capabilityFlvTool2', true);
// update metadata in flash video
exec('flvtool2 -U ' + self.options.outputfile, function(flvtoolErr, flvtoolStdout, flvtoolStderr) {
callback(stdout, stderr, null);
});
} else {
// flvtool2 is not installed, skip further checks
Registry.instance.set('capabilityFlvTool2', false);
callback(stdout, stderr, null);
}
});
} else if (!Registry.instance.get('capabilityFlvTool2')) {
// flvtool2 capability was checked before, execute update
exec('flvtool2 -U ' + self.options.outputfile, function(flvtoolErr, flvtoolStdout, flvtoolStderr) {
callback(stdout, stderr, null);
});
} else {
// flvtool2 not installed, skip update
callback(stdout, stderr, null);
}
} else {
callback(stdout, stderr, null);
}
});
ffmpegProc.stdout.on('data', function (data) {
stdout += data;
});
ffmpegProc.stderr.on('data', function (data) {
stderr += data;
if (options.onCodecData) {
self._checkStdErrForCodec(stderr);
}
if (options.onProgress) {
self._getProgressFromStdErr(stderr, meta.durationsec);
}
});
});
};
this.mergeToFile = function(targetfile,callback){
this.options.outputfile = targetfile;
var self = this;
var options = this.options;
var getExtension = function(filename) {
var ext = path.extname(filename||'').split('.');
return ext[ext.length - 1];
};
// creates intermediate copies of each video.
var makeIntermediateFile = function(_mergeSource,_callback){
var fname = _mergeSource+".temp.mpg";
var command = [
self.ffmpegPath,
[
'-i', _mergeSource,
'-qscale:v',1,
fname
].join(' ')
];
exec(command.join(' '),function(err, stdout, stderr) {
if(err)throw err;
_callback(fname);
});
};
// concat all created intermediate copies
var concatIntermediates = function(target,intermediatesList,_callback){
var fname = target+".temp.merged.mpg";
// unescape paths
for(var i=0; i<intermediatesList.length; i++){
intermediatesList[i] = unescapePath(intermediatesList[i]);
}
var command = [
self.ffmpegPath,
[
'-loglevel','panic', //Generetes too much muxing warnings and fills default buffer of exec. This is to ignore them.
'-i', 'concat:"'+intermediatesList.join("|")+'"',
'-c',"copy",
fname
].join(' ')
];
exec(command.join(' '), function(err, stdout, stderr) {
if(err)throw err;
_callback(fname);
});
};
var quantizeConcat = function(concatResult,numFiles,_callback){
var command = [
self.ffmpegPath,
[
'-i', concatResult,
'-qscale:v',numFiles,
targetfile
].join(' ')
];
exec(command.join(' '), function(err, stdout, stderr) {
if(err)throw err;
_callback();
});
}
var deleteIntermediateFiles = function(intermediates){
for(var i=0 ; i<intermediates.length ; i++){
fs.unlinkSync( unescapePath(intermediates[i]));
}
}
var unescapePath = function(path){
var f = path+"";
if(f.indexOf('"')==0)f = f.substring(1);
if(f.lastIndexOf('"')== f.length-1)f = f.substring(0, f.length-1);
return f;
}
if(options.mergeList.length<=0)throw new Error("No file added to be merged");
var mergeList = options.mergeList;
mergeList.unshift(options.inputfile)
var intermediateFiles = [];
async.whilst(function(){
return (mergeList.length != 0);
},function(callback){
makeIntermediateFile(mergeList.shift(),function(createdIntermediateFile){
if(!createdIntermediateFile)throw new Error("Invalid intermediate file");
intermediateFiles.push(createdIntermediateFile);
callback();
})
},function(err){
if(err)throw err;
concatIntermediates(targetfile,intermediateFiles,function(concatResult){
if(!concatResult)throw new Error("Invalid concat result file");
quantizeConcat(concatResult,intermediateFiles.length,function(){
intermediateFiles.push(concatResult); // add concatResult to intermediates list so it can be deleted too.
deleteIntermediateFiles(intermediateFiles);
callback(); // completed;
});
});
});
}
this.writeToStream = function(stream, callback) {
callback = callback || function(){};
if (!this.options._isStreamable) {
this.options.logger.error('selected output format is not streamable');
return callback(null, new Error('selected output format is not streamable'));
}
var self = this;
var options = this.options;
// parse options to command
this._prepare(function(err, meta) {
if (err) {
return callback(null, err);
}
var args = self.buildFfmpegArgs(true, meta);
if (!args instanceof Array) {
return callback(null, args);
}
// write data to stdout
args.push('pipe:1');
// start conversion of file using spawn
var ffmpegProc = self._spawnProcess(args);
if (options.inputstream) {
// pump input stream to stdin
options.inputstream.resume();
options.inputstream.pipe(ffmpegProc.stdin);
options.inputstream.on('error', function(){
options.logger.debug("input stream closed, killing ffmpgeg process");
ffmpegProc.kill();
});
}
//handle timeout if set
var processTimer;
if (options.timeout) {
processTimer = setTimeout(function() {
ffmpegProc.removeAllListeners('exit');
ffmpegProc.kill('SIGKILL');
options.logger.warn('process ran into a timeout (' + options.timeout + 's)');
callback(self.E_PROCESSTIMEOUT, 'timeout');
}, options.timeout * 1000);
}
var stderr = '';
ffmpegProc.stderr.on('data', function(data) {
stderr += data;
if (options.onCodecData) {
self._checkStdErrForCodec(stderr);
}
if (options.onProgress) {
self._getProgressFromStdErr(stderr, meta.durationsec);
}
});
ffmpegProc.stdout.on('data', function(chunk) {
stream.write(chunk);
});
ffmpegProc.on('exit', function(code, signal) {
if (processTimer) {
clearTimeout(processTimer);
}
// close file descriptor on outstream
if(/^[a-z]+:\/\//.test(options.inputfile)) {
return callback(code, stderr);
}
var cb_ = function() {
if (!options.inputstream || !options.inputstream.fd) {
return callback(code, stderr);
}
fs.close(options.inputstream.fd, function() {
callback(code, stderr);
});
};
if (stream.fd) {
return fs.close(stream.fd, cb_);
}
if (stream.end) {
stream.end();
} else {
callback(code, "stream will not be closed");
}
cb_();
});
stream.on("close", function()
{
options.logger.debug("Output stream closed, killing ffmpgeg process");
ffmpegProc.kill();
});
});
};
this.takeScreenshots = function(config, folder, callback) {
callback = callback || function(){};
function _zeroPad(number, len) {
len = len-String(number).length+2;
return new Array(len<0?0:len).join('0')+number;
}
function _renderOutputName(j, offset) {
var result = filename;
if(/%0*i/.test(result)) {
var numlen = String(result.match(/%(0*)i/)[1]).length;
result = result.replace(/%0*i/, _zeroPad(j, numlen));
}
result = result.replace('%s', offset);
result = result.replace('%w', self.options.video.width);
result = result.replace('%h', self.options.video.height);
result = result.replace('%r', self.options.video.width+'x'+self.options.video.height);
result = result.replace('%f', self.options.inputfile);
result = result.replace('%b', self.options.inputfile.substr(0,self.options.inputfile.lastIndexOf('.')));
return result;
}
function _screenShotInternal(callback) {
// get correct dimensions
self._prepare(function(err, meta) {
if (!meta.durationsec) {
var errString = 'meta data contains no duration, aborting screenshot creation';
self.options.logger.warn(errString);
return callback(new Error(errString));
}
// check if all timemarks are inside duration
if (Array.isArray(timemarks)) {
for (var i = 0; i < timemarks.length; i++) {
/* convert percentage to seconds */
if( timemarks[i].indexOf('%') > 0 ) {
timemarks[i] = (parseInt(timemarks[i], 10) / 100) * meta.durationsec;
}
if (parseInt(timemarks[i], 10) > meta.durationsec) {
// remove timemark from array
timemarks.splice(i, 1);
--i;
}
}
// if there are no more timemarks around, add one at end of the file
if (timemarks.length === 0) {
timemarks[0] = (meta.durationsec * 0.9);
}
}
// get positions for screenshots (using duration of file minus 10% to remove fade-in/fade-out)
var secondOffset = (meta.durationsec * 0.9) / screenshotcount;
var donecount = 0;
var series = [];
// reset iterator
var j = 1;
var filenames = [];
// use async helper function to generate all screenshots and
// fire callback just once after work is done
async.until(
function() {
return j > screenshotcount;
},
function(taskcallback) {
var offset;
if (Array.isArray(timemarks)) {
// get timemark for current iteration
offset = timemarks[(j - 1)];
} else {
offset = secondOffset * j;
}
var fname = _renderOutputName(j, offset) + '.jpg';
var target = self.escapedPath(path.join(folder, fname), true);
var input = self.escapedPath(self.options.inputfile, true);
// build screenshot command
var command = [
self.ffmpegPath,
[
'-ss', Math.floor(offset * 100) / 100,
'-i', input,
'-vcodec', 'mjpeg',
'-vframes', '1',
'-an',
'-f', 'rawvideo',
'-s', self.options.video.size,
'-y', target
].join(' ')
];
j++;
// only set niceness if running on a non-windows platform
if (self.options.hasOwnProperty('_nice.level') && !os.match(/win(32|64)/)) {
// execute ffmpeg through nice
command.unshift('nice -n', self.options._nice.level||0);
}
exec(command.join(' '), taskcallback);
filenames.push(fname);
},
function(err) {
callback(err, filenames);
}
);
});
}
var timemarks, screenshotcount, filename;
if (typeof config === 'object') {
// use json object as config
if (config.count) {
screenshotcount = config.count;
}
if (config.timemarks) {
timemarks = config.timemarks;
}
} else {
// assume screenshot count as parameter
screenshotcount = config;
timemarks = null;
}
if (!this.options.video.size) {
this.options.logger.warn("set size of thumbnails using 'withSize' method");
callback(new Error("set size of thumbnails using 'withSize' method"));
}
filename = config.filename || 'tn_%ss';
if(!/%0*i/.test(filename) && Array.isArray(timemarks) && timemarks.length > 1 ) {
// if there are multiple timemarks but no %i in filename add one
// so we won't overwrite the same thumbnail with each timemark
filename += '_%i';
}
folder = folder || '.';
var self = this;
// WORKAROUND: exists will be moved from path to fs with node v0.7
var check = fs.exists;
if (!check) {
check = path.exists;
}
// check target folder
check(folder, function(exists) {
if (!exists) {
fs.mkdir(folder, '0755', function(err) {
if (err !== null) {
callback(err);
} else {
_screenShotInternal(callback);
}
});
} else {
_screenShotInternal(callback);
}
});
};
this._getProgressFromStdErr = function(stderrString, totalDurationSec) {
// get last stderr line
var lastLine = stderrString.split(/\r\n|\r|\n/g);
var ll = lastLine[lastLine.length - 2];
var progress;
if (ll) {
progress = ll.split(/frame=([0-9\s]+)fps=([0-9\.\s]+)q=([0-9\.\s]+)(L?)size=([0-9\s]+)kB time=(([0-9]{2}):([0-9]{2}):([0-9]{2}).([0-9]{2})) bitrate=([0-9\.\s]+)kbits/ig);
}
if (progress && progress.length > 10) {
// build progress report object
var ret = {
frames: parseInt(progress[1], 10),
currentFps: parseInt(progress[2], 10),
currentKbps: parseFloat(progress[10]),
targetSize: parseInt(progress[5], 10),
timemark: progress[6]
};
// calculate percent progress using duration
if (totalDurationSec && totalDurationSec > 0) {
ret.percent = (this.ffmpegTimemarkToSeconds(ret.timemark) / totalDurationSec) * 100;
}
this.options.onProgress(ret);
}
};
this._checkStdErrForCodec = function(stderrString) {
var format= /Input #[0-9]+, ([^ ]+),/.exec(stderrString);
var dur = /Duration\: ([^,]+)/.exec(stderrString);
var audio = /Audio\: (.*)/.exec(stderrString);
var video = /Video\: (.*)/.exec(stderrString);
var codecObject = { format: '', audio: '', video: '', duration: '' };
if (format && format.length > 1) {
codecObject.format = format[1];
}
if (dur && dur.length > 1) {
codecObject.duration = dur[1];
}
if (audio && audio.length > 1) {
audio = audio[1].split(', ');
codecObject.audio = audio[0];
codecObject.audio_details = audio;
}
if (video && video.length > 1) {
video = video[1].split(', ');
codecObject.video = video[0];
codecObject.video_details = video;
}
var codecInfoPassed = /Press (\[q\]|ctrl-c) to stop/.test(stderrString);
if (codecInfoPassed) {
this.options.onCodecData(codecObject);
this.options.onCodecData = null;
}
};
this._spawnProcess = function(args, options) {
var retProc = spawn(this.ffmpegPath, args, options);
// only re-nice if running on a non-windows platform
if (this.options.hasOwnProperty('_nice.level') && !os.match(/win(32|64)/)) {
var niceLevel = this.options._nice.level || 0;
if (niceLevel > 0) {
niceLevel = '+' + niceLevel;
}
// renice the spawned process without waiting for callback
var self = this;
var command = [
'renice -n', niceLevel,
'-p', retProc.pid
].join(' ');
exec(command, function(err, stderr, stdout) {
if (!err) {
self.options.logger.info('successfully reniced process ' + retProc.pid + ' to ' + niceLevel + ' niceness!');
}
});
}
if (retProc.stderr) {
retProc.stderr.setEncoding('utf8');
}
return retProc;
};
this.buildFfmpegArgs = function(overrideOutputCheck, meta) {
var args = [];
// add startoffset and duration
if (this.options.starttime) {
args.push('-ss', this.options.starttime);
}
if (this.options.video.loop) {
args.push('-loop', 1);
}
// add input format
if (this.options.fromFormat) {
args.push('-f', this.options.fromFormat);
}
// add input file (if using fs mode)
if (this.options.inputfile && !this.options.inputstream && !this.options.inputlive) {
// add input file fps
if (this.options.video.fpsInput) {
args.push('-r', this.options.video.fpsInput);
}
if (/^[a-z]+:\/\//.test(this.options.inputfile)) {
args.push('-i', this.options.inputfile.replace(' ', '%20'));
} else if (/%\d*d/.test(this.options.inputfile)) { // multi-file format - http://ffmpeg.org/ffmpeg.html#image2-1
args.push('-i', this.options.inputfile.replace(' ', '\ '));
} else {
var fstats = fs.statSync(this.options.inputfile);
if (fstats.isFile()) {
// fix for spawn call with path containing spaces and quotes
args.push('-i', this.options.inputfile.replace(/ /g, "\ ")
.replace(/'/g, "\'")
.replace(/"/g, "\""));
} else {
this.options.logger.error('input file is not readable');
throw new Error('input file is not readable');
}
}
// check for input stream
} else if (this.options.inputstream) {
// push args to make ffmpeg read from stdin
args.push('-i', '-');
} else if (this.options.inputlive){
//Check if input URI
if(/^[a-z]+:\/\//.test(this.options.inputfile)) {
// add input with live flag
args.push('-i', this.options.inputfile.replace(' ', '%20')+' live=1');
}else {
this.options.logger.error('live input URI is not valid');
throw new Error('live input URI is not valid');
}
}
if (this.options.otherInputs) {
if (this.options.otherInputs.length > 0) {
this.options.otherInputs.forEach(function(el) {
args.push('-i', el);
});
}
}
if (this.options.duration) {
args.push('-t', this.options.duration);
}
if (this.options.video.framecount) {
args.push('-vframes', this.options.video.framecount);
}
// add format
if (this.options.format) {
args.push('-f', this.options.format);
}
// add video options
if (this.options.video.skip) {
// skip video stream completely (#45)
args.push('-vn');
} else {
if (this.options.video.bitrate) {
args.push('-b', this.options.video.bitrate + 'k');
if (this.options._useConstantVideoBitrate) {
// add parameters to ensure constant bitrate encoding
args.push('-maxrate', this.options.video.bitrate + 'k');
args.push('-minrate', this.options.video.bitrate + 'k');
args.push('-bufsize', '3M');
}
}
if (this.options.video.codec) {
args.push('-vcodec', this.options.video.codec);
}
if (this.options.video.fps) {
args.push('-r', this.options.video.fps);
}
if (this.options.video.aspect) {
args.push('-aspect', this.options.video.aspect);
}
}
// add video options
if (this.options.audio.skip) {
// skip audio stream completely (#45)
args.push('-an');
} else {
if (this.options.audio.bitrate) {
args.push('-ab', this.options.audio.bitrate + 'k');
}
if (this.options.audio.channels) {
args.push('-ac', this.options.audio.channels);
}
if (this.options.audio.codec) {
args.push('-acodec', this.options.audio.codec);
}
if (this.options.audio.frequency) {
args.push('-ar', this.options.audio.frequency);
}
if (this.options.audio.quality || this.options.audio.quality === 0) {
args.push('-aq', this.options.audio.quality);
}
}
// add additional options
if (this.options.additional) {
if (this.options.additional.length > 0) {
this.options.additional.forEach(function(el) {
args.push(el);
});
}
}
if (this.options.video.pad && !this.options.video.skip) {
// we have padding arguments, push
if (this.atLeastVersion(meta.ffmpegversion, '0.7')) {
// padding is not supported ffmpeg < 0.7 (only using legacy commands which were replaced by vfilter calls)
args.push('-vf');
args.push('pad=' + this.options.video.pad.w +
':' + this.options.video.pad.h +
':' + this.options.video.pad.x +
':' + this.options.video.pad.y +
':' + this.options.video.padcolor);
} else {
return new Error("Your ffmpeg version " + meta.ffmpegversion + " does not support padding");
}
}
// add size and output file
if (this.options.video.size && !this.options.video.skip) {
args.push('-s', this.options.video.size);
}
// add output file fps
if (this.options.video.fpsOutput) {
args.push('-r', this.options.video.fpsOutput);
}
if (this.options.outputfile) {
var target = this.escapedPath(this.options.outputfile, false);
if (!os.match(/win(32|64)/)) {
args.push('-y', target.replace(' ', '\\ '));
} else {
args.push('-y', target);
}
} else {
if (!overrideOutputCheck) {
this.options.logger.error('no outputfile specified');
}
}
return args;
};
};
| opentune/opentune | node_modules/liquid-ffmpeg/lib/processor.js | JavaScript | gpl-2.0 | 23,995 |
// SmoothScroll v1.2.1
// Licensed under the terms of the MIT license.
// People involved
// - Balazs Galambosi (maintainer)
// - Patrick Brunner (original idea)
// - Michael Herf (Pulse Algorithm)
// Scroll Variables (tweakable)
var defaultOptions = {
// Scrolling Core
frameRate : 150, // [Hz]
animationTime : 600, // [px]
stepSize : 120, // [px]
// Pulse (less tweakable)
// ratio of "tail" to "acceleration"
pulseAlgorithm : true,
pulseScale : 8,
pulseNormalize : 1,
// Acceleration
accelerationDelta : 20, // 20
accelerationMax : 1, // 1
// Keyboard Settings
keyboardSupport : true, // option
arrowScroll : 50, // [px]
// Other
touchpadSupport : true,
fixedBackground : true,
excluded : ""
};
var options = defaultOptions;
// Other Variables
var isExcluded = false;
var isFrame = false;
var direction = { x: 0, y: 0 };
var initDone = false;
var root = document.documentElement;
var activeElement;
var observer;
var deltaBuffer = [ 120, 120, 120 ];
var key = { left: 37, up: 38, right: 39, down: 40, spacebar: 32,
pageup: 33, pagedown: 34, end: 35, home: 36 };
/***********************************************
* SETTINGS
***********************************************/
if(typeof(chrome) !== 'undefined' && typeof(chrome.storage) !== 'undefined') {
chrome.storage.sync.get(defaultOptions, function (syncedOptions) {
options = syncedOptions;
// it seems that sometimes settings come late
// and we need to test again for excluded pages
initTest();
});
}
/***********************************************
* INITIALIZE
***********************************************/
/**
* Tests if smooth scrolling is allowed. Shuts down everything if not.
*/
function initTest() {
var disableKeyboard = false;
// disable keys for google reader (spacebar conflict)
if (document.URL.indexOf("google.com/reader/view") > -1) {
disableKeyboard = true;
}
// disable everything if the page is blacklisted
if (options.excluded) {
var domains = options.excluded.split(/[,\n] ?/);
domains.push("mail.google.com"); // exclude Gmail for now
for (var i = domains.length; i--;) {
if (document.URL.indexOf(domains[i]) > -1) {
observer && observer.disconnect();
removeEvent("mousewheel", wheel);
disableKeyboard = true;
isExcluded = true;
break;
}
}
}
// disable keyboard support if anything above requested it
if (disableKeyboard) {
removeEvent("keydown", keydown);
}
if (options.keyboardSupport && !disableKeyboard) {
addEvent("keydown", keydown);
}
}
/**
* Sets up scrolls array, determines if frames are involved.
*/
function init() {
if (!document.body) return;
var body = document.body;
var html = document.documentElement;
var windowHeight = window.innerHeight;
var scrollHeight = body.scrollHeight;
// check compat mode for root element
root = (document.compatMode.indexOf('CSS') >= 0) ? html : body;
activeElement = body;
initTest();
initDone = true;
// Checks if this script is running in a frame
if (top != self) {
isFrame = true;
}
/**
* This fixes a bug where the areas left and right to
* the content does not trigger the onmousewheel event
* on some pages. e.g.: html, body { height: 100% }
*/
else if (scrollHeight > windowHeight &&
(body.offsetHeight <= windowHeight ||
html.offsetHeight <= windowHeight)) {
// DOMChange (throttle): fix height
var pending = false;
var refresh = function () {
if (!pending && html.scrollHeight != document.height) {
pending = true; // add a new pending action
setTimeout(function () {
html.style.height = document.height + 'px';
pending = false;
}, 500); // act rarely to stay fast
}
};
html.style.height = 'auto';
setTimeout(refresh, 10);
var config = {
attributes: true,
childList: true,
characterData: false
};
observer = new MutationObserver(refresh);
observer.observe(body, config);
// clearfix
if (root.offsetHeight <= windowHeight) {
var underlay = document.createElement("div");
underlay.style.clear = "both";
body.appendChild(underlay);
}
}
// gmail performance fix
if (document.URL.indexOf("mail.google.com") > -1) {
var s = document.createElement("style");
s.innerHTML = ".iu { visibility: hidden }";
(document.getElementsByTagName("head")[0] || html).appendChild(s);
}
// facebook better home timeline performance
// all the HTML resized images make rendering CPU intensive
else if (document.URL.indexOf("www.facebook.com") > -1) {
var home_stream = document.getElementById("home_stream");
home_stream && (home_stream.style.webkitTransform = "translateZ(0)");
}
// disable fixed background
if (!options.fixedBackground && !isExcluded) {
body.style.backgroundAttachment = "scroll";
html.style.backgroundAttachment = "scroll";
}
}
/************************************************
* SCROLLING
************************************************/
var que = [];
var pending = false;
var lastScroll = +new Date;
/**
* Pushes scroll actions to the scrolling queue.
*/
function scrollArray(elem, left, top, delay) {
delay || (delay = 1000);
directionCheck(left, top);
if (options.accelerationMax != 1) {
var now = +new Date;
var elapsed = now - lastScroll;
if (elapsed < options.accelerationDelta) {
var factor = (1 + (30 / elapsed)) / 2;
if (factor > 1) {
factor = Math.min(factor, options.accelerationMax);
left *= factor;
top *= factor;
}
}
lastScroll = +new Date;
}
// push a scroll command
que.push({
x: left,
y: top,
lastX: (left < 0) ? 0.99 : -0.99,
lastY: (top < 0) ? 0.99 : -0.99,
start: +new Date
});
// don't act if there's a pending queue
if (pending) {
return;
}
var scrollWindow = (elem === document.body);
var step = function (time) {
var now = +new Date;
var scrollX = 0;
var scrollY = 0;
for (var i = 0; i < que.length; i++) {
var item = que[i];
var elapsed = now - item.start;
var finished = (elapsed >= options.animationTime);
// scroll position: [0, 1]
var position = (finished) ? 1 : elapsed / options.animationTime;
// easing [optional]
if (options.pulseAlgorithm) {
position = pulse(position);
}
// only need the difference
var x = (item.x * position - item.lastX) >> 0;
var y = (item.y * position - item.lastY) >> 0;
// add this to the total scrolling
scrollX += x;
scrollY += y;
// update last values
item.lastX += x;
item.lastY += y;
// delete and step back if it's over
if (finished) {
que.splice(i, 1); i--;
}
}
// scroll left and top
if (scrollWindow) {
window.scrollBy(scrollX, scrollY);
}
else {
if (scrollX) elem.scrollLeft += scrollX;
if (scrollY) elem.scrollTop += scrollY;
}
// clean up if there's nothing left to do
if (!left && !top) {
que = [];
}
if (que.length) {
requestFrame(step, elem, (delay / options.frameRate + 1));
} else {
pending = false;
}
};
// start a new queue of actions
requestFrame(step, elem, 0);
pending = true;
}
/***********************************************
* EVENTS
***********************************************/
/**
* Mouse wheel handler.
* @param {Object} event
*/
function wheel(event) {
if (!initDone) {
init();
}
var target = event.target;
var overflowing = overflowingAncestor(target);
// use default if there's no overflowing
// element or default action is prevented
if (!overflowing || event.defaultPrevented ||
isNodeName(activeElement, "embed") ||
(isNodeName(target, "embed") && /\.pdf/i.test(target.src))) {
return true;
}
var deltaX = event.wheelDeltaX || 0;
var deltaY = event.wheelDeltaY || 0;
// use wheelDelta if deltaX/Y is not available
if (!deltaX && !deltaY) {
deltaY = event.wheelDelta || 0;
}
// check if it's a touchpad scroll that should be ignored
if (!options.touchpadSupport && isTouchpad(deltaY)) {
return true;
}
// scale by step size
// delta is 120 most of the time
// synaptics seems to send 1 sometimes
if (Math.abs(deltaX) > 1.2) {
deltaX *= options.stepSize / 120;
}
if (Math.abs(deltaY) > 1.2) {
deltaY *= options.stepSize / 120;
}
scrollArray(overflowing, -deltaX, -deltaY);
event.preventDefault();
}
/**
* Keydown event handler.
* @param {Object} event
*/
function keydown(event) {
var target = event.target;
var modifier = event.ctrlKey || event.altKey || event.metaKey ||
(event.shiftKey && event.keyCode !== key.spacebar);
// do nothing if user is editing text
// or using a modifier key (except shift)
// or in a dropdown
if ( /input|textarea|select|embed/i.test(target.nodeName) ||
target.isContentEditable ||
event.defaultPrevented ||
modifier ) {
return true;
}
// spacebar should trigger button press
if (isNodeName(target, "button") &&
event.keyCode === key.spacebar) {
return true;
}
var shift, x = 0, y = 0;
var elem = overflowingAncestor(activeElement);
var clientHeight = elem.clientHeight;
if (elem == document.body) {
clientHeight = window.innerHeight;
}
switch (event.keyCode) {
case key.up:
y = -options.arrowScroll;
break;
case key.down:
y = options.arrowScroll;
break;
case key.spacebar: // (+ shift)
shift = event.shiftKey ? 1 : -1;
y = -shift * clientHeight * 0.9;
break;
case key.pageup:
y = -clientHeight * 0.9;
break;
case key.pagedown:
y = clientHeight * 0.9;
break;
case key.home:
y = -elem.scrollTop;
break;
case key.end:
var damt = elem.scrollHeight - elem.scrollTop - clientHeight;
y = (damt > 0) ? damt+10 : 0;
break;
case key.left:
x = -options.arrowScroll;
break;
case key.right:
x = options.arrowScroll;
break;
default:
return true; // a key we don't care about
}
scrollArray(elem, x, y);
event.preventDefault();
}
/**
* Mousedown event only for updating activeElement
*/
function mousedown(event) {
activeElement = event.target;
}
/***********************************************
* OVERFLOW
***********************************************/
var cache = {}; // cleared out every once in while
setInterval(function () { cache = {}; }, 10 * 1000);
var uniqueID = (function () {
var i = 0;
return function (el) {
return el.uniqueID || (el.uniqueID = i++);
};
})();
function setCache(elems, overflowing) {
for (var i = elems.length; i--;)
cache[uniqueID(elems[i])] = overflowing;
return overflowing;
}
function overflowingAncestor(el) {
var elems = [];
var rootScrollHeight = root.scrollHeight;
do {
var cached = cache[uniqueID(el)];
if (cached) {
return setCache(elems, cached);
}
elems.push(el);
if (rootScrollHeight === el.scrollHeight) {
if (!isFrame || root.clientHeight + 10 < rootScrollHeight) {
return setCache(elems, document.body); // scrolling root in WebKit
}
} else if (el.clientHeight + 10 < el.scrollHeight) {
overflow = getComputedStyle(el, "").getPropertyValue("overflow-y");
if (overflow === "scroll" || overflow === "auto") {
return setCache(elems, el);
}
}
} while (el = el.parentNode);
}
/***********************************************
* HELPERS
***********************************************/
function addEvent(type, fn, bubble) {
window.addEventListener(type, fn, (bubble||false));
}
function removeEvent(type, fn, bubble) {
window.removeEventListener(type, fn, (bubble||false));
}
function isNodeName(el, tag) {
return (el.nodeName||"").toLowerCase() === tag.toLowerCase();
}
function directionCheck(x, y) {
x = (x > 0) ? 1 : -1;
y = (y > 0) ? 1 : -1;
if (direction.x !== x || direction.y !== y) {
direction.x = x;
direction.y = y;
que = [];
lastScroll = 0;
}
}
var deltaBufferTimer;
function isTouchpad(deltaY) {
if (!deltaY) return;
deltaY = Math.abs(deltaY)
deltaBuffer.push(deltaY);
deltaBuffer.shift();
clearTimeout(deltaBufferTimer);
deltaBufferTimer = setTimeout(function () {
chrome.storage.local.set({ deltaBuffer: deltaBuffer });
}, 1000);
var allEquals = (deltaBuffer[0] == deltaBuffer[1] &&
deltaBuffer[1] == deltaBuffer[2]);
var allDivisable = (isDivisible(deltaBuffer[0], 120) &&
isDivisible(deltaBuffer[1], 120) &&
isDivisible(deltaBuffer[2], 120));
return !(allEquals || allDivisable);
}
function isDivisible(n, divisor) {
return (Math.floor(n / divisor) == n / divisor);
}
if(typeof(chrome) !== 'undefined' && typeof(chrome.storage) !== 'undefined') {
chrome.storage.local.get('deltaBuffer', function (stored) {
if (stored.deltaBuffer) {
deltaBuffer = stored.deltaBuffer;
}
});
}
var requestFrame = (function () {
return window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
function (callback, element, delay) {
window.setTimeout(callback, delay || (1000/60));
};
})();
var MutationObserver = window.MutationObserver || window.WebKitMutationObserver;
/***********************************************
* PULSE
***********************************************/
/**
* Viscous fluid with a pulse for part and decay for the rest.
* - Applies a fixed force over an interval (a damped acceleration), and
* - Lets the exponential bleed away the velocity over a longer interval
* - Michael Herf, http://stereopsis.com/stopping/
*/
function pulse_(x) {
var val, start, expx;
// test
x = x * options.pulseScale;
if (x < 1) { // acceleartion
val = x - (1 - Math.exp(-x));
} else { // tail
// the previous animation ended here:
start = Math.exp(-1);
// simple viscous drag
x -= 1;
expx = 1 - Math.exp(-x);
val = start + (expx * (1 - start));
}
return val * options.pulseNormalize;
}
function pulse(x) {
if (x >= 1) return 1;
if (x <= 0) return 0;
if (options.pulseNormalize == 1) {
options.pulseNormalize /= pulse_(1);
}
return pulse_(x);
}
addEvent("mousedown", mousedown);
addEvent("mousewheel", wheel);
addEvent("load", init); | davidHuanghw/david_blog | wp-content/themes/marroco/assets/js/vendors/jquery.smooth-scroll/jquery.smooth-scroll.js | JavaScript | gpl-2.0 | 16,306 |
(function ($) {
Drupal.behaviors.initColorbox = {
attach: function (context, settings) {
if (!$.isFunction($.colorbox)) {
return;
}
$('a, area, input', context)
.filter('.colorbox')
.once('init-colorbox')
.colorbox(settings.colorbox);
}
};
{
$(document).bind('cbox_complete', function () {
Drupal.attachBehaviors('#cboxLoadedContent');
});
}
})(jQuery);
;
(function ($) {
Drupal.behaviors.initColorboxDefaultStyle = {
attach: function (context, settings) {
$(document).bind('cbox_complete', function () {
// Only run if there is a title.
if ($('#cboxTitle:empty', context).length == false) {
setTimeout(function () { $('#cboxTitle', context).slideUp() }, 1500);
$('#cboxLoadedContent img', context).bind('mouseover', function () {
$('#cboxTitle', context).slideDown();
});
$('#cboxOverlay', context).bind('mouseover', function () {
$('#cboxTitle', context).slideUp();
});
}
else {
$('#cboxTitle', context).hide();
}
});
}
};
})(jQuery);
;
(function ($) {
Drupal.behaviors.initColorboxLoad = {
attach: function (context, settings) {
if (!$.isFunction($.colorbox)) {
return;
}
$.urlParams = function (url) {
var p = {},
e,
a = /\+/g, // Regex for replacing addition symbol with a space
r = /([^&=]+)=?([^&]*)/g,
d = function (s) { return decodeURIComponent(s.replace(a, ' ')); },
q = url.split('?');
while (e = r.exec(q[1])) {
e[1] = d(e[1]);
e[2] = d(e[2]);
switch (e[2].toLowerCase()) {
case 'true':
case 'yes':
e[2] = true;
break;
case 'false':
case 'no':
e[2] = false;
break;
}
if (e[1] == 'width') { e[1] = 'innerWidth'; }
if (e[1] == 'height') { e[1] = 'innerHeight'; }
p[e[1]] = e[2];
}
return p;
};
$('a, area, input', context)
.filter('.colorbox-load')
.once('init-colorbox-load', function () {
var params = $.urlParams($(this).attr('href'));
$(this).colorbox($.extend({}, settings.colorbox, params));
});
}
};
})(jQuery);
;
(function ($) {
Drupal.behaviors.initColorboxInline = {
attach: function (context, settings) {
if (!$.isFunction($.colorbox)) {
return;
}
$.urlParam = function(name, url){
if (name == 'fragment') {
var results = new RegExp('(#[^&#]*)').exec(url);
}
else {
var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(url);
}
if (!results) { return ''; }
return results[1] || '';
};
$('a, area, input', context).filter('.colorbox-inline').once('init-colorbox-inline').colorbox({
transition:settings.colorbox.transition,
speed:settings.colorbox.speed,
opacity:settings.colorbox.opacity,
slideshow:settings.colorbox.slideshow,
slideshowAuto:settings.colorbox.slideshowAuto,
slideshowSpeed:settings.colorbox.slideshowSpeed,
slideshowStart:settings.colorbox.slideshowStart,
slideshowStop:settings.colorbox.slideshowStop,
current:settings.colorbox.current,
previous:settings.colorbox.previous,
next:settings.colorbox.next,
close:settings.colorbox.close,
overlayClose:settings.colorbox.overlayClose,
maxWidth:settings.colorbox.maxWidth,
maxHeight:settings.colorbox.maxHeight,
innerWidth:function(){
return $.urlParam('width', $(this).attr('href'));
},
innerHeight:function(){
return $.urlParam('height', $(this).attr('href'));
},
title:function(){
return decodeURIComponent($.urlParam('title', $(this).attr('href')));
},
iframe:function(){
return $.urlParam('iframe', $(this).attr('href'));
},
inline:function(){
return $.urlParam('inline', $(this).attr('href'));
},
href:function(){
return $.urlParam('fragment', $(this).attr('href'));
}
});
}
};
})(jQuery);
;
(function ($) {
/**
* A progressbar object. Initialized with the given id. Must be inserted into
* the DOM afterwards through progressBar.element.
*
* method is the function which will perform the HTTP request to get the
* progress bar state. Either "GET" or "POST".
*
* e.g. pb = new progressBar('myProgressBar');
* some_element.appendChild(pb.element);
*/
Drupal.progressBar = function (id, updateCallback, method, errorCallback) {
var pb = this;
this.id = id;
this.method = method || 'GET';
this.updateCallback = updateCallback;
this.errorCallback = errorCallback;
// The WAI-ARIA setting aria-live="polite" will announce changes after users
// have completed their current activity and not interrupt the screen reader.
this.element = $('<div class="progress" aria-live="polite"></div>').attr('id', id);
this.element.html('<div class="bar"><div class="filled"></div></div>' +
'<div class="percentage"></div>' +
'<div class="message"> </div>');
};
/**
* Set the percentage and status message for the progressbar.
*/
Drupal.progressBar.prototype.setProgress = function (percentage, message) {
if (percentage >= 0 && percentage <= 100) {
$('div.filled', this.element).css('width', percentage + '%');
$('div.percentage', this.element).html(percentage + '%');
}
$('div.message', this.element).html(message);
if (this.updateCallback) {
this.updateCallback(percentage, message, this);
}
};
/**
* Start monitoring progress via Ajax.
*/
Drupal.progressBar.prototype.startMonitoring = function (uri, delay) {
this.delay = delay;
this.uri = uri;
this.sendPing();
};
/**
* Stop monitoring progress via Ajax.
*/
Drupal.progressBar.prototype.stopMonitoring = function () {
clearTimeout(this.timer);
// This allows monitoring to be stopped from within the callback.
this.uri = null;
};
/**
* Request progress data from server.
*/
Drupal.progressBar.prototype.sendPing = function () {
if (this.timer) {
clearTimeout(this.timer);
}
if (this.uri) {
var pb = this;
// When doing a post request, you need non-null data. Otherwise a
// HTTP 411 or HTTP 406 (with Apache mod_security) error may result.
$.ajax({
type: this.method,
url: this.uri,
data: '',
dataType: 'json',
success: function (progress) {
// Display errors.
if (progress.status == 0) {
pb.displayError(progress.data);
return;
}
// Update display.
pb.setProgress(progress.percentage, progress.message);
// Schedule next timer.
pb.timer = setTimeout(function () { pb.sendPing(); }, pb.delay);
},
error: function (xmlhttp) {
pb.displayError(Drupal.ajaxError(xmlhttp, pb.uri));
}
});
}
};
/**
* Display errors on the page.
*/
Drupal.progressBar.prototype.displayError = function (string) {
var error = $('<div class="messages error"></div>').html(string);
$(this.element).before(error).hide();
if (this.errorCallback) {
this.errorCallback(this);
}
};
})(jQuery);
;
/**
* @file
*
* Implement a modal form.
*
* @see modal.inc for documentation.
*
* This javascript relies on the CTools ajax responder.
*/
(function ($) {
// Make sure our objects are defined.
Drupal.CTools = Drupal.CTools || {};
Drupal.CTools.Modal = Drupal.CTools.Modal || {};
/**
* Display the modal
*
* @todo -- document the settings.
*/
Drupal.CTools.Modal.show = function(choice) {
var opts = {};
if (choice && typeof choice == 'string' && Drupal.settings[choice]) {
// This notation guarantees we are actually copying it.
$.extend(true, opts, Drupal.settings[choice]);
}
else if (choice) {
$.extend(true, opts, choice);
}
var defaults = {
modalTheme: 'CToolsModalDialog',
throbberTheme: 'CToolsModalThrobber',
animation: 'show',
animationSpeed: 'fast',
modalSize: {
type: 'scale',
width: .8,
height: .8,
addWidth: 0,
addHeight: 0,
// How much to remove from the inner content to make space for the
// theming.
contentRight: 25,
contentBottom: 45
},
modalOptions: {
opacity: .55,
background: '#fff'
}
};
var settings = {};
$.extend(true, settings, defaults, Drupal.settings.CToolsModal, opts);
if (Drupal.CTools.Modal.currentSettings && Drupal.CTools.Modal.currentSettings != settings) {
Drupal.CTools.Modal.modal.remove();
Drupal.CTools.Modal.modal = null;
}
Drupal.CTools.Modal.currentSettings = settings;
var resize = function(e) {
// When creating the modal, it actually exists only in a theoretical
// place that is not in the DOM. But once the modal exists, it is in the
// DOM so the context must be set appropriately.
var context = e ? document : Drupal.CTools.Modal.modal;
if (Drupal.CTools.Modal.currentSettings.modalSize.type == 'scale') {
var width = $(window).width() * Drupal.CTools.Modal.currentSettings.modalSize.width;
var height = $(window).height() * Drupal.CTools.Modal.currentSettings.modalSize.height;
}
else {
var width = Drupal.CTools.Modal.currentSettings.modalSize.width;
var height = Drupal.CTools.Modal.currentSettings.modalSize.height;
}
// Use the additionol pixels for creating the width and height.
$('div.ctools-modal-content', context).css({
'width': width + Drupal.CTools.Modal.currentSettings.modalSize.addWidth + 'px',
'height': height + Drupal.CTools.Modal.currentSettings.modalSize.addHeight + 'px'
});
$('div.ctools-modal-content .modal-content', context).css({
'width': (width - Drupal.CTools.Modal.currentSettings.modalSize.contentRight) + 'px',
'height': (height - Drupal.CTools.Modal.currentSettings.modalSize.contentBottom) + 'px'
});
}
if (!Drupal.CTools.Modal.modal) {
Drupal.CTools.Modal.modal = $(Drupal.theme(settings.modalTheme));
if (settings.modalSize.type == 'scale') {
$(window).bind('resize', resize);
}
}
resize();
$('span.modal-title', Drupal.CTools.Modal.modal).html(Drupal.CTools.Modal.currentSettings.loadingText);
Drupal.CTools.Modal.modalContent(Drupal.CTools.Modal.modal, settings.modalOptions, settings.animation, settings.animationSpeed);
$('#modalContent .modal-content').html(Drupal.theme(settings.throbberTheme));
};
/**
* Hide the modal
*/
Drupal.CTools.Modal.dismiss = function() {
if (Drupal.CTools.Modal.modal) {
Drupal.CTools.Modal.unmodalContent(Drupal.CTools.Modal.modal);
}
};
/**
* Provide the HTML to create the modal dialog.
*/
Drupal.theme.prototype.CToolsModalDialog = function () {
var html = ''
html += ' <div id="ctools-modal">'
html += ' <div class="ctools-modal-content">' // panels-modal-content
html += ' <div class="modal-header">';
html += ' <a class="close" href="#">';
html += Drupal.CTools.Modal.currentSettings.closeText + Drupal.CTools.Modal.currentSettings.closeImage;
html += ' </a>';
html += ' <span id="modal-title" class="modal-title"> </span>';
html += ' </div>';
html += ' <div id="modal-content" class="modal-content">';
html += ' </div>';
html += ' </div>';
html += ' </div>';
return html;
}
/**
* Provide the HTML to create the throbber.
*/
Drupal.theme.prototype.CToolsModalThrobber = function () {
var html = '';
html += ' <div id="modal-throbber">';
html += ' <div class="modal-throbber-wrapper">';
html += Drupal.CTools.Modal.currentSettings.throbber;
html += ' </div>';
html += ' </div>';
return html;
};
/**
* Figure out what settings string to use to display a modal.
*/
Drupal.CTools.Modal.getSettings = function (object) {
var match = $(object).attr('class').match(/ctools-modal-(\S+)/);
if (match) {
return match[1];
}
}
/**
* Click function for modals that can be cached.
*/
Drupal.CTools.Modal.clickAjaxCacheLink = function () {
Drupal.CTools.Modal.show(Drupal.CTools.Modal.getSettings(this));
return Drupal.CTools.AJAX.clickAJAXCacheLink.apply(this);
};
/**
* Handler to prepare the modal for the response
*/
Drupal.CTools.Modal.clickAjaxLink = function () {
Drupal.CTools.Modal.show(Drupal.CTools.Modal.getSettings(this));
return false;
};
/**
* Submit responder to do an AJAX submit on all modal forms.
*/
Drupal.CTools.Modal.submitAjaxForm = function(e) {
var $form = $(this);
var url = $form.attr('action');
setTimeout(function() { Drupal.CTools.AJAX.ajaxSubmit($form, url); }, 1);
return false;
}
/**
* Bind links that will open modals to the appropriate function.
*/
Drupal.behaviors.ZZCToolsModal = {
attach: function(context) {
// Bind links
// Note that doing so in this order means that the two classes can be
// used together safely.
/*
* @todo remimplement the warm caching feature
$('a.ctools-use-modal-cache', context).once('ctools-use-modal', function() {
$(this).click(Drupal.CTools.Modal.clickAjaxCacheLink);
Drupal.CTools.AJAX.warmCache.apply(this);
});
*/
$('area.ctools-use-modal, a.ctools-use-modal', context).once('ctools-use-modal', function() {
var $this = $(this);
$this.click(Drupal.CTools.Modal.clickAjaxLink);
// Create a drupal ajax object
var element_settings = {};
if ($this.attr('href')) {
element_settings.url = $this.attr('href');
element_settings.event = 'click';
element_settings.progress = { type: 'throbber' };
}
var base = $this.attr('href');
Drupal.ajax[base] = new Drupal.ajax(base, this, element_settings);
});
// Bind buttons
$('input.ctools-use-modal, button.ctools-use-modal', context).once('ctools-use-modal', function() {
var $this = $(this);
$this.click(Drupal.CTools.Modal.clickAjaxLink);
var button = this;
var element_settings = {};
// AJAX submits specified in this manner automatically submit to the
// normal form action.
element_settings.url = Drupal.CTools.Modal.findURL(this);
element_settings.event = 'click';
var base = $this.attr('id');
Drupal.ajax[base] = new Drupal.ajax(base, this, element_settings);
// Make sure changes to settings are reflected in the URL.
$('.' + $(button).attr('id') + '-url').change(function() {
Drupal.ajax[base].options.url = Drupal.CTools.Modal.findURL(button);
});
});
// Bind our custom event to the form submit
$('#modal-content form', context).once('ctools-use-modal', function() {
var $this = $(this);
var element_settings = {};
element_settings.url = $this.attr('action');
element_settings.event = 'submit';
element_settings.progress = { 'type': 'throbber' }
var base = $this.attr('id');
Drupal.ajax[base] = new Drupal.ajax(base, this, element_settings);
Drupal.ajax[base].form = $this;
$('input[type=submit], button', this).click(function(event) {
Drupal.ajax[base].element = this;
this.form.clk = this;
// An empty event means we were triggered via .click() and
// in jquery 1.4 this won't trigger a submit.
if (event.bubbles == undefined) {
$(this.form).trigger('submit');
return false;
}
});
});
// Bind a click handler to allow elements with the 'ctools-close-modal'
// class to close the modal.
$('.ctools-close-modal', context).once('ctools-close-modal')
.click(function() {
Drupal.CTools.Modal.dismiss();
return false;
});
}
};
// The following are implementations of AJAX responder commands.
/**
* AJAX responder command to place HTML within the modal.
*/
Drupal.CTools.Modal.modal_display = function(ajax, response, status) {
if ($('#modalContent').length == 0) {
Drupal.CTools.Modal.show(Drupal.CTools.Modal.getSettings(ajax.element));
}
$('#modal-title').html(response.title);
// Simulate an actual page load by scrolling to the top after adding the
// content. This is helpful for allowing users to see error messages at the
// top of a form, etc.
$('#modal-content').html(response.output).scrollTop(0);
Drupal.attachBehaviors();
}
/**
* AJAX responder command to dismiss the modal.
*/
Drupal.CTools.Modal.modal_dismiss = function(command) {
Drupal.CTools.Modal.dismiss();
$('link.ctools-temporary-css').remove();
}
/**
* Display loading
*/
//Drupal.CTools.AJAX.commands.modal_loading = function(command) {
Drupal.CTools.Modal.modal_loading = function(command) {
Drupal.CTools.Modal.modal_display({
output: Drupal.theme(Drupal.CTools.Modal.currentSettings.throbberTheme),
title: Drupal.CTools.Modal.currentSettings.loadingText
});
}
/**
* Find a URL for an AJAX button.
*
* The URL for this gadget will be composed of the values of items by
* taking the ID of this item and adding -url and looking for that
* class. They need to be in the form in order since we will
* concat them all together using '/'.
*/
Drupal.CTools.Modal.findURL = function(item) {
var url = '';
var url_class = '.' + $(item).attr('id') + '-url';
$(url_class).each(
function() {
var $this = $(this);
if (url && $this.val()) {
url += '/';
}
url += $this.val();
});
return url;
};
/**
* modalContent
* @param content string to display in the content box
* @param css obj of css attributes
* @param animation (fadeIn, slideDown, show)
* @param speed (valid animation speeds slow, medium, fast or # in ms)
*/
Drupal.CTools.Modal.modalContent = function(content, css, animation, speed) {
// If our animation isn't set, make it just show/pop
if (!animation) {
animation = 'show';
}
else {
// If our animation isn't "fadeIn" or "slideDown" then it always is show
if (animation != 'fadeIn' && animation != 'slideDown') {
animation = 'show';
}
}
if (!speed) {
speed = 'fast';
}
// Build our base attributes and allow them to be overriden
css = jQuery.extend({
position: 'absolute',
left: '0px',
margin: '0px',
background: '#000',
opacity: '.55'
}, css);
// Add opacity handling for IE.
css.filter = 'alpha(opacity=' + (100 * css.opacity) + ')';
content.hide();
// if we already ahve a modalContent, remove it
if ( $('#modalBackdrop')) $('#modalBackdrop').remove();
if ( $('#modalContent')) $('#modalContent').remove();
// position code lifted from http://www.quirksmode.org/viewport/compatibility.html
if (self.pageYOffset) { // all except Explorer
var wt = self.pageYOffset;
} else if (document.documentElement && document.documentElement.scrollTop) { // Explorer 6 Strict
var wt = document.documentElement.scrollTop;
} else if (document.body) { // all other Explorers
var wt = document.body.scrollTop;
}
// Get our dimensions
// Get the docHeight and (ugly hack) add 50 pixels to make sure we dont have a *visible* border below our div
var docHeight = $(document).height() + 50;
var docWidth = $(document).width();
var winHeight = $(window).height();
var winWidth = $(window).width();
if( docHeight < winHeight ) docHeight = winHeight;
// Create our divs
$('body').append('<div id="modalBackdrop" style="z-index: 1000; display: none;"></div><div id="modalContent" style="z-index: 1001; position: absolute;">' + $(content).html() + '</div>');
// Keyboard and focus event handler ensures focus stays on modal elements only
modalEventHandler = function( event ) {
target = null;
if ( event ) { //Mozilla
target = event.target;
} else { //IE
event = window.event;
target = event.srcElement;
}
var parents = $(target).parents().get();
for (var i in $(target).parents().get()) {
var position = $(parents[i]).css('position');
if (position == 'absolute' || position == 'fixed') {
return true;
}
}
if( $(target).filter('*:visible').parents('#modalContent').size()) {
// allow the event only if target is a visible child node of #modalContent
return true;
}
if ( $('#modalContent')) $('#modalContent').get(0).focus();
return false;
};
$('body').bind( 'focus', modalEventHandler );
$('body').bind( 'keypress', modalEventHandler );
// Create our content div, get the dimensions, and hide it
var modalContent = $('#modalContent').css('top','-1000px');
var mdcTop = wt + ( winHeight / 2 ) - ( modalContent.outerHeight() / 2);
var mdcLeft = ( winWidth / 2 ) - ( modalContent.outerWidth() / 2);
$('#modalBackdrop').css(css).css('top', 0).css('height', docHeight + 'px').css('width', docWidth + 'px').show();
modalContent.css({top: mdcTop + 'px', left: mdcLeft + 'px'}).hide()[animation](speed);
// Bind a click for closing the modalContent
modalContentClose = function(){close(); return false;};
$('.close').bind('click', modalContentClose);
// Bind a keypress on escape for closing the modalContent
modalEventEscapeCloseHandler = function(event) {
if (event.keyCode == 27) {
close();
return false;
}
};
$(document).bind('keypress', modalEventEscapeCloseHandler);
// Close the open modal content and backdrop
function close() {
// Unbind the events
$(window).unbind('resize', modalContentResize);
$('body').unbind( 'focus', modalEventHandler);
$('body').unbind( 'keypress', modalEventHandler );
$('.close').unbind('click', modalContentClose);
$('body').unbind('keypress', modalEventEscapeCloseHandler);
$(document).trigger('CToolsDetachBehaviors', $('#modalContent'));
// Set our animation parameters and use them
if ( animation == 'fadeIn' ) animation = 'fadeOut';
if ( animation == 'slideDown' ) animation = 'slideUp';
if ( animation == 'show' ) animation = 'hide';
// Close the content
modalContent.hide()[animation](speed);
// Remove the content
$('#modalContent').remove();
$('#modalBackdrop').remove();
};
// Move and resize the modalBackdrop and modalContent on resize of the window
modalContentResize = function(){
// Get our heights
var docHeight = $(document).height();
var docWidth = $(document).width();
var winHeight = $(window).height();
var winWidth = $(window).width();
if( docHeight < winHeight ) docHeight = winHeight;
// Get where we should move content to
var modalContent = $('#modalContent');
var mdcTop = ( winHeight / 2 ) - ( modalContent.outerHeight() / 2);
var mdcLeft = ( winWidth / 2 ) - ( modalContent.outerWidth() / 2);
// Apply the changes
$('#modalBackdrop').css('height', docHeight + 'px').css('width', docWidth + 'px').show();
modalContent.css('top', mdcTop + 'px').css('left', mdcLeft + 'px').show();
};
$(window).bind('resize', modalContentResize);
$('#modalContent').focus();
};
/**
* unmodalContent
* @param content (The jQuery object to remove)
* @param animation (fadeOut, slideUp, show)
* @param speed (valid animation speeds slow, medium, fast or # in ms)
*/
Drupal.CTools.Modal.unmodalContent = function(content, animation, speed)
{
// If our animation isn't set, make it just show/pop
if (!animation) { var animation = 'show'; } else {
// If our animation isn't "fade" then it always is show
if (( animation != 'fadeOut' ) && ( animation != 'slideUp')) animation = 'show';
}
// Set a speed if we dont have one
if ( !speed ) var speed = 'fast';
// Unbind the events we bound
$(window).unbind('resize', modalContentResize);
$('body').unbind('focus', modalEventHandler);
$('body').unbind('keypress', modalEventHandler);
$('.close').unbind('click', modalContentClose);
$(document).trigger('CToolsDetachBehaviors', $('#modalContent'));
// jQuery magic loop through the instances and run the animations or removal.
content.each(function(){
if ( animation == 'fade' ) {
$('#modalContent').fadeOut(speed, function() {
$('#modalBackdrop').fadeOut(speed, function() {
$(this).remove();
});
$(this).remove();
});
} else {
if ( animation == 'slide' ) {
$('#modalContent').slideUp(speed,function() {
$('#modalBackdrop').slideUp(speed, function() {
$(this).remove();
});
$(this).remove();
});
} else {
$('#modalContent').remove();
$('#modalBackdrop').remove();
}
}
});
};
$(function() {
Drupal.ajax.prototype.commands.modal_display = Drupal.CTools.Modal.modal_display;
Drupal.ajax.prototype.commands.modal_dismiss = Drupal.CTools.Modal.modal_dismiss;
});
})(jQuery);
;
/**
* Provide the HTML to create the modal dialog.
*/
Drupal.theme.prototype.ModalFormsPopup = function () {
var html = '';
html += '<div id="ctools-modal" class="popups-box">';
html += ' <div class="ctools-modal-content modal-forms-modal-content">';
html += ' <div class="popups-container">';
html += ' <div class="modal-header popups-title clearfix">';
html += ' <h3 id="modal-title" class="modal-title"></h3>';
html += ' <span class="popups-close close">' + Drupal.CTools.Modal.currentSettings.closeText + '</span>';
html += ' </div>';
html += ' <div class="modal-scroll"><div id="modal-content" class="modal-content popups-body"></div></div>';
html += ' </div>';
html += ' </div>';
html += '</div>';
return html;
}
;
(function ($) {
Drupal.viewsSlideshow = Drupal.viewsSlideshow || {};
/**
* Views Slideshow Controls
*/
Drupal.viewsSlideshowControls = Drupal.viewsSlideshowControls || {};
/**
* Implement the play hook for controls.
*/
Drupal.viewsSlideshowControls.play = function (options) {
// Route the control call to the correct control type.
// Need to use try catch so we don't have to check to make sure every part
// of the object is defined.
try {
if (typeof Drupal.settings.viewsSlideshowControls[options.slideshowID].top.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].top.type].play == 'function') {
Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].top.type].play(options);
}
}
catch(err) {
// Don't need to do anything on error.
}
try {
if (typeof Drupal.settings.viewsSlideshowControls[options.slideshowID].bottom.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].bottom.type].play == 'function') {
Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].bottom.type].play(options);
}
}
catch(err) {
// Don't need to do anything on error.
}
};
/**
* Implement the pause hook for controls.
*/
Drupal.viewsSlideshowControls.pause = function (options) {
// Route the control call to the correct control type.
// Need to use try catch so we don't have to check to make sure every part
// of the object is defined.
try {
if (typeof Drupal.settings.viewsSlideshowControls[options.slideshowID].top.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].top.type].pause == 'function') {
Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].top.type].pause(options);
}
}
catch(err) {
// Don't need to do anything on error.
}
try {
if (typeof Drupal.settings.viewsSlideshowControls[options.slideshowID].bottom.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].bottom.type].pause == 'function') {
Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].bottom.type].pause(options);
}
}
catch(err) {
// Don't need to do anything on error.
}
};
/**
* Views Slideshow Text Controls
*/
// Add views slieshow api calls for views slideshow text controls.
Drupal.behaviors.viewsSlideshowControlsText = {
attach: function (context) {
// Process previous link
$('.views_slideshow_controls_text_previous:not(.views-slideshow-controls-text-previous-processed)', context).addClass('views-slideshow-controls-text-previous-processed').each(function() {
var uniqueID = $(this).attr('id').replace('views_slideshow_controls_text_previous_', '');
$(this).click(function() {
Drupal.viewsSlideshow.action({ "action": 'previousSlide', "slideshowID": uniqueID });
return false;
});
});
// Process next link
$('.views_slideshow_controls_text_next:not(.views-slideshow-controls-text-next-processed)', context).addClass('views-slideshow-controls-text-next-processed').each(function() {
var uniqueID = $(this).attr('id').replace('views_slideshow_controls_text_next_', '');
$(this).click(function() {
Drupal.viewsSlideshow.action({ "action": 'nextSlide', "slideshowID": uniqueID });
return false;
});
});
// Process pause link
$('.views_slideshow_controls_text_pause:not(.views-slideshow-controls-text-pause-processed)', context).addClass('views-slideshow-controls-text-pause-processed').each(function() {
var uniqueID = $(this).attr('id').replace('views_slideshow_controls_text_pause_', '');
$(this).click(function() {
if (Drupal.settings.viewsSlideshow[uniqueID].paused) {
Drupal.viewsSlideshow.action({ "action": 'play', "slideshowID": uniqueID, "force": true });
}
else {
Drupal.viewsSlideshow.action({ "action": 'pause', "slideshowID": uniqueID, "force": true });
}
return false;
});
});
}
};
Drupal.viewsSlideshowControlsText = Drupal.viewsSlideshowControlsText || {};
/**
* Implement the pause hook for text controls.
*/
Drupal.viewsSlideshowControlsText.pause = function (options) {
var pauseText = Drupal.theme.prototype['viewsSlideshowControlsPause'] ? Drupal.theme('viewsSlideshowControlsPause') : '';
$('#views_slideshow_controls_text_pause_' + options.slideshowID + ' a').text(pauseText);
};
/**
* Implement the play hook for text controls.
*/
Drupal.viewsSlideshowControlsText.play = function (options) {
var playText = Drupal.theme.prototype['viewsSlideshowControlsPlay'] ? Drupal.theme('viewsSlideshowControlsPlay') : '';
$('#views_slideshow_controls_text_pause_' + options.slideshowID + ' a').text(playText);
};
// Theme the resume control.
Drupal.theme.prototype.viewsSlideshowControlsPause = function () {
return Drupal.t('Resume');
};
// Theme the pause control.
Drupal.theme.prototype.viewsSlideshowControlsPlay = function () {
return Drupal.t('Pause');
};
/**
* Views Slideshow Pager
*/
Drupal.viewsSlideshowPager = Drupal.viewsSlideshowPager || {};
/**
* Implement the transitionBegin hook for pagers.
*/
Drupal.viewsSlideshowPager.transitionBegin = function (options) {
// Route the pager call to the correct pager type.
// Need to use try catch so we don't have to check to make sure every part
// of the object is defined.
try {
if (typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].transitionBegin == 'function') {
Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].transitionBegin(options);
}
}
catch(err) {
// Don't need to do anything on error.
}
try {
if (typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].transitionBegin == 'function') {
Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].transitionBegin(options);
}
}
catch(err) {
// Don't need to do anything on error.
}
};
/**
* Implement the goToSlide hook for pagers.
*/
Drupal.viewsSlideshowPager.goToSlide = function (options) {
// Route the pager call to the correct pager type.
// Need to use try catch so we don't have to check to make sure every part
// of the object is defined.
try {
if (typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].goToSlide == 'function') {
Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].goToSlide(options);
}
}
catch(err) {
// Don't need to do anything on error.
}
try {
if (typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].goToSlide == 'function') {
Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].goToSlide(options);
}
}
catch(err) {
// Don't need to do anything on error.
}
};
/**
* Implement the previousSlide hook for pagers.
*/
Drupal.viewsSlideshowPager.previousSlide = function (options) {
// Route the pager call to the correct pager type.
// Need to use try catch so we don't have to check to make sure every part
// of the object is defined.
try {
if (typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].previousSlide == 'function') {
Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].previousSlide(options);
}
}
catch(err) {
// Don't need to do anything on error.
}
try {
if (typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].previousSlide == 'function') {
Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].previousSlide(options);
}
}
catch(err) {
// Don't need to do anything on error.
}
};
/**
* Implement the nextSlide hook for pagers.
*/
Drupal.viewsSlideshowPager.nextSlide = function (options) {
// Route the pager call to the correct pager type.
// Need to use try catch so we don't have to check to make sure every part
// of the object is defined.
try {
if (typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].nextSlide == 'function') {
Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].nextSlide(options);
}
}
catch(err) {
// Don't need to do anything on error.
}
try {
if (typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].nextSlide == 'function') {
Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].nextSlide(options);
}
}
catch(err) {
// Don't need to do anything on error.
}
};
/**
* Views Slideshow Pager Fields
*/
// Add views slieshow api calls for views slideshow pager fields.
Drupal.behaviors.viewsSlideshowPagerFields = {
attach: function (context) {
// Process pause on hover.
$('.views_slideshow_pager_field:not(.views-slideshow-pager-field-processed)', context).addClass('views-slideshow-pager-field-processed').each(function() {
// Parse out the location and unique id from the full id.
var pagerInfo = $(this).attr('id').split('_');
var location = pagerInfo[2];
pagerInfo.splice(0, 3);
var uniqueID = pagerInfo.join('_');
// Add the activate and pause on pager hover event to each pager item.
if (Drupal.settings.viewsSlideshowPagerFields[uniqueID][location].activatePauseOnHover) {
$(this).children().each(function(index, pagerItem) {
var mouseIn = function() {
Drupal.viewsSlideshow.action({ "action": 'goToSlide', "slideshowID": uniqueID, "slideNum": index });
Drupal.viewsSlideshow.action({ "action": 'pause', "slideshowID": uniqueID });
}
var mouseOut = function() {
Drupal.viewsSlideshow.action({ "action": 'play', "slideshowID": uniqueID });
}
if (jQuery.fn.hoverIntent) {
$(pagerItem).hoverIntent(mouseIn, mouseOut);
}
else {
$(pagerItem).hover(mouseIn, mouseOut);
}
});
}
else {
$(this).children().each(function(index, pagerItem) {
$(pagerItem).click(function() {
Drupal.viewsSlideshow.action({ "action": 'goToSlide', "slideshowID": uniqueID, "slideNum": index });
});
});
}
});
}
};
Drupal.viewsSlideshowPagerFields = Drupal.viewsSlideshowPagerFields || {};
/**
* Implement the transitionBegin hook for pager fields pager.
*/
Drupal.viewsSlideshowPagerFields.transitionBegin = function (options) {
for (pagerLocation in Drupal.settings.viewsSlideshowPager[options.slideshowID]) {
// Remove active class from pagers
$('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"]').removeClass('active');
// Add active class to active pager.
$('#views_slideshow_pager_field_item_'+ pagerLocation + '_' + options.slideshowID + '_' + options.slideNum).addClass('active');
}
};
/**
* Implement the goToSlide hook for pager fields pager.
*/
Drupal.viewsSlideshowPagerFields.goToSlide = function (options) {
for (pagerLocation in Drupal.settings.viewsSlideshowPager[options.slideshowID]) {
// Remove active class from pagers
$('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"]').removeClass('active');
// Add active class to active pager.
$('#views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '_' + options.slideNum).addClass('active');
}
};
/**
* Implement the previousSlide hook for pager fields pager.
*/
Drupal.viewsSlideshowPagerFields.previousSlide = function (options) {
for (pagerLocation in Drupal.settings.viewsSlideshowPager[options.slideshowID]) {
// Get the current active pager.
var pagerNum = $('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"].active').attr('id').replace('views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '_', '');
// If we are on the first pager then activate the last pager.
// Otherwise activate the previous pager.
if (pagerNum == 0) {
pagerNum = $('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"]').length() - 1;
}
else {
pagerNum--;
}
// Remove active class from pagers
$('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"]').removeClass('active');
// Add active class to active pager.
$('#views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '_' + pagerNum).addClass('active');
}
};
/**
* Implement the nextSlide hook for pager fields pager.
*/
Drupal.viewsSlideshowPagerFields.nextSlide = function (options) {
for (pagerLocation in Drupal.settings.viewsSlideshowPager[options.slideshowID]) {
// Get the current active pager.
var pagerNum = $('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"].active').attr('id').replace('views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '_', '');
var totalPagers = $('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"]').length();
// If we are on the last pager then activate the first pager.
// Otherwise activate the next pager.
pagerNum++;
if (pagerNum == totalPagers) {
pagerNum = 0;
}
// Remove active class from pagers
$('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"]').removeClass('active');
// Add active class to active pager.
$('#views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '_' + slideNum).addClass('active');
}
};
/**
* Views Slideshow Slide Counter
*/
Drupal.viewsSlideshowSlideCounter = Drupal.viewsSlideshowSlideCounter || {};
/**
* Implement the transitionBegin for the slide counter.
*/
Drupal.viewsSlideshowSlideCounter.transitionBegin = function (options) {
$('#views_slideshow_slide_counter_' + options.slideshowID + ' .num').text(options.slideNum + 1);
};
/**
* This is used as a router to process actions for the slideshow.
*/
Drupal.viewsSlideshow.action = function (options) {
// Set default values for our return status.
var status = {
'value': true,
'text': ''
}
// If an action isn't specified return false.
if (typeof options.action == 'undefined' || options.action == '') {
status.value = false;
status.text = Drupal.t('There was no action specified.');
return error;
}
// If we are using pause or play switch paused state accordingly.
if (options.action == 'pause') {
Drupal.settings.viewsSlideshow[options.slideshowID].paused = 1;
// If the calling method is forcing a pause then mark it as such.
if (options.force) {
Drupal.settings.viewsSlideshow[options.slideshowID].pausedForce = 1;
}
}
else if (options.action == 'play') {
// If the slideshow isn't forced pause or we are forcing a play then play
// the slideshow.
// Otherwise return telling the calling method that it was forced paused.
if (!Drupal.settings.viewsSlideshow[options.slideshowID].pausedForce || options.force) {
Drupal.settings.viewsSlideshow[options.slideshowID].paused = 0;
Drupal.settings.viewsSlideshow[options.slideshowID].pausedForce = 0;
}
else {
status.value = false;
status.text += ' ' + Drupal.t('This slideshow is forced paused.');
return status;
}
}
// We use a switch statement here mainly just to limit the type of actions
// that are available.
switch (options.action) {
case "goToSlide":
case "transitionBegin":
case "transitionEnd":
// The three methods above require a slide number. Checking if it is
// defined and it is a number that is an integer.
if (typeof options.slideNum == 'undefined' || typeof options.slideNum !== 'number' || parseInt(options.slideNum) != (options.slideNum - 0)) {
status.value = false;
status.text = Drupal.t('An invalid integer was specified for slideNum.');
}
case "pause":
case "play":
case "nextSlide":
case "previousSlide":
// Grab our list of methods.
var methods = Drupal.settings.viewsSlideshow[options.slideshowID]['methods'];
// if the calling method specified methods that shouldn't be called then
// exclude calling them.
var excludeMethodsObj = {};
if (typeof options.excludeMethods !== 'undefined') {
// We need to turn the excludeMethods array into an object so we can use the in
// function.
for (var i=0; i < excludeMethods.length; i++) {
excludeMethodsObj[excludeMethods[i]] = '';
}
}
// Call every registered method and don't call excluded ones.
for (i = 0; i < methods[options.action].length; i++) {
if (Drupal[methods[options.action][i]] != undefined && typeof Drupal[methods[options.action][i]][options.action] == 'function' && !(methods[options.action][i] in excludeMethodsObj)) {
Drupal[methods[options.action][i]][options.action](options);
}
}
break;
// If it gets here it's because it's an invalid action.
default:
status.value = false;
status.text = Drupal.t('An invalid action "!action" was specified.', { "!action": options.action });
}
return status;
};
})(jQuery);
;
/**
* JavaScript behaviors for the front-end display of webforms.
*/
(function ($) {
Drupal.behaviors.webform = Drupal.behaviors.webform || {};
Drupal.behaviors.webform.attach = function(context) {
// Calendar datepicker behavior.
Drupal.webform.datepicker(context);
};
Drupal.webform = Drupal.webform || {};
Drupal.webform.datepicker = function(context) {
$('div.webform-datepicker').each(function() {
var $webformDatepicker = $(this);
var $calendar = $webformDatepicker.find('input.webform-calendar');
var startDate = $calendar[0].className.replace(/.*webform-calendar-start-(\d{4}-\d{2}-\d{2}).*/, '$1').split('-');
var endDate = $calendar[0].className.replace(/.*webform-calendar-end-(\d{4}-\d{2}-\d{2}).*/, '$1').split('-');
var firstDay = $calendar[0].className.replace(/.*webform-calendar-day-(\d).*/, '$1');
// Convert date strings into actual Date objects.
startDate = new Date(startDate[0], startDate[1] - 1, startDate[2]);
endDate = new Date(endDate[0], endDate[1] - 1, endDate[2]);
// Ensure that start comes before end for datepicker.
if (startDate > endDate) {
var laterDate = startDate;
startDate = endDate;
endDate = laterDate;
}
var startYear = startDate.getFullYear();
var endYear = endDate.getFullYear();
// Set up the jQuery datepicker element.
$calendar.datepicker({
dateFormat: 'yy-mm-dd',
yearRange: startYear + ':' + endYear,
firstDay: parseInt(firstDay),
minDate: startDate,
maxDate: endDate,
onSelect: function(dateText, inst) {
var date = dateText.split('-');
$webformDatepicker.find('select.year, input.year').val(+date[0]);
$webformDatepicker.find('select.month').val(+date[1]);
$webformDatepicker.find('select.day').val(+date[2]);
},
beforeShow: function(input, inst) {
// Get the select list values.
var year = $webformDatepicker.find('select.year, input.year').val();
var month = $webformDatepicker.find('select.month').val();
var day = $webformDatepicker.find('select.day').val();
// If empty, default to the current year/month/day in the popup.
var today = new Date();
year = year ? year : today.getFullYear();
month = month ? month : today.getMonth() + 1;
day = day ? day : today.getDate();
// Make sure that the default year fits in the available options.
year = (year < startYear || year > endYear) ? startYear : year;
// jQuery UI Datepicker will read the input field and base its date off
// of that, even though in our case the input field is a button.
$(input).val(year + '-' + month + '-' + day);
}
});
// Prevent the calendar button from submitting the form.
$calendar.click(function(event) {
$(this).focus();
event.preventDefault();
});
});
}
})(jQuery);
;
(function ($) {
$(document).ready(function() {
// Expression to check for absolute internal links.
var isInternal = new RegExp("^(https?):\/\/" + window.location.host, "i");
// Attach onclick event to document only and catch clicks on all elements.
$(document.body).click(function(event) {
// Catch the closest surrounding link of a clicked element.
$(event.target).closest("a,area").each(function() {
var ga = Drupal.settings.googleanalytics;
// Expression to check for special links like gotwo.module /go/* links.
var isInternalSpecial = new RegExp("(\/go\/.*)$", "i");
// Expression to check for download links.
var isDownload = new RegExp("\\.(" + ga.trackDownloadExtensions + ")$", "i");
// Is the clicked URL internal?
if (isInternal.test(this.href)) {
// Skip 'click' tracking, if custom tracking events are bound.
if ($(this).is('.colorbox')) {
// Do nothing here. The custom event will handle all tracking.
}
// Is download tracking activated and the file extension configured for download tracking?
else if (ga.trackDownload && isDownload.test(this.href)) {
// Download link clicked.
var extension = isDownload.exec(this.href);
_gaq.push(["_trackEvent", "Downloads", extension[1].toUpperCase(), this.href.replace(isInternal, '')]);
}
else if (isInternalSpecial.test(this.href)) {
// Keep the internal URL for Google Analytics website overlay intact.
_gaq.push(["_trackPageview", this.href.replace(isInternal, '')]);
}
}
else {
if (ga.trackMailto && $(this).is("a[href^='mailto:'],area[href^='mailto:']")) {
// Mailto link clicked.
_gaq.push(["_trackEvent", "Mails", "Click", this.href.substring(7)]);
}
else if (ga.trackOutbound && this.href.match(/^\w+:\/\//i)) {
if (ga.trackDomainMode == 2 && isCrossDomain($(this).attr('hostname'), ga.trackCrossDomains)) {
// Top-level cross domain clicked. document.location is handled by _link internally.
event.preventDefault();
_gaq.push(["_link", this.href]);
}
else {
// External link clicked.
_gaq.push(["_trackEvent", "Outbound links", "Click", this.href]);
}
}
}
});
});
// Colorbox: This event triggers when the transition has completed and the
// newly loaded content has been revealed.
$(document).bind("cbox_complete", function() {
var href = $.colorbox.element().attr("href");
if (href) {
_gaq.push(["_trackPageview", href.replace(isInternal, '')]);
}
});
});
/**
* Check whether the hostname is part of the cross domains or not.
*
* @param string hostname
* The hostname of the clicked URL.
* @param array crossDomains
* All cross domain hostnames as JS array.
*
* @return boolean
*/
function isCrossDomain(hostname, crossDomains) {
/**
* jQuery < 1.6.3 bug: $.inArray crushes IE6 and Chrome if second argument is
* `null` or `undefined`, http://bugs.jquery.com/ticket/10076,
* https://github.com/jquery/jquery/commit/a839af034db2bd934e4d4fa6758a3fed8de74174
*
* @todo: Remove/Refactor in D8
*/
if (!crossDomains) {
return false;
}
else {
return $.inArray(hostname, crossDomains) > -1 ? true : false;
}
}
})(jQuery);
;
| mikeusry/hgia | athens_ga/js/js_dYU5nuz6qyyjAASTaIu-FngprZm60naMXDmPgEyhE1Y.js | JavaScript | gpl-2.0 | 52,182 |
'use strict';
angular.module('restFrontendApp')
.factory('MainSrvc', function ($resource) {
return $resource('http://localhost:8080/RestBackEnd/services/rest/contact/:id',{id:'@_id'}, {
getData: {
method:'GET',
isArray: false
},
postData: {
method:'POST'
}
});
});
| davidetrapani/OracleDB_RestBackEnd | restFrontend/app/scripts/services/main.js | JavaScript | gpl-2.0 | 305 |
tinyMCE.addI18n("sk.advlink_dlg", {
target_name: "Názov cieľa",
classes: "Triedy",
style: "Štýl",
id: "ID",
popup_position: "Umiestnenie (X/Y)",
langdir: "Smer textu",
popup_size: "Veľkosť",
popup_dependent: "Závislosť (iba Mozilla/Firefox)",
popup_resizable: "Umožniť zmenu veľkosti",
popup_location: "Zobraziť lištu umiestnení",
popup_menubar: "Zobraziť ponuku",
popup_toolbar: "Zobraziť nástrojovú lištu",
popup_statusbar: "Zobraziť stavový riadok",
popup_scrollbars: "Zobraziť posuvníky",
popup_return: "Vložiť 'return false'",
popup_name: "Názov okna",
popup_url: "URL vyskakovacieho okna",
popup: "JavaScriptové okno",
target_blank: "Otvoriť v novom okne",
target_top: "Otvoriť v hlavnom okne/ráme (nahradiť všetky rámy)",
target_parent: "Otvoriť v nadradenom okne/ráme",
target_same: "Otvoriť v rovnakom okne/ráme",
anchor_names: "Záložka",
popup_opts: "Možnosti",
advanced_props: "Rozšírené parametre",
event_props: "Udalosti",
popup_props: "Vlastnosti vyskakovacieho okna",
general_props: "Obecné parametre",
advanced_tab: "Rozšírené",
events_tab: "Udalosti",
popup_tab: "Vyskakovacie okno",
general_tab: "Obecné",
list: "Zoznam odkazov",
is_external: "Zadaná URL vyzerá ako externý odkaz, chcete doplniť povinný prefix http://?",
is_email: "Zadaná URL vyzerá ako e-mailová adresa, chcete doplniť povinný prefix mailto:?",
titlefield: "Titulok",
target: "Cieľ",
url: "URL odkazu",
title: "Vložiť/upraviť odkaz",
link_list: "Zoznam odkazov",
rtl: "Sprava doľava",
ltr: "Zľava doprava",
accesskey: "Klávesová skratka",
tabindex: "Poradie pre tabulátor",
rev: "Vzťah cieľa k stránke",
rel: "Vzťah stránky k cieľu",
mime: "MIME typ",
encoding: "Kódovanie",
langcode: "Kód jazyka",
target_langcode: "Jazyk cieľa"
}); | openacs/openacs-core | packages/acs-templating/www/resources/tinymce/jscripts/tiny_mce/plugins/advlink/langs/sk_dlg_src.js | JavaScript | gpl-2.0 | 1,996 |
// Load modules
var NodeUtil = require('util');
var Hoek = require('hoek');
// Declare internals
var internals = {
flags: ['deep', 'not', 'once', 'only', 'part'],
grammar: ['a', 'an', 'and', 'at', 'be', 'have', 'in', 'to'],
locations: {},
count: 0
};
exports.settings = {
truncateMessages: true
};
exports.expect = function (value, prefix) {
var at = internals.at();
var location = at.filename + ':' + at.line + '.' + at.column;
internals.locations[location] = true;
++internals.count;
return new internals.Assertion(value, prefix, location);
};
exports.incomplete = function () {
var locations = Object.keys(internals.locations);
return locations.length ? locations : null;
};
exports.count = function () {
return internals.count;
};
internals.Assertion = function (ref, prefix, location) {
this._ref = ref;
this._prefix = prefix || '';
this._location = location;
this._flags = {};
};
internals.filterLocal = function (line) {
return line.indexOf(__dirname) === -1;
};
internals.Assertion.prototype.assert = function (result, verb, actual, expected) {
delete internals.locations[this._location];
if (this._flags.not ? !result : result) {
this._flags = {};
return this;
}
var message = (this._prefix ? this._prefix + ': ' : '') + 'Expected ' + internals.display(this._ref) + ' to ' + (this._flags.not ? 'not ' + verb : verb);
if (arguments.length === 3) { // 'actual' without 'expected'
message += ' but got ' + internals.display(actual);
}
var error = new Error(message);
Error.captureStackTrace(error, this.assert);
error.actual = actual;
error.expected = expected;
error.at = internals.at(error);
throw error;
};
[].concat(internals.flags, internals.grammar).forEach(function (word) {
var method = internals.flags.indexOf(word) !== -1 ? function () { this._flags[word] = !this._flags[word]; return this; }
: function () { return this; };
Object.defineProperty(internals.Assertion.prototype, word, { get: method, configurable: true });
});
internals.addMethod = function (names, fn) {
names = [].concat(names);
names.forEach(function (name) {
internals.Assertion.prototype[name] = fn;
});
};
['arguments', 'array', 'boolean', 'buffer', 'date', 'function', 'number', 'regexp', 'string', 'object'].forEach(function (word) {
var article = ['a', 'e', 'i', 'o', 'u'].indexOf(word[0]) !== -1 ? 'an ' : 'a ';
internals.addMethod(word, function () {
var type = internals.type(this._ref);
return this.assert(type === word, 'be ' + article + word, type);
});
});
[true, false, null, undefined].forEach(function (value) {
var name = NodeUtil.inspect(value);
internals.addMethod(name, function () {
return this.assert(this._ref === value, 'be ' + name);
});
});
internals.addMethod(['include', 'includes', 'contain', 'contains'], function (value) {
return this.assert(Hoek.contain(this._ref, value, this._flags), 'include ' + internals.display(value));
});
internals.addMethod(['endWith', 'endsWith'], function (value) {
internals.assert(this, typeof this._ref === 'string' && typeof value === 'string', 'Can only assert endsWith on a string, with a string');
var comparator = this._ref.slice(-value.length);
return this.assert(comparator === value, 'endWith ' + internals.display(value));
});
internals.addMethod(['startWith', 'startsWith'], function (value) {
internals.assert(this, typeof this._ref === 'string' && typeof value === 'string', 'Can only assert startsWith on a string, with a string');
var comparator = this._ref.slice(0, value.length);
return this.assert(comparator === value, 'startWith ' + internals.display(value));
});
internals.addMethod(['exist', 'exists'], function () {
return this.assert(this._ref !== null && this._ref !== undefined, 'exist');
});
internals.addMethod('empty', function () {
internals.assert(this, typeof this._ref === 'object' || typeof this._ref === 'string', 'Can only assert empty on object, array or string');
var length = this._ref.length !== undefined ? this._ref.length : Object.keys(this._ref).length;
return this.assert(!length, 'be empty');
});
internals.addMethod('length', function (size) {
internals.assert(this, typeof this._ref === 'object' || typeof this._ref === 'string', 'Can only assert empty on object, array or string');
var length = this._ref.length !== undefined ? this._ref.length : Object.keys(this._ref).length;
return this.assert(length === size, 'have a length of ' + size, length);
});
internals.addMethod(['equal', 'equals'], function (value, options) {
var compare = this._flags.deep ? function (a, b) { return Hoek.deepEqual(a, b, options); } :
function (a, b) { return a === b; };
return this.assert(compare(this._ref, value), 'equal specified value', this._ref, value);
});
internals.addMethod(['above', 'greaterThan'], function (value) {
return this.assert(this._ref > value, 'be above ' + value);
});
internals.addMethod(['least', 'min'], function (value) {
return this.assert(this._ref >= value, 'be at least ' + value);
});
internals.addMethod(['below', 'lessThan'], function (value) {
return this.assert(this._ref < value, 'be below ' + value);
});
internals.addMethod(['most', 'max'], function (value) {
return this.assert(this._ref <= value, 'be at most ' + value);
});
internals.addMethod(['within', 'range'], function (from, to) {
return this.assert(this._ref >= from && this._ref <= to, 'be within ' + from + '..' + to);
});
internals.addMethod('between', function (from, to) {
return this.assert(this._ref > from && this._ref < to, 'be between ' + from + '..' + to);
});
internals.addMethod('about', function (value, delta) {
internals.assert(this, internals.type(this._ref) === 'number', 'Can only assert about on numbers');
internals.assert(this, internals.type(value) === 'number' && internals.type(delta) === 'number', 'About assertion requires two number arguments');
return this.assert(Math.abs(this._ref - value) <= delta, 'be about ' + value + ' \u00b1' + delta);
});
internals.addMethod(['instanceof', 'instanceOf'], function (type) {
return this.assert(this._ref instanceof type, 'be an instance of ' + (type.name || 'provided type'));
});
internals.addMethod(['match', 'matches'], function (regex) {
return this.assert(regex.exec(this._ref), 'match ' + regex);
});
internals.addMethod(['satisfy', 'satisfies'], function (validator) {
return this.assert(validator(this._ref), 'satisfy rule');
});
internals.addMethod(['throw', 'throws'], function (/* type, message */) {
internals.assert(this, typeof this._ref === 'function', 'Can only assert throw on functions');
internals.assert(this, !this._flags.not || !arguments.length, 'Cannot specify arguments when expecting not to throw');
var type = arguments.length && typeof arguments[0] !== 'string' && !(arguments[0] instanceof RegExp) ? arguments[0] : null;
var lastArg = arguments[1] || arguments[0];
var message = typeof lastArg === 'string' || lastArg instanceof RegExp ? lastArg : null;
var thrown = false;
try {
this._ref();
}
catch (err) {
thrown = true;
if (type) {
this.assert(err instanceof type, 'throw ' + (type.name || 'provided type'));
}
if (message !== null) {
var error = err.message || '';
this.assert(typeof message === 'string' ? error === message : error.match(message), 'throw an error with specified message', error, message);
}
this.assert(thrown, 'throw an error', err);
}
return this.assert(thrown, 'throw an error');
});
internals.display = function (value) {
var string = NodeUtil.inspect(value);
if (!exports.settings.truncateMessages || string.length <= 40) {
return string;
}
if (Array.isArray(value)) {
return '[Array(' + value.length + ')]';
}
if (typeof value === 'object') {
var keys = Object.keys(value);
return '{ Object (' + (keys.length > 2 ? (keys.splice(0, 2).join(', ') + ', ...') : keys.join(', ')) + ') }';
}
return string.slice(0, 40) + '...\'';
};
internals.natives = {
'[object Arguments]': 'arguments',
'[object Array]': 'array',
'[object Date]': 'date',
'[object Function]': 'function',
'[object Number]': 'number',
'[object RegExp]': 'regexp',
'[object String]': 'string'
};
internals.type = function (value) {
if (value === null) {
return 'null';
}
if (value === undefined) {
return 'undefined';
}
if (Buffer.isBuffer(value)) {
return 'buffer';
}
var name = Object.prototype.toString.call(value);
if (internals.natives[name]) {
return internals.natives[name];
}
if (value === Object(value)) {
return 'object';
}
return typeof value;
};
internals.at = function (error) {
error = error || new Error();
var at = error.stack.split('\n').slice(1).filter(internals.filterLocal)[0].match(/^\s*at \(?(.+)\:(\d+)\:(\d+)\)?$/);
return {
filename: at[1],
line: at[2],
column: at[3]
};
};
internals.assert = function (assertion, condition, error) {
if (!condition) {
delete internals.locations[assertion._location];
Hoek.assert(condition, error);
}
};
| gvishnu06/insolent-wookie | node_modules/code/lib/index.js | JavaScript | gpl-2.0 | 9,674 |
/*
* Variables en modo produccion.
*
*/
var URL_SERVICE = "http://inver.nuevebit.com"; | NueveBit/inver | src/www/js/env_prod.js | JavaScript | gpl-2.0 | 91 |
showWord(["a. ","Chif ki vini apre katrevennèf epi anvan katrevenonz. Gen katrevendis pyebwa kay Jinèt la.<br>"]) | georgejhunt/HaitiDictionary.activity | data/words/katrevendis_katrevendiz_.js | JavaScript | gpl-2.0 | 115 |
jQuery(document).ready( function($) {
$('.date').datepick();
$('#period_num_prizes').one('keyup', function(event){
$(this).after("<br/><span class='description' style='color: red;'> Após alterar o número de prêmios, salve o período para configurá-los. </span>");
$('#prizes').hide(300);
});
}); | memuller/benedict-old | wp-content/plugins/benedict_plugin/js/admin/period.js | JavaScript | gpl-2.0 | 316 |
/*global wc_country_select_params */
jQuery( function( $ ) {
// wc_country_select_params is required to continue, ensure the object exists
if ( typeof wc_country_select_params === 'undefined' ) {
return false;
}
});
| eantz/ShipID | assets/js/country-select.js | JavaScript | gpl-2.0 | 223 |
import { expect } from 'chai';
import isRequestingSiteConnectionStatus from 'calypso/state/selectors/is-requesting-site-connection-status';
describe( 'isRequestingSiteConnectionStatus()', () => {
const siteId = 2916284;
test( 'should return true if connection status is currently being requested for that site', () => {
const state = {
sites: {
connection: {
requesting: {
[ siteId ]: true,
},
},
},
};
const output = isRequestingSiteConnectionStatus( state, siteId );
expect( output ).to.be.true;
} );
test( 'should return false if connection status is currently not being requested for that site', () => {
const state = {
sites: {
connection: {
requesting: {
[ siteId ]: false,
},
},
},
};
const output = isRequestingSiteConnectionStatus( state, siteId );
expect( output ).to.be.false;
} );
test( 'should return false if connection status has never been requested for that site', () => {
const state = {
sites: {
connection: {
requesting: {
77203074: true,
},
},
},
};
const output = isRequestingSiteConnectionStatus( state, siteId );
expect( output ).to.be.false;
} );
} );
| Automattic/wp-calypso | client/state/selectors/test/is-requesting-site-connection-status.js | JavaScript | gpl-2.0 | 1,202 |
/**
* DOCLink 1.5.x
* @version $Id: hu.js 362 2007-09-26 19:19:03Z mjaz $
* @package DOCLink_1.5
* @copyright (C) 2003-2007 The DOCman Development Team
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
* @link http://www.joomlatools.org/ Official website
**/
/**
* TRANSLATORS:
* PLEASE CHANGE THE INFO BELOW
*
* Hungarian (formal) language file
*
* Creator: Jozsef Tamas Herczeg
* Website: http://www.joomlandia.eu/
* E-mail: [email protected]
* Revision: 1.5
* Date: February 2007
**/
DOCLink.I18N = {
"enterurl": "Be kell írnia az URL-t",
"entercaption": "Írja be a felirat szövegét",
"loading": "Fájlok betöltése",
"OK": "OK",
"Cancel": "Mégse",
"Refresh": "Frissítés"
};
| thinkcollege/tc-code | plugins/editors-xtd/doclink/lang/hu.js | JavaScript | gpl-2.0 | 763 |
define(['datetime', 'focusManager'], function (datetime, focusManager) {
return function (options) {
var self = this;
var lastFocus = 0;
self.refresh = function () {
reloadPage(options.element);
};
// 30 mins
var cellCurationMinutes = 30;
var cellDurationMs = cellCurationMinutes * 60 * 1000;
var msPerDay = 86400000;
var currentDate;
var defaultChannels = 50;
var channelLimit = 1000;
var channelQuery = {
StartIndex: 0,
Limit: defaultChannels,
EnableFavoriteSorting: true
};
var channelsPromise;
function normalizeDateToTimeslot(date) {
var minutesOffset = date.getMinutes() - cellCurationMinutes;
if (minutesOffset >= 0) {
date.setHours(date.getHours(), cellCurationMinutes, 0, 0);
} else {
date.setHours(date.getHours(), 0, 0, 0);
}
return date;
}
function reloadChannels(page) {
channelsPromise = null;
reloadGuide(page);
}
function showLoading() {
}
function hideLoading() {
}
function reloadGuide(page, newStartDate) {
showLoading();
require(['connectionManager'], function (connectionManager) {
var apiClient = connectionManager.currentApiClient();
channelQuery.UserId = apiClient.getCurrentUserId();
channelQuery.Limit = Math.min(channelQuery.Limit || defaultChannels, channelLimit);
channelQuery.AddCurrentProgram = false;
channelsPromise = channelsPromise || apiClient.getLiveTvChannels(channelQuery);
var date = newStartDate;
// Add one second to avoid getting programs that are just ending
date = new Date(date.getTime() + 1000);
// Subtract to avoid getting programs that are starting when the grid ends
var nextDay = new Date(date.getTime() + msPerDay - 2000);
console.log(nextDay);
channelsPromise.done(function (channelsResult) {
apiClient.getLiveTvPrograms({
UserId: apiClient.getCurrentUserId(),
MaxStartDate: nextDay.toISOString(),
MinEndDate: date.toISOString(),
channelIds: channelsResult.Items.map(function (c) {
return c.Id;
}).join(','),
ImageTypeLimit: 1,
EnableImageTypes: "Primary",
SortBy: "StartDate"
}).done(function (programsResult) {
renderGuide(page, date, channelsResult.Items, programsResult.Items, apiClient);
hideLoading();
});
});
});
}
function getDisplayTime(date) {
if ((typeof date).toString().toLowerCase() === 'string') {
try {
date = datetime.parseISO8601Date(date, { toLocal: true });
} catch (err) {
return date;
}
}
var lower = date.toLocaleTimeString().toLowerCase();
var hours = date.getHours();
var minutes = date.getMinutes();
var text;
if (lower.indexOf('am') != -1 || lower.indexOf('pm') != -1) {
var suffix = hours > 11 ? 'pm' : 'am';
hours = (hours % 12) || 12;
text = hours;
if (minutes) {
text += ':';
if (minutes < 10) {
text += '0';
}
text += minutes;
}
text += suffix;
} else {
text = hours + ':';
if (minutes < 10) {
text += '0';
}
text += minutes;
}
return text;
}
function getTimeslotHeadersHtml(startDate, endDateTime) {
var html = '';
// clone
startDate = new Date(startDate.getTime());
html += '<div class="timeslotHeadersInner">';
while (startDate.getTime() < endDateTime) {
html += '<div class="timeslotHeader">';
html += getDisplayTime(startDate);
html += '</div>';
// Add 30 mins
startDate.setTime(startDate.getTime() + cellDurationMs);
}
html += '</div>';
return html;
}
function parseDates(program) {
if (!program.StartDateLocal) {
try {
program.StartDateLocal = datetime.parseISO8601Date(program.StartDate, { toLocal: true });
} catch (err) {
}
}
if (!program.EndDateLocal) {
try {
program.EndDateLocal = datetime.parseISO8601Date(program.EndDate, { toLocal: true });
} catch (err) {
}
}
return null;
}
function getChannelProgramsHtml(page, date, channel, programs) {
var html = '';
var startMs = date.getTime();
var endMs = startMs + msPerDay - 1;
programs = programs.filter(function (curr) {
return curr.ChannelId == channel.Id;
});
html += '<div class="channelPrograms">';
for (var i = 0, length = programs.length; i < length; i++) {
var program = programs[i];
if (program.ChannelId != channel.Id) {
continue;
}
parseDates(program);
if (program.EndDateLocal.getTime() < startMs) {
continue;
}
if (program.StartDateLocal.getTime() > endMs) {
break;
}
var renderStartMs = Math.max(program.StartDateLocal.getTime(), startMs);
var startPercent = (program.StartDateLocal.getTime() - startMs) / msPerDay;
startPercent *= 100;
startPercent = Math.max(startPercent, 0);
var renderEndMs = Math.min(program.EndDateLocal.getTime(), endMs);
var endPercent = (renderEndMs - renderStartMs) / msPerDay;
endPercent *= 100;
var cssClass = "programCell clearButton itemAction";
var addAccent = true;
if (program.IsKids) {
cssClass += " childProgramInfo";
} else if (program.IsSports) {
cssClass += " sportsProgramInfo";
} else if (program.IsNews) {
cssClass += " newsProgramInfo";
} else if (program.IsMovie) {
cssClass += " movieProgramInfo";
}
else {
cssClass += " plainProgramInfo";
addAccent = false;
}
html += '<button data-action="link" data-isfolder="' + program.IsFolder + '" data-id="' + program.Id + '" data-type="' + program.Type + '" class="' + cssClass + '" style="left:' + startPercent + '%;width:' + endPercent + '%;">';
var guideProgramNameClass = "guideProgramName";
html += '<div class="' + guideProgramNameClass + '">';
html += program.Name;
html += '</div>';
if (program.IsHD) {
html += '<iron-icon icon="hd"></iron-icon>';
}
//html += '<div class="guideProgramTime">';
//if (program.IsLive) {
// html += '<span class="liveTvProgram">' + Globalize.translate('LabelLiveProgram') + ' </span>';
//}
//else if (program.IsPremiere) {
// html += '<span class="premiereTvProgram">' + Globalize.translate('LabelPremiereProgram') + ' </span>';
//}
//else if (program.IsSeries && !program.IsRepeat) {
// html += '<span class="newTvProgram">' + Globalize.translate('LabelNewProgram') + ' </span>';
//}
//html += getDisplayTime(program.StartDateLocal);
//html += ' - ';
//html += getDisplayTime(program.EndDateLocal);
//if (program.SeriesTimerId) {
// html += '<div class="timerCircle seriesTimerCircle"></div>';
// html += '<div class="timerCircle seriesTimerCircle"></div>';
// html += '<div class="timerCircle seriesTimerCircle"></div>';
//}
//else if (program.TimerId) {
// html += '<div class="timerCircle"></div>';
//}
//html += '</div>';
if (addAccent) {
html += '<div class="programAccent"></div>';
}
html += '</button>';
}
html += '</div>';
return html;
}
function renderPrograms(page, date, channels, programs) {
var html = [];
for (var i = 0, length = channels.length; i < length; i++) {
html.push(getChannelProgramsHtml(page, date, channels[i], programs));
}
var programGrid = page.querySelector('.programGrid');
programGrid.innerHTML = html.join('');
programGrid.scrollTop = 0;
programGrid.scrollLeft = 0;
}
function renderChannelHeaders(page, channels, apiClient) {
var html = '';
for (var i = 0, length = channels.length; i < length; i++) {
var channel = channels[i];
html += '<button type="button" class="channelHeaderCell clearButton itemAction" data-action="link" data-isfolder="' + channel.IsFolder + '" data-id="' + channel.Id + '" data-type="' + channel.Type + '">';
var hasChannelImage = channel.ImageTags.Primary;
var cssClass = hasChannelImage ? 'guideChannelInfo guideChannelInfoWithImage' : 'guideChannelInfo';
html += '<div class="' + cssClass + '">' + channel.Number + '</div>';
if (hasChannelImage) {
var url = apiClient.getScaledImageUrl(channel.Id, {
maxHeight: 40,
maxWidth: 80,
tag: channel.ImageTags.Primary,
type: "Primary"
});
html += '<div class="guideChannelImage lazy" data-src="' + url + '"></div>';
}
html += '</button>';
}
var channelList = page.querySelector('.channelList');
channelList.innerHTML = html;
Emby.ImageLoader.lazyChildren(channelList);
}
function renderGuide(page, date, channels, programs, apiClient) {
renderChannelHeaders(page, channels, apiClient);
var startDate = date;
var endDate = new Date(startDate.getTime() + msPerDay);
page.querySelector('.timeslotHeaders').innerHTML = getTimeslotHeadersHtml(startDate, endDate);
renderPrograms(page, date, channels, programs);
focusManager.autoFocus(page.querySelector('.programGrid'), true);
}
var gridScrolling = false;
var headersScrolling = false;
function onProgramGridScroll(page, elem) {
if (!headersScrolling) {
gridScrolling = true;
$(page.querySelector('.timeslotHeaders')).scrollLeft($(elem).scrollLeft());
gridScrolling = false;
}
}
function onTimeslotHeadersScroll(page, elem) {
if (!gridScrolling) {
headersScrolling = true;
$(page.querySelector('.programGrid')).scrollLeft($(elem).scrollLeft());
headersScrolling = false;
}
}
function getFutureDateText(date) {
var weekday = [];
weekday[0] = Globalize.translate('OptionSundayShort');
weekday[1] = Globalize.translate('OptionMondayShort');
weekday[2] = Globalize.translate('OptionTuesdayShort');
weekday[3] = Globalize.translate('OptionWednesdayShort');
weekday[4] = Globalize.translate('OptionThursdayShort');
weekday[5] = Globalize.translate('OptionFridayShort');
weekday[6] = Globalize.translate('OptionSaturdayShort');
var day = weekday[date.getDay()];
date = date.toLocaleDateString();
if (date.toLowerCase().indexOf(day.toLowerCase()) == -1) {
return day + " " + date;
}
return date;
}
function changeDate(page, date) {
var newStartDate = normalizeDateToTimeslot(date);
currentDate = newStartDate;
reloadGuide(page, newStartDate);
var text = getFutureDateText(date);
text = '<span class="currentDay">' + text.replace(' ', ' </span>');
page.querySelector('.btnSelectDate').innerHTML = text;
}
var dateOptions = [];
function setDateRange(page, guideInfo) {
var today = new Date();
today.setHours(today.getHours(), 0, 0, 0);
var start = datetime.parseISO8601Date(guideInfo.StartDate, { toLocal: true });
var end = datetime.parseISO8601Date(guideInfo.EndDate, { toLocal: true });
start.setHours(0, 0, 0, 0);
end.setHours(0, 0, 0, 0);
if (start.getTime() >= end.getTime()) {
end.setDate(start.getDate() + 1);
}
start = new Date(Math.max(today, start));
dateOptions = [];
while (start <= end) {
dateOptions.push({
name: getFutureDateText(start),
id: start.getTime()
});
start.setDate(start.getDate() + 1);
start.setHours(0, 0, 0, 0);
}
var date = new Date();
if (currentDate) {
date.setTime(currentDate.getTime());
}
changeDate(page, date);
}
function reloadPageAfterValidation(page, limit) {
channelLimit = limit;
require(['connectionManager'], function (connectionManager) {
var apiClient = connectionManager.currentApiClient();
apiClient.getLiveTvGuideInfo().done(function (guideInfo) {
setDateRange(page, guideInfo);
});
});
}
function reloadPage(page) {
showLoading();
reloadPageAfterValidation(page, 1000);
}
function selectDate(page) {
require(['actionsheet'], function (actionsheet) {
actionsheet.show({
items: dateOptions,
title: Globalize.translate('HeaderSelectDate'),
callback: function (id) {
var date = new Date();
date.setTime(parseInt(id));
changeDate(page, date);
}
});
});
}
function createVerticalScroller(view, pageInstance) {
require(["slyScroller", 'loading'], function (slyScroller, loading) {
var scrollFrame = view.querySelector('.scrollFrameY');
var scrollSlider = view.querySelector('.scrollSliderY');
var options = {
horizontal: 0,
itemNav: 0,
mouseDragging: 1,
touchDragging: 1,
slidee: scrollSlider,
itemSelector: '.card',
smart: true,
easing: 'swing',
releaseSwing: true,
scrollBar: view.querySelector('.scrollbarY'),
scrollBy: 200,
speed: 300,
dragHandle: 1,
dynamicHandle: 1,
clickBar: 1
};
slyScroller.create(scrollFrame, options).then(function (slyFrame) {
pageInstance.verticalSlyFrame = slyFrame;
slyFrame.init();
initFocusHandler(view, scrollSlider, slyFrame);
createHorizontalScroller(view, pageInstance);
});
});
}
function initFocusHandler(view, scrollSlider, slyFrame) {
scrollSlider.addEventListener('focus', function (e) {
var focused = focusManager.focusableParent(e.target);
if (focused) {
var now = new Date().getTime();
var threshold = 50;
var animate = (now - lastFocus) > threshold;
slyFrame.toCenter(focused, !animate);
lastFocus = now;
}
}, true);
}
function createHorizontalScroller(view, pageInstance) {
require(["slyScroller", 'loading'], function (slyScroller, loading) {
var scrollFrame = view.querySelector('.scrollFrameX');
var scrollSlider = view.querySelector('.scrollSliderX');
var options = {
horizontal: 1,
itemNav: 0,
mouseDragging: 0,
touchDragging: 0,
slidee: scrollSlider,
itemSelector: '.card',
smart: true,
easing: 'swing',
releaseSwing: true,
scrollBy: 200,
speed: 300,
dragHandle: 0,
dynamicHandle: 0,
clickBar: 0
};
slyScroller.create(scrollFrame, options).then(function (slyFrame) {
pageInstance.horizontallyFrame = slyFrame;
slyFrame.init();
initFocusHandler(view, scrollSlider, slyFrame);
});
});
}
fetch(Emby.Page.baseUrl() + '/components/tvguide/tvguide.template.html', { mode: 'no-cors' }).then(function (response) {
return response.text();
}).then(function (template) {
var tabContent = options.element;
tabContent.innerHTML = template;
var programGrid = tabContent.querySelector('.programGrid');
programGrid.addEventListener('scroll', function () {
onProgramGridScroll(tabContent, this);
});
var isMobile = false;
if (isMobile) {
//tabContent.querySelector('.tvGuide').classList.add('mobileGuide');
} else {
//tabContent.querySelector('.tvGuide').classList.remove('mobileGuide');
tabContent.querySelector('.timeslotHeaders').addEventListener('scroll', function () {
onTimeslotHeadersScroll(tabContent, this);
});
}
tabContent.querySelector('.btnSelectDate').addEventListener('click', function () {
selectDate(tabContent);
});
createVerticalScroller(tabContent, self);
self.refresh();
});
};
}); | JfelixStudio/Polflix | components/tvguide/guide.js | JavaScript | gpl-2.0 | 20,046 |
/*
Jquery Validation using jqBootstrapValidation
example is taken from jqBootstrapValidation docs
*/
$(function() {
$("input,textarea").jqBootstrapValidation({
preventSubmit: true,
submitError: function($form, event, errors) {
// something to have when submit produces an error ?
// Not decided if I need it yet
},
submitSuccess: function($form, event) {
event.preventDefault(); // prevent default submit behaviour
// get values from FORM
var name = $("input#name").val();
var phone = $("input#phone").val();
var email = $("input#email").val();
var message = $("textarea#message").val();
var firstName = name; // For Success/Failure Message
// Check for white space in name for Success/Fail message
if (firstName.indexOf(' ') >= 0) {
firstName = name.split(' ').slice(0, -1).join(' ');
}
$.ajax({
url: "./bin/contact_me.php",
type: "POST",
data: {
name: name,
phone: phone,
email: email,
message: message
},
cache: false,
success: function() {
// Success message
$('#success').php("<div class='alert alert-success'>");
$('#success > .alert-success').php("<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×")
.append("</button>");
$('#success > .alert-success')
.append("<strong>Your message has been sent. </strong>");
$('#success > .alert-success')
.append('</div>');
//clear all fields
$('#contactForm').trigger("reset");
},
error: function() {
// Fail message
$('#success').php("<div class='alert alert-danger'>");
$('#success > .alert-danger').php("<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×")
.append("</button>");
$('#success > .alert-danger').append("<strong>Sorry " + firstName + " it seems that my mail server is not responding...</strong> Could you please email me directly to <a href='mailto:[email protected]?Subject=Message_Me from myprogrammingblog.com;>[email protected]</a> ? Sorry for the inconvenience!");
$('#success > .alert-danger').append('</div>');
//clear all fields
$('#contactForm').trigger("reset");
},
})
},
filter: function() {
return $(this).is(":visible");
},
});
$("a[data-toggle=\"tab\"]").click(function(e) {
e.preventDefault();
$(this).tab("show");
});
});
/*When clicking on Full hide fail/success boxes */
$('#name').focus(function() {
$('#success').php('');
});
| tejdeeps/tejcs.com | l4sure/js/contact_me.js | JavaScript | gpl-2.0 | 3,169 |
// Note that this configuration is used by Webpack (babel-loader) and Jest
module.exports = {
presets: [ "@babel/preset-react", "@babel/preset-env" ]
};
| php-coder/mystamps | src/main/frontend/babel.config.js | JavaScript | gpl-2.0 | 154 |
/*
* Copyright (C) eZ Systems AS. All rights reserved.
* For full copyright and license information view LICENSE file distributed with this source code.
*/
YUI.add('ez-asynchronoussubitemview', function (Y) {
"use strict";
/**
* Provides the base class for the asynchronous subitem views
*
* @module ez-subitemlistmoreview
*/
Y.namespace('eZ');
/**
* It's an abstract view for the asynchronous subitem views. It avoids
* duplicating the same method in every asynchronous subitem views.
*
* @namespace eZ
* @class AsynchronousSubitemView
* @constructor
* @extends eZ.SubitemBaseView
*/
Y.eZ.AsynchronousSubitemView = Y.Base.create('asynchronousSubitemView', Y.eZ.SubitemBaseView, [Y.eZ.AsynchronousView, Y.eZ.LoadMorePagination], {
initializer: function () {
this._fireMethod = this._prepareInitialLoad;
this._errorHandlingMethod = this._handleError;
this._getExpectedItemsCount = this._getChildCount;
this._set('loading', (this._getChildCount() > 0));
this.after('offsetChange', function (e) {
if ( this.get('offset') >= 0 ) {
this._fireLocationSearch();
}
});
this.after('loadingErrorChange', function (e) {
this._set('loading', false);
});
this.get('location').after(
['sortOrderChange', 'sortFieldChange'],
Y.bind(this._refresh, this)
);
},
/**
* Sets for the `offset` attribute to launch the initial loading of the
* subitems. This method is supposed to be called when the view becomes
* active.
*
* @method _prepareInitialLoad
* @protected
*/
_prepareInitialLoad: function () {
if ( this.get('offset') < 0 && this._getChildCount() ) {
this.set('offset', 0);
}
},
/**
* Refreshes the view if it's active. The subitems are reloaded and then
* rerendered.
*
* @method _refresh
* @protected
*/
_refresh: function () {
if ( this._getChildCount() ) {
if ( this.get('active') ) {
this.set('items', [], {reset: true});
this._set('loading', true);
this.once('loadingChange', function () {
this._destroyItemViews();
});
this._fireLocationSearch(this.get('offset') + this.get('limit'));
} else if ( this.get('offset') >= 0 ) {
this._destroyItemViews();
this.set('items', [], {reset: true});
this.reset('offset');
}
}
},
/**
* Handles the loading error. It fires a notification and makes sure the
* state of the view is consistent with what is actually loaded.
*
* @method _handleError
* @protected
*/
_handleError: function () {
if ( this.get('loadingError') ) {
this.fire('notify', {
notification: {
text: Y.eZ.trans('subitem.error.loading.list', {}, 'subitem'),
identifier: 'subitem-load-error-' + this.get('location').get('id'),
state: 'error',
timeout: 0
}
});
this._disableLoadMore();
}
},
/**
* Fires the `locationSearch` event to fetch the subitems of the
* currently displayed Location.
*
* @method _fireLocationSearch
* @param {Number} forceLimit indicates if we should force a limit value
* (and offset to 0). This is used to reload the current list of
* subitems.
* @protected
*/
_fireLocationSearch: function (forceLimit) {
var locationId = this.get('location').get('locationId');
this.set('loadingError', false);
this.fire('locationSearch', {
viewName: 'subitems-' + locationId,
resultAttribute: 'items',
loadContentType: true,
loadContent: true,
search: {
filter: {
"ParentLocationIdCriterion": this.get('location').get('locationId'),
},
offset: forceLimit ? 0 : this.get('offset'),
limit: forceLimit ? forceLimit : this.get('limit'),
sortLocation: this.get('location'),
},
});
},
});
});
| intenseprogramming/PlatformUIBundle | Resources/public/js/views/subitem/ez-asynchronoussubitemview.js | JavaScript | gpl-2.0 | 4,849 |
/*
* File Name: Helper Js file
* File Author: Design Arc
* File Description: This is helper javascript file. Used for activating js plugins and Other javascript effects adding. Thanks
*/
/*-------------------------------------
--------- TABLE OF CONTENT ------------
---------------------------------------
1.bannerSlider
2. galleryMasonaryLayout
3. GalleryFilter
4. fancyboxInit
5. gMap
6. testimonialCarosule
7. SmoothMenuScroll
8. OnePageMenuScroll
9. DeadMenuConfig
10. contactFormValidation
11. videoFancybox
12. sliding gallery
13. hiddenBarMenuConfig
14. customScrollBarHiddenSidebar
15. hiddenBarToggler
16. handlePreloader
17. stickyHeader
----------------------------------------
--------------------------------------*/
"use strict";
var $ = jQuery;
// 1.bannerSlider
// 2. galleryMasonaryLayout
function galleryMasonaryLayout () {
if ($('.masonary-gallery').length) {
var container = $('.masonary-gallery');
container.on('load', function(){
container.masonry({
itemSelector : '.masonryImage'
});
});
}
}
// 3. GalleryFilter
function GalleryFilter () {
if ($('.image-gallery').length) {
$('.image-gallery').each(function () {
var filterSelector = $(this).data('filter-class');
var showItemOnLoad = $(this).data('show-on-load');
if (showItemOnLoad) {
$(this).mixItUp({
load: {
filter: '.'+showItemOnLoad
},
selectors: {
filter: '.'+filterSelector
}
})
};
$(this).mixItUp({
selectors: {
filter: '.'+filterSelector
}
});
});
};
}
// 4. fancyboxInit
function fancyboxInit () {
if ($('a.fancybox').length) {
$('a.fancybox').fancybox();
};
}
// 6. testimonialCarosule
function testimonialCarosule () {
if ($('.testimonial-wrap .owl-carousel').length) {
$('.testimonial-wrap .owl-carousel').owlCarousel({
loop: true,
margin: 0,
nav: false,
dots: true,
items: 1,
autoplayHoverPause: true
});
}
if ($('.testimonial-wrap-style-two .owl-carousel').length) {
$('.testimonial-wrap-style-two .owl-carousel').owlCarousel({
loop: true,
margin: 0,
nav: true,
dots: false,
items: 1,
navText: [
'<i class="fa fa-angle-left"></i>',
'<i class="fa fa-angle-right"></i>'
],
autoplayHoverPause: true
});
}
}
// 7. SmoothMenuScroll
/*function SmoothMenuScroll () {
// must install jquery easein plugin
var anchor = $('.scrollToLink');
if(anchor.length){
anchor.children('a').bind('click', function (event) {
// if ($(window).scrollTop() > 10) {
// var headerH = '73';
// }else {
// var headerH = '73';
// }
var target = $(this);
var anchorHeight= target.height();
$('html, body').stop().animate({
scrollTop: $(target.attr('href')).offset().top - anchorHeight + 'px'
}, 1200, 'easeInOutExpo');
anchor.removeClass('current');
target.parent().addClass('current');
event.preventDefault();
});
}
}*/
// 8. OnePageMenuScroll
function OnePageMenuScroll () {
var windscroll = $(window).scrollTop();
if (windscroll >= 100) {
var menuWrap = $('.navigation.scroll-menu'); // change as your menu wrap
menuWrap.find('.scrollToLink a').each(function (){
// grabing section id dynamically
var sections = $(this).attr('href');
$(sections).each(function() {
// checking is scroll bar are in section
if ($(this).offset().top <= windscroll + 100) {
// grabing the dynamic id of section
var Sectionid = $(sections).attr('id');
// removing current class from others
menuWrap.find('li').removeClass('current');
// adding current class to related navigation
menuWrap.find('a[href=#'+Sectionid+']').parent().addClass('current');
}
});
});
} else {
$('.mainmenu.one-page-scroll-menu li.current').removeClass('current');
$('.mainmenu.one-page-scroll-menu li:first').addClass('current');
}
}
// 9. DeadMenuConfig
function DeadMenuConfig () {
var menuWrap = $('.navigation.scroll-menu'); // change it as your menu wrapper
var deadLink = menuWrap.find('li.deadLink');
if(deadLink.length) {
deadLink.each(function () {
$(this).children('a').on('click', function() {
return false;
});
});
}
}
// 10. contactFormValidation
// 11. videoFancybox
function videoFancybox () {
if ($('.video-fancybox').length) {
$('.video-fancybox').on('click', function () {
$(this).fancybox({
'padding' : 0,
'autoScale' : false,
'transitionIn' : 'none',
'transitionOut' : 'none',
'title' : this.title,
'width' : 640,
'height' : 385,
'href' : this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
'type' : 'swf',
'swf' : { 'wmode' : 'transparent', 'allowfullscreen' : 'true' }
});
return false;
})
};
}
// 12. sliding gallery
function slidingGallery () {
var galleryWrap = $('.sliding-gallery .image-gallery');
if (galleryWrap.length) {
galleryWrap.bxSlider({
minSlides: 1,
maxSlides: 4,
slideWidth: 480,
slideMargin: 0,
useCSS: false,
ticker: true,
autoHover:true,
tickerHover:true,
speed: 100000,
infiniteLoop: true
});
};
}
// 13. hiddenBarMenuConfig
function hiddenBarMenuConfig () {
var menuWrap = $('.hidden-bar .main-menu');
// appending expander button
menuWrap.find('.dropdown').children('a').append(function () {
return '<button type="button" class="btn expander"><i class="fa fa-chevron-down"></i></button>';
});
// hidding submenu
menuWrap.find('.dropdown').children('ul').hide();
// toggling child ul
menuWrap.find('.btn.expander').each(function () {
$(this).on('click', function () {
$(this).parent() // return parent of .btn.expander (a)
.parent() // return parent of a (li)
.children('ul').slideToggle();
// adding class to expander container
$(this).parent().toggleClass('current');
// toggling arrow of expander
$(this).find('i').toggleClass('fa-chevron-up fa-chevron-down');
return false;
});
});
}
// 14. customScrollBarHiddenSidebar
function customScrollBarHiddenSidebar () {
if ($('.hidden-bar-wrapper').length) {
$('.hidden-bar-wrapper').mCustomScrollbar();
};
}
// 15. hiddenBarToggler
function hiddenBarToggler () {
if ($('.hidden-bar-closer').length) {
$('.hidden-bar-closer').on('click', function () {
$('.hidden-bar').css({
'right': '-150%'
});
});
};
if ($('.hidden-bar-opener').length) {
$('.hidden-bar-opener').on('click', function () {
$('.hidden-bar').css({
'right': '0%'
});
});
};
}
// 16. handlePreloader
function handlePreloader() {
if($('.preloader').length){
$('.preloader').fadeOut();
}
}
// 17. stickyHeader
function stickyHeader () {
if ($('.stricky').length) {
var strickyScrollPos = $('.stricky').next().offset().top;
if($(window).scrollTop() > strickyScrollPos) {
$('.stricky').addClass('stricky-fixed');
}
else if($(this).scrollTop() <= strickyScrollPos) {
$('.stricky').removeClass('stricky-fixed');
}
};
}
// 18. zebraDatePickerInit
function zebraDatePickerInit () {
if ($('input.datepicker').length) {
$('input.datepicker').Zebra_DatePicker({
default_position: 'below'
});
};
}
// 19. revolutionSliderActiver
function revolutionSliderActiver () {
if ($('.slider-banner').length) {
var slideHeight = $('.slider-banner').data('height');
var fullScreenAlignForce = $('.slider-banner').data('full-screen-aling-force');
$('.slider-banner').revolution({
delay:5000,
startwidth:1170,
startheight:slideHeight,
startWithSlide:0,
fullScreenAlignForce: fullScreenAlignForce,
autoHeight:"off",
minHeight:"off",
shuffle:"off",
onHoverStop:"on",
thumbWidth:100,
thumbHeight:50,
thumbAmount:3,
hideThumbsOnMobile:"off",
hideNavDelayOnMobile:1500,
hideBulletsOnMobile:"off",
hideArrowsOnMobile:"off",
hideThumbsUnderResoluition:0,
hideThumbs:0,
hideTimerBar:"on",
keyboardNavigation:"on",
navigationType:"bullet",
navigationArrows: "nexttobullets",
navigationStyle:"preview4",
navigationHAlign:"center",
navigationVAlign:"bottom",
navigationHOffset:30,
navigationVOffset:30,
soloArrowLeftHalign:"left",
soloArrowLeftValign:"center",
soloArrowLeftHOffset:20,
soloArrowLeftVOffset:0,
soloArrowRightHalign:"right",
soloArrowRightValign:"center",
soloArrowRightHOffset:20,
soloArrowRightVOffset:0,
touchenabled:"on",
swipe_velocity:"0.7",
swipe_max_touches:"1",
swipe_min_touches:"1",
drag_block_vertical:"false",
parallax:"mouse",
parallaxBgFreeze:"on",
parallaxLevels:[10,7,4,3,2,5,4,3,2,1],
parallaxDisableOnMobile:"off",
stopAtSlide:-1,
stopAfterLoops:-1,
hideCaptionAtLimit:0,
hideAllCaptionAtLilmit:0,
hideSliderAtLimit:0,
dottedOverlay:"none",
spinned:"spinner4",
fullWidth:"on",
forceFullWidth:"on",
fullScreen:"off",
fullScreenOffsetContainer:"#banner",
fullScreenOffset:"0px",
panZoomDisableOnMobile:"off",
simplifyAll:"off",
shadow:0
});
}
}
// 20. galleryModal
function galleryModal () {
if ($('#single-gallery-modal').length && $('.single-gallery').length) {
$('.single-gallery .link-view').children('a').on('click', function () {
// grabing elements
var parentDiv = $(this).parents('.single-gallery');
var modalContent = parentDiv.find('.modal-content');
var itemTitle = modalContent.find('.item-name').text();
var itemImg = modalContent.find('.item-image').attr('src');
var itemContent = modalContent.find('.item-text').html();
// doing reset
$('#single-gallery-modal').find('.item-name').empty();
$('#single-gallery-modal').find('.img-holder img').attr('src', '');
$('#single-gallery-modal').find('.item-text').empty();
// adding content
$('#single-gallery-modal').find('.item-name').text(itemTitle);
$('#single-gallery-modal').find('.img-holder img').attr('src', itemImg);
$('#single-gallery-modal').find('.item-text').append(itemContent);
$('#single-gallery-modal').modal('show');
return false;
});
};
}
// instance of fuction while Document ready event
jQuery(document).on('ready', function () {
(function ($) {
//bannerSlider();
galleryMasonaryLayout();
GalleryFilter();
fancyboxInit();
testimonialCarosule();
DeadMenuConfig();
videoFancybox();
slidingGallery();
hiddenBarMenuConfig();
hiddenBarToggler();
zebraDatePickerInit();
revolutionSliderActiver();
galleryModal();
$('.onepage_menu > ul > li:first-child').addClass('current');
$('.onepage_menu > ul').onePageNav();
})(jQuery);
});
// instance of fuction while Window Load event
jQuery(window).on('load', function () {
(function ($) {
//SmoothMenuScroll();
customScrollBarHiddenSidebar();
handlePreloader();
})(jQuery);
});
// instance of fuction while Window Scroll event
jQuery(window).on('scroll', function () {
(function ($) {
OnePageMenuScroll();
stickyHeader();
})(jQuery);
}); | indexcosmos/renzi | wp-content/themes/apartvilla/js/custom.js | JavaScript | gpl-2.0 | 11,100 |
/**
* @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* This file was added automatically by CKEditor builder.
* You may re-use it at any time at http://ckeditor.com/builder to build CKEditor again.
*
* NOTE:
* This file is not used by CKEditor, you may remove it.
* Changing this file will not change your CKEditor configuration.
*/
var CKBUILDER_CONFIG = {
skin: 'moonocolor',
preset: 'full',
ignore: [
'dev',
'.gitignore',
'.gitattributes',
'README.md',
'.mailmap'
],
plugins : {
'about' : 1,
'a11yhelp' : 1,
'dialogadvtab' : 1,
'basicstyles' : 1,
'bidi' : 1,
'blockquote' : 1,
'clipboard' : 1,
'colorbutton' : 1,
'colordialog' : 1,
'templates' : 1,
'contextmenu' : 1,
'div' : 1,
'resize' : 1,
'toolbar' : 1,
'elementspath' : 1,
'enterkey' : 1,
'entities' : 1,
'filebrowser' : 1,
'find' : 1,
'flash' : 1,
'floatingspace' : 1,
'font' : 1,
'forms' : 1,
'format' : 1,
'horizontalrule' : 1,
'htmlwriter' : 1,
'iframe' : 1,
'wysiwygarea' : 1,
'image' : 1,
'indentblock' : 1,
'indentlist' : 1,
'smiley' : 1,
'justify' : 1,
'language' : 1,
'link' : 1,
'list' : 1,
'liststyle' : 1,
'magicline' : 1,
'maximize' : 1,
'newpage' : 1,
'pagebreak' : 1,
'pastetext' : 1,
'pastefromword' : 1,
'preview' : 1,
'print' : 1,
'removeformat' : 1,
'save' : 1,
'selectall' : 1,
'showblocks' : 1,
'showborders' : 1,
'sourcearea' : 1,
'specialchar' : 1,
'scayt' : 1,
'stylescombo' : 1,
'tab' : 1,
'table' : 1,
'tabletools' : 1,
'undo' : 1,
'wsc' : 1,
'dialog' : 1,
'dialogui' : 1,
'panelbutton' : 1,
'button' : 1,
'floatpanel' : 1,
'panel' : 1,
'menu' : 1,
'popup' : 1,
'fakeobjects' : 1,
'richcombo' : 1,
'listblock' : 1,
'indent' : 1,
'menubutton' : 1,
'autogrow' : 1,
'lineutils' : 1,
'widget' : 1,
'placeholder' : 1,
'stylesheetparser' : 1
},
languages : {
'en' : 1,
'fr' : 1
}
}; | SecondBureau/refinerycms-activebackend | app/assets/javascripts/vendor/ckeditor/build-config.js | JavaScript | gpl-2.0 | 2,095 |
enyo.kind({
name: "CoreNavi",
style: "background-color: black;",
layoutKind: "FittableColumnsLayout",
fingerTracking: false, //Use legacy keyEvents by default, set to true to enable finger-tracking events
components:[
{style: "width: 33%;"},
{kind: "Image",
src: "$lib/webos-lib/assets/lightbar.png",
fit: true,
style: "width: 33%; height: 24px; padding-top: 2px;",
ondragstart: "handleDragStart",
ondrag: "handleDrag",
ondragfinish: "handleDragFinish"},
{style: "width: 33%;"},
],
//Hide on hosts with a hardware gesture area
create: function() {
this.inherited(arguments);
if(window.PalmSystem)
this.addStyles("display: none;");
},
//CoreNaviDrag Event Synthesis
handleDragStart: function(inSender, inEvent) {
//Back Gesture
if(this.fingerTracking == false) {
if(inEvent.xDirection == -1) {
//Back Gesture
evB = document.createEvent("HTMLEvents");
evB.initEvent("keyup", "true", "true");
evB.keyIdentifier = "U+1200001";
document.dispatchEvent(evB);
}
else {
//Forward Gesture
}
}
else {
//Custom drag event
enyo.Signals && enyo.Signals.send && enyo.Signals.send('onCoreNaviDragStart', inEvent);
}
},
handleDrag: function(inSender, inEvent) {
if(this.fingerTracking == true) {
//Custom drag event
enyo.Signals && enyo.Signals.send && enyo.Signals.send('onCoreNaviDrag', inEvent);
}
},
handleDragFinish: function(inSender, inEvent) {
if(this.fingerTracking == true) {
//Custom drag event
enyo.Signals && enyo.Signals.send && enyo.Signals.send('onCoreNaviDragFinish', inEvent);
}
},
});
| janthiemen/owo_filemanager | filemanager.application/lib/webos-lib/source/CoreNavi.js | JavaScript | gpl-2.0 | 1,600 |
/**
* AvaTax Brazil
* The Avatax-Brazil API exposes the most commonly services available for interacting with the AvaTax-Brazil services, allowing calculation of taxes, issuing electronic invoice documents and modifying existing transactions when allowed by tax authorities. This API is exclusively for use by business with a physical presence in Brazil.
*
* OpenAPI spec version: 1.0
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*
*/
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD.
define(['expect.js', '../../src/index'], factory);
} else if (typeof module === 'object' && module.exports) {
// CommonJS-like environments that support module.exports, like Node.
factory(require('expect.js'), require('../../src/index'));
} else {
// Browser globals (root is window)
factory(root.expect, root.AvaTaxBrazil);
}
}(this, function(expect, AvaTaxBrazil) {
'use strict';
var instance;
beforeEach(function() {
instance = new AvaTaxBrazil.Body4();
});
var getProperty = function(object, getter, property) {
// Use getter method if present; otherwise, get the property directly.
if (typeof object[getter] === 'function')
return object[getter]();
else
return object[property];
}
var setProperty = function(object, setter, property, value) {
// Use setter method if present; otherwise, set the property directly.
if (typeof object[setter] === 'function')
object[setter](value);
else
object[property] = value;
}
describe('Body4', function() {
it('should create an instance of Body4', function() {
// uncomment below and update the code to test Body4
//var instane = new AvaTaxBrazil.Body4();
//expect(instance).to.be.a(AvaTaxBrazil.Body4);
});
it('should have the property startDate (base name: "startDate")', function() {
// uncomment below and update the code to test the property startDate
//var instane = new AvaTaxBrazil.Body4();
//expect(instance).to.be();
});
it('should have the property finishDate (base name: "finishDate")', function() {
// uncomment below and update the code to test the property finishDate
//var instane = new AvaTaxBrazil.Body4();
//expect(instance).to.be();
});
});
}));
| Avalara/avataxbr-clients | javascript-client/test/model/Body4.spec.js | JavaScript | gpl-3.0 | 2,454 |
var db = require('../db');
var User = db.model('User', {
username: {
type: String,
required: true
},
email: {
type: String,
required: true
},
password: {
type: String,
required: true,
select: false
},
active: {
type: Boolean,
default: true,
select: false
},
resetToken: {
type: String
},
resetTokenValid: {
type: Date
}
});
module.exports = User; | MICSTI/ping | models/user.js | JavaScript | gpl-3.0 | 492 |
/************************************************************************
* This file is part of EspoCRM.
*
* EspoCRM - Open Source CRM application.
* Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
* Website: http://www.espocrm.com
*
* EspoCRM is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* EspoCRM is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
*
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
Espo.define('views/fields/date', 'views/fields/base', function (Dep) {
return Dep.extend({
type: 'date',
editTemplate: 'fields/date/edit',
searchTemplate: 'fields/date/search',
validations: ['required', 'date', 'after', 'before'],
searchTypeOptions: ['lastSevenDays', 'ever', 'currentMonth', 'lastMonth', 'currentQuarter', 'lastQuarter', 'currentYear', 'lastYear', 'today', 'past', 'future', 'lastXDays', 'nextXDays', 'on', 'after', 'before', 'between'],
setup: function () {
Dep.prototype.setup.call(this);
},
data: function () {
if (this.mode === 'search') {
this.searchData.dateValue = this.getDateTime().toDisplayDate(this.searchParams.dateValue);
this.searchData.dateValueTo = this.getDateTime().toDisplayDate(this.searchParams.dateValueTo);
}
return Dep.prototype.data.call(this);
},
setupSearch: function () {
this.searchData.typeOptions = this.searchTypeOptions;
this.events = _.extend({
'change select.search-type': function (e) {
var type = $(e.currentTarget).val();
this.handleSearchType(type);
},
}, this.events || {});
},
stringifyDateValue: function (value) {
if (!value) {
if (this.mode == 'edit' || this.mode == 'search') {
return '';
}
return this.translate('None');
}
if (this.mode == 'list' || this.mode == 'detail') {
if (this.getConfig().get('readableDateFormatDisabled')) {
return this.getDateTime().toDisplayDate(value);
}
var d = moment.utc(value, this.getDateTime().internalDateFormat);
var today = moment().tz('UTC').startOf('day');
var dt = today.clone();
var ranges = {
'today': [dt.unix(), dt.add(1, 'days').unix()],
'tomorrow': [dt.unix(), dt.add(1, 'days').unix()],
'yesterday': [dt.add(-3, 'days').unix(), dt.add(1, 'days').unix()]
};
if (d.unix() >= ranges['today'][0] && d.unix() < ranges['today'][1]) {
return this.translate('Today');
} else if (d.unix() >= ranges['tomorrow'][0] && d.unix() < ranges['tomorrow'][1]) {
return this.translate('Tomorrow');
} else if (d.unix() >= ranges['yesterday'][0] && d.unix() < ranges['yesterday'][1]) {
return this.translate('Yesterday');
}
var readableFormat = this.getDateTime().getReadableDateFormat();
if (d.format('YYYY') == today.format('YYYY')) {
return d.format(readableFormat);
} else {
return d.format(readableFormat + ', YYYY');
}
}
return this.getDateTime().toDisplayDate(value);
},
getValueForDisplay: function () {
var value = this.model.get(this.name);
return this.stringifyDateValue(value);
},
afterRender: function () {
if (this.mode == 'edit' || this.mode == 'search') {
this.$element = this.$el.find('[name="' + this.name + '"]');
var wait = false;
this.$element.on('change', function () {
if (!wait) {
this.trigger('change');
wait = true;
setTimeout(function () {
wait = false
}, 100);
}
}.bind(this));
var options = {
format: this.getDateTime().dateFormat.toLowerCase(),
weekStart: this.getDateTime().weekStart,
autoclose: true,
todayHighlight: true,
};
var language = this.getConfig().get('language');
if (!(language in $.fn.datepicker.dates)) {
$.fn.datepicker.dates[language] = {
days: this.translate('dayNames', 'lists'),
daysShort: this.translate('dayNamesShort', 'lists'),
daysMin: this.translate('dayNamesMin', 'lists'),
months: this.translate('monthNames', 'lists'),
monthsShort: this.translate('monthNamesShort', 'lists'),
today: this.translate('Today'),
clear: this.translate('Clear'),
};
}
var options = {
format: this.getDateTime().dateFormat.toLowerCase(),
weekStart: this.getDateTime().weekStart,
autoclose: true,
todayHighlight: true,
language: language
};
var $datePicker = this.$element.datepicker(options).on('show', function (e) {
$('body > .datepicker.datepicker-dropdown').css('z-index', 1200);
}.bind(this));
if (this.mode == 'search') {
var $elAdd = this.$el.find('input[name="' + this.name + '-additional"]');
$elAdd.datepicker(options).on('show', function (e) {
$('body > .datepicker.datepicker-dropdown').css('z-index', 1200);
}.bind(this));
$elAdd.parent().find('button.date-picker-btn').on('click', function (e) {
$elAdd.datepicker('show');
});
}
this.$element.parent().find('button.date-picker-btn').on('click', function (e) {
this.$element.datepicker('show');
}.bind(this));
if (this.mode == 'search') {
var $searchType = this.$el.find('select.search-type');
this.handleSearchType($searchType.val());
}
}
},
handleSearchType: function (type) {
this.$el.find('div.primary').addClass('hidden');
this.$el.find('div.additional').addClass('hidden');
this.$el.find('div.additional-number').addClass('hidden');
if (~['on', 'notOn', 'after', 'before'].indexOf(type)) {
this.$el.find('div.primary').removeClass('hidden');
} else if (~['lastXDays', 'nextXDays'].indexOf(type)) {
this.$el.find('div.additional-number').removeClass('hidden');
} else if (type == 'between') {
this.$el.find('div.primary').removeClass('hidden');
this.$el.find('div.additional').removeClass('hidden');
}
},
parseDate: function (string) {
return this.getDateTime().fromDisplayDate(string);
},
parse: function (string) {
return this.parseDate(string);
},
fetch: function () {
var data = {};
data[this.name] = this.parse(this.$element.val());
return data;
},
fetchSearch: function () {
var value = this.parseDate(this.$element.val());
var type = this.$el.find('[name="'+this.name+'-type"]').val();
var data;
if (type == 'between') {
if (!value) {
return false;
}
var valueTo = this.parseDate(this.$el.find('[name="' + this.name + '-additional"]').val());
if (!valueTo) {
return false;
}
data = {
type: type,
value: [value, valueTo],
dateValue: value,
dateValueTo: valueTo
};
} else if (~['lastXDays', 'nextXDays'].indexOf(type)) {
var number = this.$el.find('[name="' + this.name + '-number"]').val();
data = {
type: type,
value: number,
number: number
};
} else if (~['on', 'notOn', 'after', 'before'].indexOf(type)) {
if (!value) {
return false;
}
data = {
type: type,
value: value,
dateValue: value
};
} else {
data = {
type: type
};
}
return data;
},
validateRequired: function () {
if (this.isRequired()) {
if (this.model.get(this.name) === null) {
var msg = this.translate('fieldIsRequired', 'messages').replace('{field}', this.translate(this.name, 'fields', this.model.name));
this.showValidationMessage(msg);
return true;
}
}
},
validateDate: function () {
if (this.model.get(this.name) === -1) {
var msg = this.translate('fieldShouldBeDate', 'messages').replace('{field}', this.translate(this.name, 'fields', this.model.name));
this.showValidationMessage(msg);
return true;
}
},
validateAfter: function () {
var field = this.model.getFieldParam(this.name, 'after');
if (field) {
var value = this.model.get(this.name);
var otherValue = this.model.get(field);
if (value && otherValue) {
if (moment(value).unix() <= moment(otherValue).unix()) {
var msg = this.translate('fieldShouldAfter', 'messages').replace('{field}', this.translate(this.name, 'fields', this.model.name))
.replace('{otherField}', this.translate(field, 'fields', this.model.name));
this.showValidationMessage(msg);
return true;
}
}
}
},
validateBefore: function () {
var field = this.model.getFieldParam(this.name, 'before');
if (field) {
var value = this.model.get(this.name);
var otherValue = this.model.get(field);
if (value && otherValue) {
if (moment(value).unix() >= moment(otherValue).unix()) {
var msg = this.translate('fieldShouldBefore', 'messages').replace('{field}', this.translate(this.name, 'fields', this.model.name))
.replace('{otherField}', this.translate(field, 'fields', this.model.name));
this.showValidationMessage(msg);
return true;
}
}
}
},
});
});
| IgorGulyaev/iteamzen | client/src/views/fields/date.js | JavaScript | gpl-3.0 | 12,615 |
define([
'core/js/adapt'
], function (Adapt) {
var PopupView = Backbone.View.extend({
className: 'iconpopup__popup',
events: {
'click .js-iconpopup-close-btn-click': 'closePopup'
},
initialize: function () {
this.listenToOnce(Adapt, 'notify:opened', this.onOpened);
// Audio
this.audioIsEnabled = this.model.get('audioIsEnabled');
if (this.audioIsEnabled) {
this.audioChannel = this.model.get('audioChannel');
this.audioSrc = this.model.get('_audio').src;
this.audioId = this.model.get('audioId');
}
this.render();
},
onOpened: function () {
if (!this.audioIsEnabled) return;
if (Adapt.audio.audioClip[this.audioChannel].status==1) {
Adapt.audio.audioClip[this.audioChannel].onscreenID = "";
Adapt.trigger('audio:playAudio', this.audioSrc, this.audioId, this.audioChannel);
}
},
render: function () {
var data = this.model.toJSON();
var template = Handlebars.templates['popup'];
this.$el.html(template(data));
},
closePopup: function (event) {
Adapt.trigger('notify:close');
}
});
return PopupView;
});
| deltanet/adapt-icon-popup | js/popupView.js | JavaScript | gpl-3.0 | 1,192 |
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
/* Copyright 2012 Mozilla Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*jshint globalstrict: false */
// Initializing PDFJS global object (if still undefined)
if (typeof PDFJS === 'undefined') {
(typeof window !== 'undefined' ? window : this).PDFJS = {};
}
PDFJS.version = '1.0.21';
PDFJS.build = 'f954cde';
(function pdfjsWrapper() {
// Use strict in our context only - users might not want it
'use strict';
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
/* Copyright 2012 Mozilla Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals Cmd, ColorSpace, Dict, MozBlobBuilder, Name, PDFJS, Ref, URL,
Promise */
'use strict';
var globalScope = (typeof window === 'undefined') ? this : window;
var isWorker = (typeof window == 'undefined');
var FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0];
var TextRenderingMode = {
FILL: 0,
STROKE: 1,
FILL_STROKE: 2,
INVISIBLE: 3,
FILL_ADD_TO_PATH: 4,
STROKE_ADD_TO_PATH: 5,
FILL_STROKE_ADD_TO_PATH: 6,
ADD_TO_PATH: 7,
FILL_STROKE_MASK: 3,
ADD_TO_PATH_FLAG: 4
};
var ImageKind = {
GRAYSCALE_1BPP: 1,
RGB_24BPP: 2,
RGBA_32BPP: 3
};
// The global PDFJS object exposes the API
// In production, it will be declared outside a global wrapper
// In development, it will be declared here
if (!globalScope.PDFJS) {
globalScope.PDFJS = {};
}
globalScope.PDFJS.pdfBug = false;
PDFJS.VERBOSITY_LEVELS = {
errors: 0,
warnings: 1,
infos: 5
};
// All the possible operations for an operator list.
var OPS = PDFJS.OPS = {
// Intentionally start from 1 so it is easy to spot bad operators that will be
// 0's.
dependency: 1,
setLineWidth: 2,
setLineCap: 3,
setLineJoin: 4,
setMiterLimit: 5,
setDash: 6,
setRenderingIntent: 7,
setFlatness: 8,
setGState: 9,
save: 10,
restore: 11,
transform: 12,
moveTo: 13,
lineTo: 14,
curveTo: 15,
curveTo2: 16,
curveTo3: 17,
closePath: 18,
rectangle: 19,
stroke: 20,
closeStroke: 21,
fill: 22,
eoFill: 23,
fillStroke: 24,
eoFillStroke: 25,
closeFillStroke: 26,
closeEOFillStroke: 27,
endPath: 28,
clip: 29,
eoClip: 30,
beginText: 31,
endText: 32,
setCharSpacing: 33,
setWordSpacing: 34,
setHScale: 35,
setLeading: 36,
setFont: 37,
setTextRenderingMode: 38,
setTextRise: 39,
moveText: 40,
setLeadingMoveText: 41,
setTextMatrix: 42,
nextLine: 43,
showText: 44,
showSpacedText: 45,
nextLineShowText: 46,
nextLineSetSpacingShowText: 47,
setCharWidth: 48,
setCharWidthAndBounds: 49,
setStrokeColorSpace: 50,
setFillColorSpace: 51,
setStrokeColor: 52,
setStrokeColorN: 53,
setFillColor: 54,
setFillColorN: 55,
setStrokeGray: 56,
setFillGray: 57,
setStrokeRGBColor: 58,
setFillRGBColor: 59,
setStrokeCMYKColor: 60,
setFillCMYKColor: 61,
shadingFill: 62,
beginInlineImage: 63,
beginImageData: 64,
endInlineImage: 65,
paintXObject: 66,
markPoint: 67,
markPointProps: 68,
beginMarkedContent: 69,
beginMarkedContentProps: 70,
endMarkedContent: 71,
beginCompat: 72,
endCompat: 73,
paintFormXObjectBegin: 74,
paintFormXObjectEnd: 75,
beginGroup: 76,
endGroup: 77,
beginAnnotations: 78,
endAnnotations: 79,
beginAnnotation: 80,
endAnnotation: 81,
paintJpegXObject: 82,
paintImageMaskXObject: 83,
paintImageMaskXObjectGroup: 84,
paintImageXObject: 85,
paintInlineImageXObject: 86,
paintInlineImageXObjectGroup: 87,
paintImageXObjectRepeat: 88,
paintImageMaskXObjectRepeat: 89,
paintSolidColorImageMask: 90
};
// A notice for devs. These are good for things that are helpful to devs, such
// as warning that Workers were disabled, which is important to devs but not
// end users.
function info(msg) {
if (PDFJS.verbosity >= PDFJS.VERBOSITY_LEVELS.infos) {
console.log('Info: ' + msg);
}
}
// Non-fatal warnings.
function warn(msg) {
if (PDFJS.verbosity >= PDFJS.VERBOSITY_LEVELS.warnings) {
console.log('Warning: ' + msg);
}
}
// Fatal errors that should trigger the fallback UI and halt execution by
// throwing an exception.
function error(msg) {
// If multiple arguments were passed, pass them all to the log function.
if (arguments.length > 1) {
var logArguments = ['Error:'];
logArguments.push.apply(logArguments, arguments);
console.log.apply(console, logArguments);
// Join the arguments into a single string for the lines below.
msg = [].join.call(arguments, ' ');
} else {
console.log('Error: ' + msg);
}
console.log(backtrace());
UnsupportedManager.notify(UNSUPPORTED_FEATURES.unknown);
throw new Error(msg);
}
function backtrace() {
try {
throw new Error();
} catch (e) {
return e.stack ? e.stack.split('\n').slice(2).join('\n') : '';
}
}
function assert(cond, msg) {
if (!cond) {
error(msg);
}
}
var UNSUPPORTED_FEATURES = PDFJS.UNSUPPORTED_FEATURES = {
unknown: 'unknown',
forms: 'forms',
javaScript: 'javaScript',
smask: 'smask',
shadingPattern: 'shadingPattern',
font: 'font'
};
var UnsupportedManager = PDFJS.UnsupportedManager =
(function UnsupportedManagerClosure() {
var listeners = [];
return {
listen: function (cb) {
listeners.push(cb);
},
notify: function (featureId) {
warn('Unsupported feature "' + featureId + '"');
for (var i = 0, ii = listeners.length; i < ii; i++) {
listeners[i](featureId);
}
}
};
})();
// Combines two URLs. The baseUrl shall be absolute URL. If the url is an
// absolute URL, it will be returned as is.
function combineUrl(baseUrl, url) {
if (!url) {
return baseUrl;
}
if (/^[a-z][a-z0-9+\-.]*:/i.test(url)) {
return url;
}
var i;
if (url.charAt(0) == '/') {
// absolute path
i = baseUrl.indexOf('://');
if (url.charAt(1) === '/') {
++i;
} else {
i = baseUrl.indexOf('/', i + 3);
}
return baseUrl.substring(0, i) + url;
} else {
// relative path
var pathLength = baseUrl.length;
i = baseUrl.lastIndexOf('#');
pathLength = i >= 0 ? i : pathLength;
i = baseUrl.lastIndexOf('?', pathLength);
pathLength = i >= 0 ? i : pathLength;
var prefixLength = baseUrl.lastIndexOf('/', pathLength);
return baseUrl.substring(0, prefixLength + 1) + url;
}
}
// Validates if URL is safe and allowed, e.g. to avoid XSS.
function isValidUrl(url, allowRelative) {
if (!url) {
return false;
}
// RFC 3986 (http://tools.ietf.org/html/rfc3986#section-3.1)
// scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
var protocol = /^[a-z][a-z0-9+\-.]*(?=:)/i.exec(url);
if (!protocol) {
return allowRelative;
}
protocol = protocol[0].toLowerCase();
switch (protocol) {
case 'http':
case 'https':
case 'ftp':
case 'mailto':
return true;
default:
return false;
}
}
PDFJS.isValidUrl = isValidUrl;
function shadow(obj, prop, value) {
Object.defineProperty(obj, prop, { value: value,
enumerable: true,
configurable: true,
writable: false });
return value;
}
var PasswordResponses = PDFJS.PasswordResponses = {
NEED_PASSWORD: 1,
INCORRECT_PASSWORD: 2
};
var PasswordException = (function PasswordExceptionClosure() {
function PasswordException(msg, code) {
this.name = 'PasswordException';
this.message = msg;
this.code = code;
}
PasswordException.prototype = new Error();
PasswordException.constructor = PasswordException;
return PasswordException;
})();
var UnknownErrorException = (function UnknownErrorExceptionClosure() {
function UnknownErrorException(msg, details) {
this.name = 'UnknownErrorException';
this.message = msg;
this.details = details;
}
UnknownErrorException.prototype = new Error();
UnknownErrorException.constructor = UnknownErrorException;
return UnknownErrorException;
})();
var InvalidPDFException = (function InvalidPDFExceptionClosure() {
function InvalidPDFException(msg) {
this.name = 'InvalidPDFException';
this.message = msg;
}
InvalidPDFException.prototype = new Error();
InvalidPDFException.constructor = InvalidPDFException;
return InvalidPDFException;
})();
var MissingPDFException = (function MissingPDFExceptionClosure() {
function MissingPDFException(msg) {
this.name = 'MissingPDFException';
this.message = msg;
}
MissingPDFException.prototype = new Error();
MissingPDFException.constructor = MissingPDFException;
return MissingPDFException;
})();
var NotImplementedException = (function NotImplementedExceptionClosure() {
function NotImplementedException(msg) {
this.message = msg;
}
NotImplementedException.prototype = new Error();
NotImplementedException.prototype.name = 'NotImplementedException';
NotImplementedException.constructor = NotImplementedException;
return NotImplementedException;
})();
var MissingDataException = (function MissingDataExceptionClosure() {
function MissingDataException(begin, end) {
this.begin = begin;
this.end = end;
this.message = 'Missing data [' + begin + ', ' + end + ')';
}
MissingDataException.prototype = new Error();
MissingDataException.prototype.name = 'MissingDataException';
MissingDataException.constructor = MissingDataException;
return MissingDataException;
})();
var XRefParseException = (function XRefParseExceptionClosure() {
function XRefParseException(msg) {
this.message = msg;
}
XRefParseException.prototype = new Error();
XRefParseException.prototype.name = 'XRefParseException';
XRefParseException.constructor = XRefParseException;
return XRefParseException;
})();
function bytesToString(bytes) {
var length = bytes.length;
var MAX_ARGUMENT_COUNT = 8192;
if (length < MAX_ARGUMENT_COUNT) {
return String.fromCharCode.apply(null, bytes);
}
var strBuf = [];
for (var i = 0; i < length; i += MAX_ARGUMENT_COUNT) {
var chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length);
var chunk = bytes.subarray(i, chunkEnd);
strBuf.push(String.fromCharCode.apply(null, chunk));
}
return strBuf.join('');
}
function stringToArray(str) {
var length = str.length;
var array = [];
for (var i = 0; i < length; ++i) {
array[i] = str.charCodeAt(i);
}
return array;
}
function stringToBytes(str) {
var length = str.length;
var bytes = new Uint8Array(length);
for (var i = 0; i < length; ++i) {
bytes[i] = str.charCodeAt(i) & 0xFF;
}
return bytes;
}
function string32(value) {
return String.fromCharCode((value >> 24) & 0xff, (value >> 16) & 0xff,
(value >> 8) & 0xff, value & 0xff);
}
// Lazy test the endianness of the platform
// NOTE: This will be 'true' for simulated TypedArrays
function isLittleEndian() {
var buffer8 = new Uint8Array(2);
buffer8[0] = 1;
var buffer16 = new Uint16Array(buffer8.buffer);
return (buffer16[0] === 1);
}
Object.defineProperty(PDFJS, 'isLittleEndian', {
configurable: true,
get: function PDFJS_isLittleEndian() {
return shadow(PDFJS, 'isLittleEndian', isLittleEndian());
}
});
// Lazy test if the userAgant support CanvasTypedArrays
function hasCanvasTypedArrays() {
var canvas = document.createElement('canvas');
canvas.width = canvas.height = 1;
var ctx = canvas.getContext('2d');
var imageData = ctx.createImageData(1, 1);
return (typeof imageData.data.buffer !== 'undefined');
}
Object.defineProperty(PDFJS, 'hasCanvasTypedArrays', {
configurable: true,
get: function PDFJS_hasCanvasTypedArrays() {
return shadow(PDFJS, 'hasCanvasTypedArrays', hasCanvasTypedArrays());
}
});
var Uint32ArrayView = (function Uint32ArrayViewClosure() {
function Uint32ArrayView(buffer, length) {
this.buffer = buffer;
this.byteLength = buffer.length;
this.length = length === undefined ? (this.byteLength >> 2) : length;
ensureUint32ArrayViewProps(this.length);
}
Uint32ArrayView.prototype = Object.create(null);
var uint32ArrayViewSetters = 0;
function createUint32ArrayProp(index) {
return {
get: function () {
var buffer = this.buffer, offset = index << 2;
return (buffer[offset] | (buffer[offset + 1] << 8) |
(buffer[offset + 2] << 16) | (buffer[offset + 3] << 24)) >>> 0;
},
set: function (value) {
var buffer = this.buffer, offset = index << 2;
buffer[offset] = value & 255;
buffer[offset + 1] = (value >> 8) & 255;
buffer[offset + 2] = (value >> 16) & 255;
buffer[offset + 3] = (value >>> 24) & 255;
}
};
}
function ensureUint32ArrayViewProps(length) {
while (uint32ArrayViewSetters < length) {
Object.defineProperty(Uint32ArrayView.prototype,
uint32ArrayViewSetters,
createUint32ArrayProp(uint32ArrayViewSetters));
uint32ArrayViewSetters++;
}
}
return Uint32ArrayView;
})();
var IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];
var Util = PDFJS.Util = (function UtilClosure() {
function Util() {}
Util.makeCssRgb = function Util_makeCssRgb(rgb) {
return 'rgb(' + rgb[0] + ',' + rgb[1] + ',' + rgb[2] + ')';
};
Util.makeCssCmyk = function Util_makeCssCmyk(cmyk) {
var rgb = ColorSpace.singletons.cmyk.getRgb(cmyk, 0);
return Util.makeCssRgb(rgb);
};
// Concatenates two transformation matrices together and returns the result.
Util.transform = function Util_transform(m1, m2) {
return [
m1[0] * m2[0] + m1[2] * m2[1],
m1[1] * m2[0] + m1[3] * m2[1],
m1[0] * m2[2] + m1[2] * m2[3],
m1[1] * m2[2] + m1[3] * m2[3],
m1[0] * m2[4] + m1[2] * m2[5] + m1[4],
m1[1] * m2[4] + m1[3] * m2[5] + m1[5]
];
};
// For 2d affine transforms
Util.applyTransform = function Util_applyTransform(p, m) {
var xt = p[0] * m[0] + p[1] * m[2] + m[4];
var yt = p[0] * m[1] + p[1] * m[3] + m[5];
return [xt, yt];
};
Util.applyInverseTransform = function Util_applyInverseTransform(p, m) {
var d = m[0] * m[3] - m[1] * m[2];
var xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d;
var yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d;
return [xt, yt];
};
// Applies the transform to the rectangle and finds the minimum axially
// aligned bounding box.
Util.getAxialAlignedBoundingBox =
function Util_getAxialAlignedBoundingBox(r, m) {
var p1 = Util.applyTransform(r, m);
var p2 = Util.applyTransform(r.slice(2, 4), m);
var p3 = Util.applyTransform([r[0], r[3]], m);
var p4 = Util.applyTransform([r[2], r[1]], m);
return [
Math.min(p1[0], p2[0], p3[0], p4[0]),
Math.min(p1[1], p2[1], p3[1], p4[1]),
Math.max(p1[0], p2[0], p3[0], p4[0]),
Math.max(p1[1], p2[1], p3[1], p4[1])
];
};
Util.inverseTransform = function Util_inverseTransform(m) {
var d = m[0] * m[3] - m[1] * m[2];
return [m[3] / d, -m[1] / d, -m[2] / d, m[0] / d,
(m[2] * m[5] - m[4] * m[3]) / d, (m[4] * m[1] - m[5] * m[0]) / d];
};
// Apply a generic 3d matrix M on a 3-vector v:
// | a b c | | X |
// | d e f | x | Y |
// | g h i | | Z |
// M is assumed to be serialized as [a,b,c,d,e,f,g,h,i],
// with v as [X,Y,Z]
Util.apply3dTransform = function Util_apply3dTransform(m, v) {
return [
m[0] * v[0] + m[1] * v[1] + m[2] * v[2],
m[3] * v[0] + m[4] * v[1] + m[5] * v[2],
m[6] * v[0] + m[7] * v[1] + m[8] * v[2]
];
};
// This calculation uses Singular Value Decomposition.
// The SVD can be represented with formula A = USV. We are interested in the
// matrix S here because it represents the scale values.
Util.singularValueDecompose2dScale =
function Util_singularValueDecompose2dScale(m) {
var transpose = [m[0], m[2], m[1], m[3]];
// Multiply matrix m with its transpose.
var a = m[0] * transpose[0] + m[1] * transpose[2];
var b = m[0] * transpose[1] + m[1] * transpose[3];
var c = m[2] * transpose[0] + m[3] * transpose[2];
var d = m[2] * transpose[1] + m[3] * transpose[3];
// Solve the second degree polynomial to get roots.
var first = (a + d) / 2;
var second = Math.sqrt((a + d) * (a + d) - 4 * (a * d - c * b)) / 2;
var sx = first + second || 1;
var sy = first - second || 1;
// Scale values are the square roots of the eigenvalues.
return [Math.sqrt(sx), Math.sqrt(sy)];
};
// Normalize rectangle rect=[x1, y1, x2, y2] so that (x1,y1) < (x2,y2)
// For coordinate systems whose origin lies in the bottom-left, this
// means normalization to (BL,TR) ordering. For systems with origin in the
// top-left, this means (TL,BR) ordering.
Util.normalizeRect = function Util_normalizeRect(rect) {
var r = rect.slice(0); // clone rect
if (rect[0] > rect[2]) {
r[0] = rect[2];
r[2] = rect[0];
}
if (rect[1] > rect[3]) {
r[1] = rect[3];
r[3] = rect[1];
}
return r;
};
// Returns a rectangle [x1, y1, x2, y2] corresponding to the
// intersection of rect1 and rect2. If no intersection, returns 'false'
// The rectangle coordinates of rect1, rect2 should be [x1, y1, x2, y2]
Util.intersect = function Util_intersect(rect1, rect2) {
function compare(a, b) {
return a - b;
}
// Order points along the axes
var orderedX = [rect1[0], rect1[2], rect2[0], rect2[2]].sort(compare),
orderedY = [rect1[1], rect1[3], rect2[1], rect2[3]].sort(compare),
result = [];
rect1 = Util.normalizeRect(rect1);
rect2 = Util.normalizeRect(rect2);
// X: first and second points belong to different rectangles?
if ((orderedX[0] === rect1[0] && orderedX[1] === rect2[0]) ||
(orderedX[0] === rect2[0] && orderedX[1] === rect1[0])) {
// Intersection must be between second and third points
result[0] = orderedX[1];
result[2] = orderedX[2];
} else {
return false;
}
// Y: first and second points belong to different rectangles?
if ((orderedY[0] === rect1[1] && orderedY[1] === rect2[1]) ||
(orderedY[0] === rect2[1] && orderedY[1] === rect1[1])) {
// Intersection must be between second and third points
result[1] = orderedY[1];
result[3] = orderedY[2];
} else {
return false;
}
return result;
};
Util.sign = function Util_sign(num) {
return num < 0 ? -1 : 1;
};
// TODO(mack): Rename appendToArray
Util.concatenateToArray = function concatenateToArray(arr1, arr2) {
Array.prototype.push.apply(arr1, arr2);
};
Util.prependToArray = function concatenateToArray(arr1, arr2) {
Array.prototype.unshift.apply(arr1, arr2);
};
Util.extendObj = function extendObj(obj1, obj2) {
for (var key in obj2) {
obj1[key] = obj2[key];
}
};
Util.getInheritableProperty = function Util_getInheritableProperty(dict,
name) {
while (dict && !dict.has(name)) {
dict = dict.get('Parent');
}
if (!dict) {
return null;
}
return dict.get(name);
};
Util.inherit = function Util_inherit(sub, base, prototype) {
sub.prototype = Object.create(base.prototype);
sub.prototype.constructor = sub;
for (var prop in prototype) {
sub.prototype[prop] = prototype[prop];
}
};
Util.loadScript = function Util_loadScript(src, callback) {
var script = document.createElement('script');
var loaded = false;
script.setAttribute('src', src);
if (callback) {
script.onload = function() {
if (!loaded) {
callback();
}
loaded = true;
};
}
document.getElementsByTagName('head')[0].appendChild(script);
};
return Util;
})();
var PageViewport = PDFJS.PageViewport = (function PageViewportClosure() {
function PageViewport(viewBox, scale, rotation, offsetX, offsetY, dontFlip) {
this.viewBox = viewBox;
this.scale = scale;
this.rotation = rotation;
this.offsetX = offsetX;
this.offsetY = offsetY;
// creating transform to convert pdf coordinate system to the normal
// canvas like coordinates taking in account scale and rotation
var centerX = (viewBox[2] + viewBox[0]) / 2;
var centerY = (viewBox[3] + viewBox[1]) / 2;
var rotateA, rotateB, rotateC, rotateD;
rotation = rotation % 360;
rotation = rotation < 0 ? rotation + 360 : rotation;
switch (rotation) {
case 180:
rotateA = -1; rotateB = 0; rotateC = 0; rotateD = 1;
break;
case 90:
rotateA = 0; rotateB = 1; rotateC = 1; rotateD = 0;
break;
case 270:
rotateA = 0; rotateB = -1; rotateC = -1; rotateD = 0;
break;
//case 0:
default:
rotateA = 1; rotateB = 0; rotateC = 0; rotateD = -1;
break;
}
if (dontFlip) {
rotateC = -rotateC; rotateD = -rotateD;
}
var offsetCanvasX, offsetCanvasY;
var width, height;
if (rotateA === 0) {
offsetCanvasX = Math.abs(centerY - viewBox[1]) * scale + offsetX;
offsetCanvasY = Math.abs(centerX - viewBox[0]) * scale + offsetY;
width = Math.abs(viewBox[3] - viewBox[1]) * scale;
height = Math.abs(viewBox[2] - viewBox[0]) * scale;
} else {
offsetCanvasX = Math.abs(centerX - viewBox[0]) * scale + offsetX;
offsetCanvasY = Math.abs(centerY - viewBox[1]) * scale + offsetY;
width = Math.abs(viewBox[2] - viewBox[0]) * scale;
height = Math.abs(viewBox[3] - viewBox[1]) * scale;
}
// creating transform for the following operations:
// translate(-centerX, -centerY), rotate and flip vertically,
// scale, and translate(offsetCanvasX, offsetCanvasY)
this.transform = [
rotateA * scale,
rotateB * scale,
rotateC * scale,
rotateD * scale,
offsetCanvasX - rotateA * scale * centerX - rotateC * scale * centerY,
offsetCanvasY - rotateB * scale * centerX - rotateD * scale * centerY
];
this.width = width;
this.height = height;
this.fontScale = scale;
}
PageViewport.prototype = {
clone: function PageViewPort_clone(args) {
args = args || {};
var scale = 'scale' in args ? args.scale : this.scale;
var rotation = 'rotation' in args ? args.rotation : this.rotation;
return new PageViewport(this.viewBox.slice(), scale, rotation,
this.offsetX, this.offsetY, args.dontFlip);
},
convertToViewportPoint: function PageViewport_convertToViewportPoint(x, y) {
return Util.applyTransform([x, y], this.transform);
},
convertToViewportRectangle:
function PageViewport_convertToViewportRectangle(rect) {
var tl = Util.applyTransform([rect[0], rect[1]], this.transform);
var br = Util.applyTransform([rect[2], rect[3]], this.transform);
return [tl[0], tl[1], br[0], br[1]];
},
convertToPdfPoint: function PageViewport_convertToPdfPoint(x, y) {
return Util.applyInverseTransform([x, y], this.transform);
}
};
return PageViewport;
})();
var PDFStringTranslateTable = [
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0x2D8, 0x2C7, 0x2C6, 0x2D9, 0x2DD, 0x2DB, 0x2DA, 0x2DC, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x2022, 0x2020, 0x2021, 0x2026, 0x2014,
0x2013, 0x192, 0x2044, 0x2039, 0x203A, 0x2212, 0x2030, 0x201E, 0x201C,
0x201D, 0x2018, 0x2019, 0x201A, 0x2122, 0xFB01, 0xFB02, 0x141, 0x152, 0x160,
0x178, 0x17D, 0x131, 0x142, 0x153, 0x161, 0x17E, 0, 0x20AC
];
function stringToPDFString(str) {
var i, n = str.length, strBuf = [];
if (str[0] === '\xFE' && str[1] === '\xFF') {
// UTF16BE BOM
for (i = 2; i < n; i += 2) {
strBuf.push(String.fromCharCode(
(str.charCodeAt(i) << 8) | str.charCodeAt(i + 1)));
}
} else {
for (i = 0; i < n; ++i) {
var code = PDFStringTranslateTable[str.charCodeAt(i)];
strBuf.push(code ? String.fromCharCode(code) : str.charAt(i));
}
}
return strBuf.join('');
}
function stringToUTF8String(str) {
return decodeURIComponent(escape(str));
}
function isEmptyObj(obj) {
for (var key in obj) {
return false;
}
return true;
}
function isBool(v) {
return typeof v == 'boolean';
}
function isInt(v) {
return typeof v == 'number' && ((v | 0) == v);
}
function isNum(v) {
return typeof v == 'number';
}
function isString(v) {
return typeof v == 'string';
}
function isNull(v) {
return v === null;
}
function isName(v) {
return v instanceof Name;
}
function isCmd(v, cmd) {
return v instanceof Cmd && (!cmd || v.cmd == cmd);
}
function isDict(v, type) {
if (!(v instanceof Dict)) {
return false;
}
if (!type) {
return true;
}
var dictType = v.get('Type');
return isName(dictType) && dictType.name == type;
}
function isArray(v) {
return v instanceof Array;
}
function isStream(v) {
return typeof v == 'object' && v !== null && v !== undefined &&
('getBytes' in v);
}
function isArrayBuffer(v) {
return typeof v == 'object' && v !== null && v !== undefined &&
('byteLength' in v);
}
function isRef(v) {
return v instanceof Ref;
}
function isPDFFunction(v) {
var fnDict;
if (typeof v != 'object') {
return false;
} else if (isDict(v)) {
fnDict = v;
} else if (isStream(v)) {
fnDict = v.dict;
} else {
return false;
}
return fnDict.has('FunctionType');
}
/**
* Legacy support for PDFJS Promise implementation.
* TODO remove eventually
* @ignore
*/
var LegacyPromise = PDFJS.LegacyPromise = (function LegacyPromiseClosure() {
return function LegacyPromise() {
var resolve, reject;
var promise = new Promise(function (resolve_, reject_) {
resolve = resolve_;
reject = reject_;
});
promise.resolve = resolve;
promise.reject = reject;
return promise;
};
})();
/**
* Polyfill for Promises:
* The following promise implementation tries to generally implment the
* Promise/A+ spec. Some notable differences from other promise libaries are:
* - There currently isn't a seperate deferred and promise object.
* - Unhandled rejections eventually show an error if they aren't handled.
*
* Based off of the work in:
* https://bugzilla.mozilla.org/show_bug.cgi?id=810490
*/
(function PromiseClosure() {
if (globalScope.Promise) {
// Promises existing in the DOM/Worker, checking presence of all/resolve
if (typeof globalScope.Promise.all !== 'function') {
globalScope.Promise.all = function (iterable) {
var count = 0, results = [], resolve, reject;
var promise = new globalScope.Promise(function (resolve_, reject_) {
resolve = resolve_;
reject = reject_;
});
iterable.forEach(function (p, i) {
count++;
p.then(function (result) {
results[i] = result;
count--;
if (count === 0) {
resolve(results);
}
}, reject);
});
if (count === 0) {
resolve(results);
}
return promise;
};
}
if (typeof globalScope.Promise.resolve !== 'function') {
globalScope.Promise.resolve = function (x) {
return new globalScope.Promise(function (resolve) { resolve(x); });
};
}
return;
}
var STATUS_PENDING = 0;
var STATUS_RESOLVED = 1;
var STATUS_REJECTED = 2;
// In an attempt to avoid silent exceptions, unhandled rejections are
// tracked and if they aren't handled in a certain amount of time an
// error is logged.
var REJECTION_TIMEOUT = 500;
var HandlerManager = {
handlers: [],
running: false,
unhandledRejections: [],
pendingRejectionCheck: false,
scheduleHandlers: function scheduleHandlers(promise) {
if (promise._status == STATUS_PENDING) {
return;
}
this.handlers = this.handlers.concat(promise._handlers);
promise._handlers = [];
if (this.running) {
return;
}
this.running = true;
setTimeout(this.runHandlers.bind(this), 0);
},
runHandlers: function runHandlers() {
var RUN_TIMEOUT = 1; // ms
var timeoutAt = Date.now() + RUN_TIMEOUT;
while (this.handlers.length > 0) {
var handler = this.handlers.shift();
var nextStatus = handler.thisPromise._status;
var nextValue = handler.thisPromise._value;
try {
if (nextStatus === STATUS_RESOLVED) {
if (typeof(handler.onResolve) == 'function') {
nextValue = handler.onResolve(nextValue);
}
} else if (typeof(handler.onReject) === 'function') {
nextValue = handler.onReject(nextValue);
nextStatus = STATUS_RESOLVED;
if (handler.thisPromise._unhandledRejection) {
this.removeUnhandeledRejection(handler.thisPromise);
}
}
} catch (ex) {
nextStatus = STATUS_REJECTED;
nextValue = ex;
}
handler.nextPromise._updateStatus(nextStatus, nextValue);
if (Date.now() >= timeoutAt) {
break;
}
}
if (this.handlers.length > 0) {
setTimeout(this.runHandlers.bind(this), 0);
return;
}
this.running = false;
},
addUnhandledRejection: function addUnhandledRejection(promise) {
this.unhandledRejections.push({
promise: promise,
time: Date.now()
});
this.scheduleRejectionCheck();
},
removeUnhandeledRejection: function removeUnhandeledRejection(promise) {
promise._unhandledRejection = false;
for (var i = 0; i < this.unhandledRejections.length; i++) {
if (this.unhandledRejections[i].promise === promise) {
this.unhandledRejections.splice(i);
i--;
}
}
},
scheduleRejectionCheck: function scheduleRejectionCheck() {
if (this.pendingRejectionCheck) {
return;
}
this.pendingRejectionCheck = true;
setTimeout(function rejectionCheck() {
this.pendingRejectionCheck = false;
var now = Date.now();
for (var i = 0; i < this.unhandledRejections.length; i++) {
if (now - this.unhandledRejections[i].time > REJECTION_TIMEOUT) {
var unhandled = this.unhandledRejections[i].promise._value;
var msg = 'Unhandled rejection: ' + unhandled;
if (unhandled.stack) {
msg += '\n' + unhandled.stack;
}
warn(msg);
this.unhandledRejections.splice(i);
i--;
}
}
if (this.unhandledRejections.length) {
this.scheduleRejectionCheck();
}
}.bind(this), REJECTION_TIMEOUT);
}
};
function Promise(resolver) {
this._status = STATUS_PENDING;
this._handlers = [];
resolver.call(this, this._resolve.bind(this), this._reject.bind(this));
}
/**
* Builds a promise that is resolved when all the passed in promises are
* resolved.
* @param {array} array of data and/or promises to wait for.
* @return {Promise} New dependant promise.
*/
Promise.all = function Promise_all(promises) {
var resolveAll, rejectAll;
var deferred = new Promise(function (resolve, reject) {
resolveAll = resolve;
rejectAll = reject;
});
var unresolved = promises.length;
var results = [];
if (unresolved === 0) {
resolveAll(results);
return deferred;
}
function reject(reason) {
if (deferred._status === STATUS_REJECTED) {
return;
}
results = [];
rejectAll(reason);
}
for (var i = 0, ii = promises.length; i < ii; ++i) {
var promise = promises[i];
var resolve = (function(i) {
return function(value) {
if (deferred._status === STATUS_REJECTED) {
return;
}
results[i] = value;
unresolved--;
if (unresolved === 0) {
resolveAll(results);
}
};
})(i);
if (Promise.isPromise(promise)) {
promise.then(resolve, reject);
} else {
resolve(promise);
}
}
return deferred;
};
/**
* Checks if the value is likely a promise (has a 'then' function).
* @return {boolean} true if x is thenable
*/
Promise.isPromise = function Promise_isPromise(value) {
return value && typeof value.then === 'function';
};
/**
* Creates resolved promise
* @param x resolve value
* @returns {Promise}
*/
Promise.resolve = function Promise_resolve(x) {
return new Promise(function (resolve) { resolve(x); });
};
Promise.prototype = {
_status: null,
_value: null,
_handlers: null,
_unhandledRejection: null,
_updateStatus: function Promise__updateStatus(status, value) {
if (this._status === STATUS_RESOLVED ||
this._status === STATUS_REJECTED) {
return;
}
if (status == STATUS_RESOLVED &&
Promise.isPromise(value)) {
value.then(this._updateStatus.bind(this, STATUS_RESOLVED),
this._updateStatus.bind(this, STATUS_REJECTED));
return;
}
this._status = status;
this._value = value;
if (status === STATUS_REJECTED && this._handlers.length === 0) {
this._unhandledRejection = true;
HandlerManager.addUnhandledRejection(this);
}
HandlerManager.scheduleHandlers(this);
},
_resolve: function Promise_resolve(value) {
this._updateStatus(STATUS_RESOLVED, value);
},
_reject: function Promise_reject(reason) {
this._updateStatus(STATUS_REJECTED, reason);
},
then: function Promise_then(onResolve, onReject) {
var nextPromise = new Promise(function (resolve, reject) {
this.resolve = reject;
this.reject = reject;
});
this._handlers.push({
thisPromise: this,
onResolve: onResolve,
onReject: onReject,
nextPromise: nextPromise
});
HandlerManager.scheduleHandlers(this);
return nextPromise;
}
};
globalScope.Promise = Promise;
})();
var StatTimer = (function StatTimerClosure() {
function rpad(str, pad, length) {
while (str.length < length) {
str += pad;
}
return str;
}
function StatTimer() {
this.started = {};
this.times = [];
this.enabled = true;
}
StatTimer.prototype = {
time: function StatTimer_time(name) {
if (!this.enabled) {
return;
}
if (name in this.started) {
warn('Timer is already running for ' + name);
}
this.started[name] = Date.now();
},
timeEnd: function StatTimer_timeEnd(name) {
if (!this.enabled) {
return;
}
if (!(name in this.started)) {
warn('Timer has not been started for ' + name);
}
this.times.push({
'name': name,
'start': this.started[name],
'end': Date.now()
});
// Remove timer from started so it can be called again.
delete this.started[name];
},
toString: function StatTimer_toString() {
var i, ii;
var times = this.times;
var out = '';
// Find the longest name for padding purposes.
var longest = 0;
for (i = 0, ii = times.length; i < ii; ++i) {
var name = times[i]['name'];
if (name.length > longest) {
longest = name.length;
}
}
for (i = 0, ii = times.length; i < ii; ++i) {
var span = times[i];
var duration = span.end - span.start;
out += rpad(span['name'], ' ', longest) + ' ' + duration + 'ms\n';
}
return out;
}
};
return StatTimer;
})();
PDFJS.createBlob = function createBlob(data, contentType) {
if (typeof Blob !== 'undefined') {
return new Blob([data], { type: contentType });
}
// Blob builder is deprecated in FF14 and removed in FF18.
var bb = new MozBlobBuilder();
bb.append(data);
return bb.getBlob(contentType);
};
PDFJS.createObjectURL = (function createObjectURLClosure() {
// Blob/createObjectURL is not available, falling back to data schema.
var digits =
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
return function createObjectURL(data, contentType) {
if (!PDFJS.disableCreateObjectURL &&
typeof URL !== 'undefined' && URL.createObjectURL) {
var blob = PDFJS.createBlob(data, contentType);
return URL.createObjectURL(blob);
}
var buffer = 'data:' + contentType + ';base64,';
for (var i = 0, ii = data.length; i < ii; i += 3) {
var b1 = data[i] & 0xFF;
var b2 = data[i + 1] & 0xFF;
var b3 = data[i + 2] & 0xFF;
var d1 = b1 >> 2, d2 = ((b1 & 3) << 4) | (b2 >> 4);
var d3 = i + 1 < ii ? ((b2 & 0xF) << 2) | (b3 >> 6) : 64;
var d4 = i + 2 < ii ? (b3 & 0x3F) : 64;
buffer += digits[d1] + digits[d2] + digits[d3] + digits[d4];
}
return buffer;
};
})();
function MessageHandler(name, comObj) {
this.name = name;
this.comObj = comObj;
this.callbackIndex = 1;
this.postMessageTransfers = true;
var callbacks = this.callbacks = {};
var ah = this.actionHandler = {};
ah['console_log'] = [function ahConsoleLog(data) {
console.log.apply(console, data);
}];
ah['console_error'] = [function ahConsoleError(data) {
console.error.apply(console, data);
}];
ah['_unsupported_feature'] = [function ah_unsupportedFeature(data) {
UnsupportedManager.notify(data);
}];
comObj.onmessage = function messageHandlerComObjOnMessage(event) {
var data = event.data;
if (data.isReply) {
var callbackId = data.callbackId;
if (data.callbackId in callbacks) {
var callback = callbacks[callbackId];
delete callbacks[callbackId];
callback(data.data);
} else {
error('Cannot resolve callback ' + callbackId);
}
} else if (data.action in ah) {
var action = ah[data.action];
if (data.callbackId) {
var deferred = {};
var promise = new Promise(function (resolve, reject) {
deferred.resolve = resolve;
deferred.reject = reject;
});
deferred.promise = promise;
promise.then(function(resolvedData) {
comObj.postMessage({
isReply: true,
callbackId: data.callbackId,
data: resolvedData
});
});
action[0].call(action[1], data.data, deferred);
} else {
action[0].call(action[1], data.data);
}
} else {
error('Unkown action from worker: ' + data.action);
}
};
}
MessageHandler.prototype = {
on: function messageHandlerOn(actionName, handler, scope) {
var ah = this.actionHandler;
if (ah[actionName]) {
error('There is already an actionName called "' + actionName + '"');
}
ah[actionName] = [handler, scope];
},
/**
* Sends a message to the comObj to invoke the action with the supplied data.
* @param {String} actionName Action to call.
* @param {JSON} data JSON data to send.
* @param {function} [callback] Optional callback that will handle a reply.
* @param {Array} [transfers] Optional list of transfers/ArrayBuffers
*/
send: function messageHandlerSend(actionName, data, callback, transfers) {
var message = {
action: actionName,
data: data
};
if (callback) {
var callbackId = this.callbackIndex++;
this.callbacks[callbackId] = callback;
message.callbackId = callbackId;
}
if (transfers && this.postMessageTransfers) {
this.comObj.postMessage(message, transfers);
} else {
this.comObj.postMessage(message);
}
}
};
function loadJpegStream(id, imageUrl, objs) {
var img = new Image();
img.onload = (function loadJpegStream_onloadClosure() {
objs.resolve(id, img);
});
img.src = imageUrl;
}
var ColorSpace = (function ColorSpaceClosure() {
// Constructor should define this.numComps, this.defaultColor, this.name
function ColorSpace() {
error('should not call ColorSpace constructor');
}
ColorSpace.prototype = {
/**
* Converts the color value to the RGB color. The color components are
* located in the src array starting from the srcOffset. Returns the array
* of the rgb components, each value ranging from [0,255].
*/
getRgb: function ColorSpace_getRgb(src, srcOffset) {
var rgb = new Uint8Array(3);
this.getRgbItem(src, srcOffset, rgb, 0);
return rgb;
},
/**
* Converts the color value to the RGB color, similar to the getRgb method.
* The result placed into the dest array starting from the destOffset.
*/
getRgbItem: function ColorSpace_getRgbItem(src, srcOffset,
dest, destOffset) {
error('Should not call ColorSpace.getRgbItem');
},
/**
* Converts the specified number of the color values to the RGB colors.
* The colors are located in the src array starting from the srcOffset.
* The result is placed into the dest array starting from the destOffset.
* The src array items shall be in [0,2^bits) range, the dest array items
* will be in [0,255] range. alpha01 indicates how many alpha components
* there are in the dest array; it will be either 0 (RGB array) or 1 (RGBA
* array).
*/
getRgbBuffer: function ColorSpace_getRgbBuffer(src, srcOffset, count,
dest, destOffset, bits,
alpha01) {
error('Should not call ColorSpace.getRgbBuffer');
},
/**
* Determines the number of bytes required to store the result of the
* conversion done by the getRgbBuffer method. As in getRgbBuffer,
* |alpha01| is either 0 (RGB output) or 1 (RGBA output).
*/
getOutputLength: function ColorSpace_getOutputLength(inputLength,
alpha01) {
error('Should not call ColorSpace.getOutputLength');
},
/**
* Returns true if source data will be equal the result/output data.
*/
isPassthrough: function ColorSpace_isPassthrough(bits) {
return false;
},
/**
* Fills in the RGB colors in the destination buffer. alpha01 indicates
* how many alpha components there are in the dest array; it will be either
* 0 (RGB array) or 1 (RGBA array).
*/
fillRgb: function ColorSpace_fillRgb(dest, originalWidth,
originalHeight, width, height,
actualHeight, bpc, comps, alpha01) {
var count = originalWidth * originalHeight;
var rgbBuf = null;
var numComponentColors = 1 << bpc;
var needsResizing = originalHeight != height || originalWidth != width;
var i, ii;
if (this.isPassthrough(bpc)) {
rgbBuf = comps;
} else if (this.numComps === 1 && count > numComponentColors &&
this.name !== 'DeviceGray' && this.name !== 'DeviceRGB') {
// Optimization: create a color map when there is just one component and
// we are converting more colors than the size of the color map. We
// don't build the map if the colorspace is gray or rgb since those
// methods are faster than building a map. This mainly offers big speed
// ups for indexed and alternate colorspaces.
//
// TODO it may be worth while to cache the color map. While running
// testing I never hit a cache so I will leave that out for now (perhaps
// we are reparsing colorspaces too much?).
var allColors = bpc <= 8 ? new Uint8Array(numComponentColors) :
new Uint16Array(numComponentColors);
var key;
for (i = 0; i < numComponentColors; i++) {
allColors[i] = i;
}
var colorMap = new Uint8Array(numComponentColors * 3);
this.getRgbBuffer(allColors, 0, numComponentColors, colorMap, 0, bpc,
/* alpha01 = */ 0);
var destPos, rgbPos;
if (!needsResizing) {
// Fill in the RGB values directly into |dest|.
destPos = 0;
for (i = 0; i < count; ++i) {
key = comps[i] * 3;
dest[destPos++] = colorMap[key];
dest[destPos++] = colorMap[key + 1];
dest[destPos++] = colorMap[key + 2];
destPos += alpha01;
}
} else {
rgbBuf = new Uint8Array(count * 3);
rgbPos = 0;
for (i = 0; i < count; ++i) {
key = comps[i] * 3;
rgbBuf[rgbPos++] = colorMap[key];
rgbBuf[rgbPos++] = colorMap[key + 1];
rgbBuf[rgbPos++] = colorMap[key + 2];
}
}
} else {
if (!needsResizing) {
// Fill in the RGB values directly into |dest|.
this.getRgbBuffer(comps, 0, width * actualHeight, dest, 0, bpc,
alpha01);
} else {
rgbBuf = new Uint8Array(count * 3);
this.getRgbBuffer(comps, 0, count, rgbBuf, 0, bpc,
/* alpha01 = */ 0);
}
}
if (rgbBuf) {
if (needsResizing) {
rgbBuf = PDFImage.resize(rgbBuf, bpc, 3, originalWidth,
originalHeight, width, height);
}
rgbPos = 0;
destPos = 0;
for (i = 0, ii = width * actualHeight; i < ii; i++) {
dest[destPos++] = rgbBuf[rgbPos++];
dest[destPos++] = rgbBuf[rgbPos++];
dest[destPos++] = rgbBuf[rgbPos++];
destPos += alpha01;
}
}
},
/**
* True if the colorspace has components in the default range of [0, 1].
* This should be true for all colorspaces except for lab color spaces
* which are [0,100], [-128, 127], [-128, 127].
*/
usesZeroToOneRange: true
};
ColorSpace.parse = function ColorSpace_parse(cs, xref, res) {
var IR = ColorSpace.parseToIR(cs, xref, res);
if (IR instanceof AlternateCS) {
return IR;
}
return ColorSpace.fromIR(IR);
};
ColorSpace.fromIR = function ColorSpace_fromIR(IR) {
var name = isArray(IR) ? IR[0] : IR;
var whitePoint, blackPoint;
switch (name) {
case 'DeviceGrayCS':
return this.singletons.gray;
case 'DeviceRgbCS':
return this.singletons.rgb;
case 'DeviceCmykCS':
return this.singletons.cmyk;
case 'CalGrayCS':
whitePoint = IR[1].WhitePoint;
blackPoint = IR[1].BlackPoint;
var gamma = IR[1].Gamma;
return new CalGrayCS(whitePoint, blackPoint, gamma);
case 'PatternCS':
var basePatternCS = IR[1];
if (basePatternCS) {
basePatternCS = ColorSpace.fromIR(basePatternCS);
}
return new PatternCS(basePatternCS);
case 'IndexedCS':
var baseIndexedCS = IR[1];
var hiVal = IR[2];
var lookup = IR[3];
return new IndexedCS(ColorSpace.fromIR(baseIndexedCS), hiVal, lookup);
case 'AlternateCS':
var numComps = IR[1];
var alt = IR[2];
var tintFnIR = IR[3];
return new AlternateCS(numComps, ColorSpace.fromIR(alt),
PDFFunction.fromIR(tintFnIR));
case 'LabCS':
whitePoint = IR[1].WhitePoint;
blackPoint = IR[1].BlackPoint;
var range = IR[1].Range;
return new LabCS(whitePoint, blackPoint, range);
default:
error('Unkown name ' + name);
}
return null;
};
ColorSpace.parseToIR = function ColorSpace_parseToIR(cs, xref, res) {
if (isName(cs)) {
var colorSpaces = res.get('ColorSpace');
if (isDict(colorSpaces)) {
var refcs = colorSpaces.get(cs.name);
if (refcs) {
cs = refcs;
}
}
}
cs = xref.fetchIfRef(cs);
var mode;
if (isName(cs)) {
mode = cs.name;
this.mode = mode;
switch (mode) {
case 'DeviceGray':
case 'G':
return 'DeviceGrayCS';
case 'DeviceRGB':
case 'RGB':
return 'DeviceRgbCS';
case 'DeviceCMYK':
case 'CMYK':
return 'DeviceCmykCS';
case 'Pattern':
return ['PatternCS', null];
default:
error('unrecognized colorspace ' + mode);
}
} else if (isArray(cs)) {
mode = cs[0].name;
this.mode = mode;
var numComps, params;
switch (mode) {
case 'DeviceGray':
case 'G':
return 'DeviceGrayCS';
case 'DeviceRGB':
case 'RGB':
return 'DeviceRgbCS';
case 'DeviceCMYK':
case 'CMYK':
return 'DeviceCmykCS';
case 'CalGray':
params = cs[1].getAll();
return ['CalGrayCS', params];
case 'CalRGB':
return 'DeviceRgbCS';
case 'ICCBased':
var stream = xref.fetchIfRef(cs[1]);
var dict = stream.dict;
numComps = dict.get('N');
if (numComps == 1) {
return 'DeviceGrayCS';
} else if (numComps == 3) {
return 'DeviceRgbCS';
} else if (numComps == 4) {
return 'DeviceCmykCS';
}
break;
case 'Pattern':
var basePatternCS = cs[1];
if (basePatternCS) {
basePatternCS = ColorSpace.parseToIR(basePatternCS, xref, res);
}
return ['PatternCS', basePatternCS];
case 'Indexed':
case 'I':
var baseIndexedCS = ColorSpace.parseToIR(cs[1], xref, res);
var hiVal = cs[2] + 1;
var lookup = xref.fetchIfRef(cs[3]);
if (isStream(lookup)) {
lookup = lookup.getBytes();
}
return ['IndexedCS', baseIndexedCS, hiVal, lookup];
case 'Separation':
case 'DeviceN':
var name = cs[1];
numComps = 1;
if (isName(name)) {
numComps = 1;
} else if (isArray(name)) {
numComps = name.length;
}
var alt = ColorSpace.parseToIR(cs[2], xref, res);
var tintFnIR = PDFFunction.getIR(xref, xref.fetchIfRef(cs[3]));
return ['AlternateCS', numComps, alt, tintFnIR];
case 'Lab':
params = cs[1].getAll();
return ['LabCS', params];
default:
error('unimplemented color space object "' + mode + '"');
}
} else {
error('unrecognized color space object: "' + cs + '"');
}
return null;
};
/**
* Checks if a decode map matches the default decode map for a color space.
* This handles the general decode maps where there are two values per
* component. e.g. [0, 1, 0, 1, 0, 1] for a RGB color.
* This does not handle Lab, Indexed, or Pattern decode maps since they are
* slightly different.
* @param {Array} decode Decode map (usually from an image).
* @param {Number} n Number of components the color space has.
*/
ColorSpace.isDefaultDecode = function ColorSpace_isDefaultDecode(decode, n) {
if (!decode) {
return true;
}
if (n * 2 !== decode.length) {
warn('The decode map is not the correct length');
return true;
}
for (var i = 0, ii = decode.length; i < ii; i += 2) {
if (decode[i] !== 0 || decode[i + 1] != 1) {
return false;
}
}
return true;
};
ColorSpace.singletons = {
get gray() {
return shadow(this, 'gray', new DeviceGrayCS());
},
get rgb() {
return shadow(this, 'rgb', new DeviceRgbCS());
},
get cmyk() {
return shadow(this, 'cmyk', new DeviceCmykCS());
}
};
return ColorSpace;
})();
/**
* Alternate color space handles both Separation and DeviceN color spaces. A
* Separation color space is actually just a DeviceN with one color component.
* Both color spaces use a tinting function to convert colors to a base color
* space.
*/
var AlternateCS = (function AlternateCSClosure() {
function AlternateCS(numComps, base, tintFn) {
this.name = 'Alternate';
this.numComps = numComps;
this.defaultColor = new Float32Array(numComps);
for (var i = 0; i < numComps; ++i) {
this.defaultColor[i] = 1;
}
this.base = base;
this.tintFn = tintFn;
}
AlternateCS.prototype = {
getRgb: ColorSpace.prototype.getRgb,
getRgbItem: function AlternateCS_getRgbItem(src, srcOffset,
dest, destOffset) {
var baseNumComps = this.base.numComps;
var input = 'subarray' in src ?
src.subarray(srcOffset, srcOffset + this.numComps) :
Array.prototype.slice.call(src, srcOffset, srcOffset + this.numComps);
var tinted = this.tintFn(input);
this.base.getRgbItem(tinted, 0, dest, destOffset);
},
getRgbBuffer: function AlternateCS_getRgbBuffer(src, srcOffset, count,
dest, destOffset, bits,
alpha01) {
var tintFn = this.tintFn;
var base = this.base;
var scale = 1 / ((1 << bits) - 1);
var baseNumComps = base.numComps;
var usesZeroToOneRange = base.usesZeroToOneRange;
var isPassthrough = (base.isPassthrough(8) || !usesZeroToOneRange) &&
alpha01 === 0;
var pos = isPassthrough ? destOffset : 0;
var baseBuf = isPassthrough ? dest : new Uint8Array(baseNumComps * count);
var numComps = this.numComps;
var scaled = new Float32Array(numComps);
var i, j;
for (i = 0; i < count; i++) {
for (j = 0; j < numComps; j++) {
scaled[j] = src[srcOffset++] * scale;
}
var tinted = tintFn(scaled);
if (usesZeroToOneRange) {
for (j = 0; j < baseNumComps; j++) {
baseBuf[pos++] = tinted[j] * 255;
}
} else {
base.getRgbItem(tinted, 0, baseBuf, pos);
pos += baseNumComps;
}
}
if (!isPassthrough) {
base.getRgbBuffer(baseBuf, 0, count, dest, destOffset, 8, alpha01);
}
},
getOutputLength: function AlternateCS_getOutputLength(inputLength,
alpha01) {
return this.base.getOutputLength(inputLength *
this.base.numComps / this.numComps,
alpha01);
},
isPassthrough: ColorSpace.prototype.isPassthrough,
fillRgb: ColorSpace.prototype.fillRgb,
isDefaultDecode: function AlternateCS_isDefaultDecode(decodeMap) {
return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
},
usesZeroToOneRange: true
};
return AlternateCS;
})();
var PatternCS = (function PatternCSClosure() {
function PatternCS(baseCS) {
this.name = 'Pattern';
this.base = baseCS;
}
PatternCS.prototype = {};
return PatternCS;
})();
var IndexedCS = (function IndexedCSClosure() {
function IndexedCS(base, highVal, lookup) {
this.name = 'Indexed';
this.numComps = 1;
this.defaultColor = new Uint8Array([0]);
this.base = base;
this.highVal = highVal;
var baseNumComps = base.numComps;
var length = baseNumComps * highVal;
var lookupArray;
if (isStream(lookup)) {
lookupArray = new Uint8Array(length);
var bytes = lookup.getBytes(length);
lookupArray.set(bytes);
} else if (isString(lookup)) {
lookupArray = new Uint8Array(length);
for (var i = 0; i < length; ++i) {
lookupArray[i] = lookup.charCodeAt(i);
}
} else if (lookup instanceof Uint8Array || lookup instanceof Array) {
lookupArray = lookup;
} else {
error('Unrecognized lookup table: ' + lookup);
}
this.lookup = lookupArray;
}
IndexedCS.prototype = {
getRgb: ColorSpace.prototype.getRgb,
getRgbItem: function IndexedCS_getRgbItem(src, srcOffset,
dest, destOffset) {
var numComps = this.base.numComps;
var start = src[srcOffset] * numComps;
this.base.getRgbItem(this.lookup, start, dest, destOffset);
},
getRgbBuffer: function IndexedCS_getRgbBuffer(src, srcOffset, count,
dest, destOffset, bits,
alpha01) {
var base = this.base;
var numComps = base.numComps;
var outputDelta = base.getOutputLength(numComps, alpha01);
var lookup = this.lookup;
for (var i = 0; i < count; ++i) {
var lookupPos = src[srcOffset++] * numComps;
base.getRgbBuffer(lookup, lookupPos, 1, dest, destOffset, 8, alpha01);
destOffset += outputDelta;
}
},
getOutputLength: function IndexedCS_getOutputLength(inputLength, alpha01) {
return this.base.getOutputLength(inputLength * this.base.numComps,
alpha01);
},
isPassthrough: ColorSpace.prototype.isPassthrough,
fillRgb: ColorSpace.prototype.fillRgb,
isDefaultDecode: function IndexedCS_isDefaultDecode(decodeMap) {
// indexed color maps shouldn't be changed
return true;
},
usesZeroToOneRange: true
};
return IndexedCS;
})();
var DeviceGrayCS = (function DeviceGrayCSClosure() {
function DeviceGrayCS() {
this.name = 'DeviceGray';
this.numComps = 1;
this.defaultColor = new Float32Array([0]);
}
DeviceGrayCS.prototype = {
getRgb: ColorSpace.prototype.getRgb,
getRgbItem: function DeviceGrayCS_getRgbItem(src, srcOffset,
dest, destOffset) {
var c = (src[srcOffset] * 255) | 0;
c = c < 0 ? 0 : c > 255 ? 255 : c;
dest[destOffset] = dest[destOffset + 1] = dest[destOffset + 2] = c;
},
getRgbBuffer: function DeviceGrayCS_getRgbBuffer(src, srcOffset, count,
dest, destOffset, bits,
alpha01) {
var scale = 255 / ((1 << bits) - 1);
var j = srcOffset, q = destOffset;
for (var i = 0; i < count; ++i) {
var c = (scale * src[j++]) | 0;
dest[q++] = c;
dest[q++] = c;
dest[q++] = c;
q += alpha01;
}
},
getOutputLength: function DeviceGrayCS_getOutputLength(inputLength,
alpha01) {
return inputLength * (3 + alpha01);
},
isPassthrough: ColorSpace.prototype.isPassthrough,
fillRgb: ColorSpace.prototype.fillRgb,
isDefaultDecode: function DeviceGrayCS_isDefaultDecode(decodeMap) {
return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
},
usesZeroToOneRange: true
};
return DeviceGrayCS;
})();
var DeviceRgbCS = (function DeviceRgbCSClosure() {
function DeviceRgbCS() {
this.name = 'DeviceRGB';
this.numComps = 3;
this.defaultColor = new Float32Array([0, 0, 0]);
}
DeviceRgbCS.prototype = {
getRgb: ColorSpace.prototype.getRgb,
getRgbItem: function DeviceRgbCS_getRgbItem(src, srcOffset,
dest, destOffset) {
var r = (src[srcOffset] * 255) | 0;
var g = (src[srcOffset + 1] * 255) | 0;
var b = (src[srcOffset + 2] * 255) | 0;
dest[destOffset] = r < 0 ? 0 : r > 255 ? 255 : r;
dest[destOffset + 1] = g < 0 ? 0 : g > 255 ? 255 : g;
dest[destOffset + 2] = b < 0 ? 0 : b > 255 ? 255 : b;
},
getRgbBuffer: function DeviceRgbCS_getRgbBuffer(src, srcOffset, count,
dest, destOffset, bits,
alpha01) {
if (bits === 8 && alpha01 === 0) {
dest.set(src.subarray(srcOffset, srcOffset + count * 3), destOffset);
return;
}
var scale = 255 / ((1 << bits) - 1);
var j = srcOffset, q = destOffset;
for (var i = 0; i < count; ++i) {
dest[q++] = (scale * src[j++]) | 0;
dest[q++] = (scale * src[j++]) | 0;
dest[q++] = (scale * src[j++]) | 0;
q += alpha01;
}
},
getOutputLength: function DeviceRgbCS_getOutputLength(inputLength,
alpha01) {
return (inputLength * (3 + alpha01) / 3) | 0;
},
isPassthrough: function DeviceRgbCS_isPassthrough(bits) {
return bits == 8;
},
fillRgb: ColorSpace.prototype.fillRgb,
isDefaultDecode: function DeviceRgbCS_isDefaultDecode(decodeMap) {
return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
},
usesZeroToOneRange: true
};
return DeviceRgbCS;
})();
var DeviceCmykCS = (function DeviceCmykCSClosure() {
// The coefficients below was found using numerical analysis: the method of
// steepest descent for the sum((f_i - color_value_i)^2) for r/g/b colors,
// where color_value is the tabular value from the table of sampled RGB colors
// from CMYK US Web Coated (SWOP) colorspace, and f_i is the corresponding
// CMYK color conversion using the estimation below:
// f(A, B,.. N) = Acc+Bcm+Ccy+Dck+c+Fmm+Gmy+Hmk+Im+Jyy+Kyk+Ly+Mkk+Nk+255
function convertToRgb(src, srcOffset, srcScale, dest, destOffset) {
var c = src[srcOffset + 0] * srcScale;
var m = src[srcOffset + 1] * srcScale;
var y = src[srcOffset + 2] * srcScale;
var k = src[srcOffset + 3] * srcScale;
var r =
c * (-4.387332384609988 * c + 54.48615194189176 * m +
18.82290502165302 * y + 212.25662451639585 * k +
-285.2331026137004) +
m * (1.7149763477362134 * m - 5.6096736904047315 * y +
-17.873870861415444 * k - 5.497006427196366) +
y * (-2.5217340131683033 * y - 21.248923337353073 * k +
17.5119270841813) +
k * (-21.86122147463605 * k - 189.48180835922747) + 255;
var g =
c * (8.841041422036149 * c + 60.118027045597366 * m +
6.871425592049007 * y + 31.159100130055922 * k +
-79.2970844816548) +
m * (-15.310361306967817 * m + 17.575251261109482 * y +
131.35250912493976 * k - 190.9453302588951) +
y * (4.444339102852739 * y + 9.8632861493405 * k - 24.86741582555878) +
k * (-20.737325471181034 * k - 187.80453709719578) + 255;
var b =
c * (0.8842522430003296 * c + 8.078677503112928 * m +
30.89978309703729 * y - 0.23883238689178934 * k +
-14.183576799673286) +
m * (10.49593273432072 * m + 63.02378494754052 * y +
50.606957656360734 * k - 112.23884253719248) +
y * (0.03296041114873217 * y + 115.60384449646641 * k +
-193.58209356861505) +
k * (-22.33816807309886 * k - 180.12613974708367) + 255;
dest[destOffset] = r > 255 ? 255 : r < 0 ? 0 : r;
dest[destOffset + 1] = g > 255 ? 255 : g < 0 ? 0 : g;
dest[destOffset + 2] = b > 255 ? 255 : b < 0 ? 0 : b;
}
function DeviceCmykCS() {
this.name = 'DeviceCMYK';
this.numComps = 4;
this.defaultColor = new Float32Array([0, 0, 0, 1]);
}
DeviceCmykCS.prototype = {
getRgb: ColorSpace.prototype.getRgb,
getRgbItem: function DeviceCmykCS_getRgbItem(src, srcOffset,
dest, destOffset) {
convertToRgb(src, srcOffset, 1, dest, destOffset);
},
getRgbBuffer: function DeviceCmykCS_getRgbBuffer(src, srcOffset, count,
dest, destOffset, bits,
alpha01) {
var scale = 1 / ((1 << bits) - 1);
for (var i = 0; i < count; i++) {
convertToRgb(src, srcOffset, scale, dest, destOffset);
srcOffset += 4;
destOffset += 3 + alpha01;
}
},
getOutputLength: function DeviceCmykCS_getOutputLength(inputLength,
alpha01) {
return (inputLength / 4 * (3 + alpha01)) | 0;
},
isPassthrough: ColorSpace.prototype.isPassthrough,
fillRgb: ColorSpace.prototype.fillRgb,
isDefaultDecode: function DeviceCmykCS_isDefaultDecode(decodeMap) {
return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
},
usesZeroToOneRange: true
};
return DeviceCmykCS;
})();
//
// CalGrayCS: Based on "PDF Reference, Sixth Ed", p.245
//
var CalGrayCS = (function CalGrayCSClosure() {
function CalGrayCS(whitePoint, blackPoint, gamma) {
this.name = 'CalGray';
this.numComps = 1;
this.defaultColor = new Float32Array([0]);
if (!whitePoint) {
error('WhitePoint missing - required for color space CalGray');
}
blackPoint = blackPoint || [0, 0, 0];
gamma = gamma || 1;
// Translate arguments to spec variables.
this.XW = whitePoint[0];
this.YW = whitePoint[1];
this.ZW = whitePoint[2];
this.XB = blackPoint[0];
this.YB = blackPoint[1];
this.ZB = blackPoint[2];
this.G = gamma;
// Validate variables as per spec.
if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
error('Invalid WhitePoint components for ' + this.name +
', no fallback available');
}
if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
info('Invalid BlackPoint for ' + this.name + ', falling back to default');
this.XB = this.YB = this.ZB = 0;
}
if (this.XB !== 0 || this.YB !== 0 || this.ZB !== 0) {
warn(this.name + ', BlackPoint: XB: ' + this.XB + ', YB: ' + this.YB +
', ZB: ' + this.ZB + ', only default values are supported.');
}
if (this.G < 1) {
info('Invalid Gamma: ' + this.G + ' for ' + this.name +
', falling back to default');
this.G = 1;
}
}
function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
// A represents a gray component of a calibrated gray space.
// A <---> AG in the spec
var A = src[srcOffset] * scale;
var AG = Math.pow(A, cs.G);
// Computes intermediate variables M, L, N as per spec.
// Except if other than default BlackPoint values are used.
var M = cs.XW * AG;
var L = cs.YW * AG;
var N = cs.ZW * AG;
// Decode XYZ, as per spec.
var X = M;
var Y = L;
var Z = N;
// http://www.poynton.com/notes/colour_and_gamma/ColorFAQ.html, Ch 4.
// This yields values in range [0, 100].
var Lstar = Math.max(116 * Math.pow(Y, 1 / 3) - 16, 0);
// Convert values to rgb range [0, 255].
dest[destOffset] = Lstar * 255 / 100;
dest[destOffset + 1] = Lstar * 255 / 100;
dest[destOffset + 2] = Lstar * 255 / 100;
}
CalGrayCS.prototype = {
getRgb: ColorSpace.prototype.getRgb,
getRgbItem: function CalGrayCS_getRgbItem(src, srcOffset,
dest, destOffset) {
convertToRgb(this, src, srcOffset, dest, destOffset, 1);
},
getRgbBuffer: function CalGrayCS_getRgbBuffer(src, srcOffset, count,
dest, destOffset, bits,
alpha01) {
var scale = 1 / ((1 << bits) - 1);
for (var i = 0; i < count; ++i) {
convertToRgb(this, src, srcOffset, dest, destOffset, scale);
srcOffset += 1;
destOffset += 3 + alpha01;
}
},
getOutputLength: function CalGrayCS_getOutputLength(inputLength, alpha01) {
return inputLength * (3 + alpha01);
},
isPassthrough: ColorSpace.prototype.isPassthrough,
fillRgb: ColorSpace.prototype.fillRgb,
isDefaultDecode: function CalGrayCS_isDefaultDecode(decodeMap) {
return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
},
usesZeroToOneRange: true
};
return CalGrayCS;
})();
//
// LabCS: Based on "PDF Reference, Sixth Ed", p.250
//
var LabCS = (function LabCSClosure() {
function LabCS(whitePoint, blackPoint, range) {
this.name = 'Lab';
this.numComps = 3;
this.defaultColor = new Float32Array([0, 0, 0]);
if (!whitePoint) {
error('WhitePoint missing - required for color space Lab');
}
blackPoint = blackPoint || [0, 0, 0];
range = range || [-100, 100, -100, 100];
// Translate args to spec variables
this.XW = whitePoint[0];
this.YW = whitePoint[1];
this.ZW = whitePoint[2];
this.amin = range[0];
this.amax = range[1];
this.bmin = range[2];
this.bmax = range[3];
// These are here just for completeness - the spec doesn't offer any
// formulas that use BlackPoint in Lab
this.XB = blackPoint[0];
this.YB = blackPoint[1];
this.ZB = blackPoint[2];
// Validate vars as per spec
if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
error('Invalid WhitePoint components, no fallback available');
}
if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
info('Invalid BlackPoint, falling back to default');
this.XB = this.YB = this.ZB = 0;
}
if (this.amin > this.amax || this.bmin > this.bmax) {
info('Invalid Range, falling back to defaults');
this.amin = -100;
this.amax = 100;
this.bmin = -100;
this.bmax = 100;
}
}
// Function g(x) from spec
function fn_g(x) {
if (x >= 6 / 29) {
return x * x * x;
} else {
return (108 / 841) * (x - 4 / 29);
}
}
function decode(value, high1, low2, high2) {
return low2 + (value) * (high2 - low2) / (high1);
}
// If decoding is needed maxVal should be 2^bits per component - 1.
function convertToRgb(cs, src, srcOffset, maxVal, dest, destOffset) {
// XXX: Lab input is in the range of [0, 100], [amin, amax], [bmin, bmax]
// not the usual [0, 1]. If a command like setFillColor is used the src
// values will already be within the correct range. However, if we are
// converting an image we have to map the values to the correct range given
// above.
// Ls,as,bs <---> L*,a*,b* in the spec
var Ls = src[srcOffset];
var as = src[srcOffset + 1];
var bs = src[srcOffset + 2];
if (maxVal !== false) {
Ls = decode(Ls, maxVal, 0, 100);
as = decode(as, maxVal, cs.amin, cs.amax);
bs = decode(bs, maxVal, cs.bmin, cs.bmax);
}
// Adjust limits of 'as' and 'bs'
as = as > cs.amax ? cs.amax : as < cs.amin ? cs.amin : as;
bs = bs > cs.bmax ? cs.bmax : bs < cs.bmin ? cs.bmin : bs;
// Computes intermediate variables X,Y,Z as per spec
var M = (Ls + 16) / 116;
var L = M + (as / 500);
var N = M - (bs / 200);
var X = cs.XW * fn_g(L);
var Y = cs.YW * fn_g(M);
var Z = cs.ZW * fn_g(N);
var r, g, b;
// Using different conversions for D50 and D65 white points,
// per http://www.color.org/srgb.pdf
if (cs.ZW < 1) {
// Assuming D50 (X=0.9642, Y=1.00, Z=0.8249)
r = X * 3.1339 + Y * -1.6170 + Z * -0.4906;
g = X * -0.9785 + Y * 1.9160 + Z * 0.0333;
b = X * 0.0720 + Y * -0.2290 + Z * 1.4057;
} else {
// Assuming D65 (X=0.9505, Y=1.00, Z=1.0888)
r = X * 3.2406 + Y * -1.5372 + Z * -0.4986;
g = X * -0.9689 + Y * 1.8758 + Z * 0.0415;
b = X * 0.0557 + Y * -0.2040 + Z * 1.0570;
}
// clamp color values to [0,1] range then convert to [0,255] range.
dest[destOffset] = r <= 0 ? 0 : r >= 1 ? 255 : Math.sqrt(r) * 255 | 0;
dest[destOffset + 1] = g <= 0 ? 0 : g >= 1 ? 255 : Math.sqrt(g) * 255 | 0;
dest[destOffset + 2] = b <= 0 ? 0 : b >= 1 ? 255 : Math.sqrt(b) * 255 | 0;
}
LabCS.prototype = {
getRgb: ColorSpace.prototype.getRgb,
getRgbItem: function LabCS_getRgbItem(src, srcOffset, dest, destOffset) {
convertToRgb(this, src, srcOffset, false, dest, destOffset);
},
getRgbBuffer: function LabCS_getRgbBuffer(src, srcOffset, count,
dest, destOffset, bits,
alpha01) {
var maxVal = (1 << bits) - 1;
for (var i = 0; i < count; i++) {
convertToRgb(this, src, srcOffset, maxVal, dest, destOffset);
srcOffset += 3;
destOffset += 3 + alpha01;
}
},
getOutputLength: function LabCS_getOutputLength(inputLength, alpha01) {
return (inputLength * (3 + alpha01) / 3) | 0;
},
isPassthrough: ColorSpace.prototype.isPassthrough,
isDefaultDecode: function LabCS_isDefaultDecode(decodeMap) {
// XXX: Decoding is handled with the lab conversion because of the strange
// ranges that are used.
return true;
},
usesZeroToOneRange: false
};
return LabCS;
})();
var PDFFunction = (function PDFFunctionClosure() {
var CONSTRUCT_SAMPLED = 0;
var CONSTRUCT_INTERPOLATED = 2;
var CONSTRUCT_STICHED = 3;
var CONSTRUCT_POSTSCRIPT = 4;
return {
getSampleArray: function PDFFunction_getSampleArray(size, outputSize, bps,
str) {
var i, ii;
var length = 1;
for (i = 0, ii = size.length; i < ii; i++) {
length *= size[i];
}
length *= outputSize;
var array = [];
var codeSize = 0;
var codeBuf = 0;
// 32 is a valid bps so shifting won't work
var sampleMul = 1.0 / (Math.pow(2.0, bps) - 1);
var strBytes = str.getBytes((length * bps + 7) / 8);
var strIdx = 0;
for (i = 0; i < length; i++) {
while (codeSize < bps) {
codeBuf <<= 8;
codeBuf |= strBytes[strIdx++];
codeSize += 8;
}
codeSize -= bps;
array.push((codeBuf >> codeSize) * sampleMul);
codeBuf &= (1 << codeSize) - 1;
}
return array;
},
getIR: function PDFFunction_getIR(xref, fn) {
var dict = fn.dict;
if (!dict) {
dict = fn;
}
var types = [this.constructSampled,
null,
this.constructInterpolated,
this.constructStiched,
this.constructPostScript];
var typeNum = dict.get('FunctionType');
var typeFn = types[typeNum];
if (!typeFn) {
error('Unknown type of function');
}
return typeFn.call(this, fn, dict, xref);
},
fromIR: function PDFFunction_fromIR(IR) {
var type = IR[0];
switch (type) {
case CONSTRUCT_SAMPLED:
return this.constructSampledFromIR(IR);
case CONSTRUCT_INTERPOLATED:
return this.constructInterpolatedFromIR(IR);
case CONSTRUCT_STICHED:
return this.constructStichedFromIR(IR);
//case CONSTRUCT_POSTSCRIPT:
default:
return this.constructPostScriptFromIR(IR);
}
},
parse: function PDFFunction_parse(xref, fn) {
var IR = this.getIR(xref, fn);
return this.fromIR(IR);
},
constructSampled: function PDFFunction_constructSampled(str, dict) {
function toMultiArray(arr) {
var inputLength = arr.length;
var outputLength = arr.length / 2;
var out = [];
var index = 0;
for (var i = 0; i < inputLength; i += 2) {
out[index] = [arr[i], arr[i + 1]];
++index;
}
return out;
}
var domain = dict.get('Domain');
var range = dict.get('Range');
if (!domain || !range) {
error('No domain or range');
}
var inputSize = domain.length / 2;
var outputSize = range.length / 2;
domain = toMultiArray(domain);
range = toMultiArray(range);
var size = dict.get('Size');
var bps = dict.get('BitsPerSample');
var order = dict.get('Order') || 1;
if (order !== 1) {
// No description how cubic spline interpolation works in PDF32000:2008
// As in poppler, ignoring order, linear interpolation may work as good
info('No support for cubic spline interpolation: ' + order);
}
var encode = dict.get('Encode');
if (!encode) {
encode = [];
for (var i = 0; i < inputSize; ++i) {
encode.push(0);
encode.push(size[i] - 1);
}
}
encode = toMultiArray(encode);
var decode = dict.get('Decode');
if (!decode) {
decode = range;
} else {
decode = toMultiArray(decode);
}
var samples = this.getSampleArray(size, outputSize, bps, str);
return [
CONSTRUCT_SAMPLED, inputSize, domain, encode, decode, samples, size,
outputSize, Math.pow(2, bps) - 1, range
];
},
constructSampledFromIR: function PDFFunction_constructSampledFromIR(IR) {
// See chapter 3, page 109 of the PDF reference
function interpolate(x, xmin, xmax, ymin, ymax) {
return ymin + ((x - xmin) * ((ymax - ymin) / (xmax - xmin)));
}
return function constructSampledFromIRResult(args) {
// See chapter 3, page 110 of the PDF reference.
var m = IR[1];
var domain = IR[2];
var encode = IR[3];
var decode = IR[4];
var samples = IR[5];
var size = IR[6];
var n = IR[7];
var mask = IR[8];
var range = IR[9];
if (m != args.length) {
error('Incorrect number of arguments: ' + m + ' != ' +
args.length);
}
var x = args;
// Building the cube vertices: its part and sample index
// http://rjwagner49.com/Mathematics/Interpolation.pdf
var cubeVertices = 1 << m;
var cubeN = new Float64Array(cubeVertices);
var cubeVertex = new Uint32Array(cubeVertices);
var i, j;
for (j = 0; j < cubeVertices; j++) {
cubeN[j] = 1;
}
var k = n, pos = 1;
// Map x_i to y_j for 0 <= i < m using the sampled function.
for (i = 0; i < m; ++i) {
// x_i' = min(max(x_i, Domain_2i), Domain_2i+1)
var domain_2i = domain[i][0];
var domain_2i_1 = domain[i][1];
var xi = Math.min(Math.max(x[i], domain_2i), domain_2i_1);
// e_i = Interpolate(x_i', Domain_2i, Domain_2i+1,
// Encode_2i, Encode_2i+1)
var e = interpolate(xi, domain_2i, domain_2i_1,
encode[i][0], encode[i][1]);
// e_i' = min(max(e_i, 0), Size_i - 1)
var size_i = size[i];
e = Math.min(Math.max(e, 0), size_i - 1);
// Adjusting the cube: N and vertex sample index
var e0 = e < size_i - 1 ? Math.floor(e) : e - 1; // e1 = e0 + 1;
var n0 = e0 + 1 - e; // (e1 - e) / (e1 - e0);
var n1 = e - e0; // (e - e0) / (e1 - e0);
var offset0 = e0 * k;
var offset1 = offset0 + k; // e1 * k
for (j = 0; j < cubeVertices; j++) {
if (j & pos) {
cubeN[j] *= n1;
cubeVertex[j] += offset1;
} else {
cubeN[j] *= n0;
cubeVertex[j] += offset0;
}
}
k *= size_i;
pos <<= 1;
}
var y = new Float64Array(n);
for (j = 0; j < n; ++j) {
// Sum all cube vertices' samples portions
var rj = 0;
for (i = 0; i < cubeVertices; i++) {
rj += samples[cubeVertex[i] + j] * cubeN[i];
}
// r_j' = Interpolate(r_j, 0, 2^BitsPerSample - 1,
// Decode_2j, Decode_2j+1)
rj = interpolate(rj, 0, 1, decode[j][0], decode[j][1]);
// y_j = min(max(r_j, range_2j), range_2j+1)
y[j] = Math.min(Math.max(rj, range[j][0]), range[j][1]);
}
return y;
};
},
constructInterpolated: function PDFFunction_constructInterpolated(str,
dict) {
var c0 = dict.get('C0') || [0];
var c1 = dict.get('C1') || [1];
var n = dict.get('N');
if (!isArray(c0) || !isArray(c1)) {
error('Illegal dictionary for interpolated function');
}
var length = c0.length;
var diff = [];
for (var i = 0; i < length; ++i) {
diff.push(c1[i] - c0[i]);
}
return [CONSTRUCT_INTERPOLATED, c0, diff, n];
},
constructInterpolatedFromIR:
function PDFFunction_constructInterpolatedFromIR(IR) {
var c0 = IR[1];
var diff = IR[2];
var n = IR[3];
var length = diff.length;
return function constructInterpolatedFromIRResult(args) {
var x = n == 1 ? args[0] : Math.pow(args[0], n);
var out = [];
for (var j = 0; j < length; ++j) {
out.push(c0[j] + (x * diff[j]));
}
return out;
};
},
constructStiched: function PDFFunction_constructStiched(fn, dict, xref) {
var domain = dict.get('Domain');
if (!domain) {
error('No domain');
}
var inputSize = domain.length / 2;
if (inputSize != 1) {
error('Bad domain for stiched function');
}
var fnRefs = dict.get('Functions');
var fns = [];
for (var i = 0, ii = fnRefs.length; i < ii; ++i) {
fns.push(PDFFunction.getIR(xref, xref.fetchIfRef(fnRefs[i])));
}
var bounds = dict.get('Bounds');
var encode = dict.get('Encode');
return [CONSTRUCT_STICHED, domain, bounds, encode, fns];
},
constructStichedFromIR: function PDFFunction_constructStichedFromIR(IR) {
var domain = IR[1];
var bounds = IR[2];
var encode = IR[3];
var fnsIR = IR[4];
var fns = [];
for (var i = 0, ii = fnsIR.length; i < ii; i++) {
fns.push(PDFFunction.fromIR(fnsIR[i]));
}
return function constructStichedFromIRResult(args) {
var clip = function constructStichedFromIRClip(v, min, max) {
if (v > max) {
v = max;
} else if (v < min) {
v = min;
}
return v;
};
// clip to domain
var v = clip(args[0], domain[0], domain[1]);
// calulate which bound the value is in
for (var i = 0, ii = bounds.length; i < ii; ++i) {
if (v < bounds[i]) {
break;
}
}
// encode value into domain of function
var dmin = domain[0];
if (i > 0) {
dmin = bounds[i - 1];
}
var dmax = domain[1];
if (i < bounds.length) {
dmax = bounds[i];
}
var rmin = encode[2 * i];
var rmax = encode[2 * i + 1];
var v2 = rmin + (v - dmin) * (rmax - rmin) / (dmax - dmin);
// call the appropriate function
return fns[i]([v2]);
};
},
constructPostScript: function PDFFunction_constructPostScript(fn, dict,
xref) {
var domain = dict.get('Domain');
var range = dict.get('Range');
if (!domain) {
error('No domain.');
}
if (!range) {
error('No range.');
}
var lexer = new PostScriptLexer(fn);
var parser = new PostScriptParser(lexer);
var code = parser.parse();
return [CONSTRUCT_POSTSCRIPT, domain, range, code];
},
constructPostScriptFromIR: function PDFFunction_constructPostScriptFromIR(
IR) {
var domain = IR[1];
var range = IR[2];
var code = IR[3];
var numOutputs = range.length / 2;
var evaluator = new PostScriptEvaluator(code);
// Cache the values for a big speed up, the cache size is limited though
// since the number of possible values can be huge from a PS function.
var cache = new FunctionCache();
return function constructPostScriptFromIRResult(args) {
var initialStack = [];
for (var i = 0, ii = (domain.length / 2); i < ii; ++i) {
initialStack.push(args[i]);
}
var key = initialStack.join('_');
if (cache.has(key)) {
return cache.get(key);
}
var stack = evaluator.execute(initialStack);
var transformed = [];
for (i = numOutputs - 1; i >= 0; --i) {
var out = stack.pop();
var rangeIndex = 2 * i;
if (out < range[rangeIndex]) {
out = range[rangeIndex];
} else if (out > range[rangeIndex + 1]) {
out = range[rangeIndex + 1];
}
transformed[i] = out;
}
cache.set(key, transformed);
return transformed;
};
}
};
})();
var FunctionCache = (function FunctionCacheClosure() {
// Of 10 PDF's with type4 functions the maxium number of distinct values seen
// was 256. This still may need some tweaking in the future though.
var MAX_CACHE_SIZE = 1024;
function FunctionCache() {
this.cache = {};
this.total = 0;
}
FunctionCache.prototype = {
has: function FunctionCache_has(key) {
return key in this.cache;
},
get: function FunctionCache_get(key) {
return this.cache[key];
},
set: function FunctionCache_set(key, value) {
if (this.total < MAX_CACHE_SIZE) {
this.cache[key] = value;
this.total++;
}
}
};
return FunctionCache;
})();
var PostScriptStack = (function PostScriptStackClosure() {
var MAX_STACK_SIZE = 100;
function PostScriptStack(initialStack) {
this.stack = initialStack || [];
}
PostScriptStack.prototype = {
push: function PostScriptStack_push(value) {
if (this.stack.length >= MAX_STACK_SIZE) {
error('PostScript function stack overflow.');
}
this.stack.push(value);
},
pop: function PostScriptStack_pop() {
if (this.stack.length <= 0) {
error('PostScript function stack underflow.');
}
return this.stack.pop();
},
copy: function PostScriptStack_copy(n) {
if (this.stack.length + n >= MAX_STACK_SIZE) {
error('PostScript function stack overflow.');
}
var stack = this.stack;
for (var i = stack.length - n, j = n - 1; j >= 0; j--, i++) {
stack.push(stack[i]);
}
},
index: function PostScriptStack_index(n) {
this.push(this.stack[this.stack.length - n - 1]);
},
// rotate the last n stack elements p times
roll: function PostScriptStack_roll(n, p) {
var stack = this.stack;
var l = stack.length - n;
var r = stack.length - 1, c = l + (p - Math.floor(p / n) * n), i, j, t;
for (i = l, j = r; i < j; i++, j--) {
t = stack[i]; stack[i] = stack[j]; stack[j] = t;
}
for (i = l, j = c - 1; i < j; i++, j--) {
t = stack[i]; stack[i] = stack[j]; stack[j] = t;
}
for (i = c, j = r; i < j; i++, j--) {
t = stack[i]; stack[i] = stack[j]; stack[j] = t;
}
}
};
return PostScriptStack;
})();
var PostScriptEvaluator = (function PostScriptEvaluatorClosure() {
function PostScriptEvaluator(operators) {
this.operators = operators;
}
PostScriptEvaluator.prototype = {
execute: function PostScriptEvaluator_execute(initialStack) {
var stack = new PostScriptStack(initialStack);
var counter = 0;
var operators = this.operators;
var length = operators.length;
var operator, a, b;
while (counter < length) {
operator = operators[counter++];
if (typeof operator == 'number') {
// Operator is really an operand and should be pushed to the stack.
stack.push(operator);
continue;
}
switch (operator) {
// non standard ps operators
case 'jz': // jump if false
b = stack.pop();
a = stack.pop();
if (!a) {
counter = b;
}
break;
case 'j': // jump
a = stack.pop();
counter = a;
break;
// all ps operators in alphabetical order (excluding if/ifelse)
case 'abs':
a = stack.pop();
stack.push(Math.abs(a));
break;
case 'add':
b = stack.pop();
a = stack.pop();
stack.push(a + b);
break;
case 'and':
b = stack.pop();
a = stack.pop();
if (isBool(a) && isBool(b)) {
stack.push(a && b);
} else {
stack.push(a & b);
}
break;
case 'atan':
a = stack.pop();
stack.push(Math.atan(a));
break;
case 'bitshift':
b = stack.pop();
a = stack.pop();
if (a > 0) {
stack.push(a << b);
} else {
stack.push(a >> b);
}
break;
case 'ceiling':
a = stack.pop();
stack.push(Math.ceil(a));
break;
case 'copy':
a = stack.pop();
stack.copy(a);
break;
case 'cos':
a = stack.pop();
stack.push(Math.cos(a));
break;
case 'cvi':
a = stack.pop() | 0;
stack.push(a);
break;
case 'cvr':
// noop
break;
case 'div':
b = stack.pop();
a = stack.pop();
stack.push(a / b);
break;
case 'dup':
stack.copy(1);
break;
case 'eq':
b = stack.pop();
a = stack.pop();
stack.push(a == b);
break;
case 'exch':
stack.roll(2, 1);
break;
case 'exp':
b = stack.pop();
a = stack.pop();
stack.push(Math.pow(a, b));
break;
case 'false':
stack.push(false);
break;
case 'floor':
a = stack.pop();
stack.push(Math.floor(a));
break;
case 'ge':
b = stack.pop();
a = stack.pop();
stack.push(a >= b);
break;
case 'gt':
b = stack.pop();
a = stack.pop();
stack.push(a > b);
break;
case 'idiv':
b = stack.pop();
a = stack.pop();
stack.push((a / b) | 0);
break;
case 'index':
a = stack.pop();
stack.index(a);
break;
case 'le':
b = stack.pop();
a = stack.pop();
stack.push(a <= b);
break;
case 'ln':
a = stack.pop();
stack.push(Math.log(a));
break;
case 'log':
a = stack.pop();
stack.push(Math.log(a) / Math.LN10);
break;
case 'lt':
b = stack.pop();
a = stack.pop();
stack.push(a < b);
break;
case 'mod':
b = stack.pop();
a = stack.pop();
stack.push(a % b);
break;
case 'mul':
b = stack.pop();
a = stack.pop();
stack.push(a * b);
break;
case 'ne':
b = stack.pop();
a = stack.pop();
stack.push(a != b);
break;
case 'neg':
a = stack.pop();
stack.push(-b);
break;
case 'not':
a = stack.pop();
if (isBool(a) && isBool(b)) {
stack.push(a && b);
} else {
stack.push(a & b);
}
break;
case 'or':
b = stack.pop();
a = stack.pop();
if (isBool(a) && isBool(b)) {
stack.push(a || b);
} else {
stack.push(a | b);
}
break;
case 'pop':
stack.pop();
break;
case 'roll':
b = stack.pop();
a = stack.pop();
stack.roll(a, b);
break;
case 'round':
a = stack.pop();
stack.push(Math.round(a));
break;
case 'sin':
a = stack.pop();
stack.push(Math.sin(a));
break;
case 'sqrt':
a = stack.pop();
stack.push(Math.sqrt(a));
break;
case 'sub':
b = stack.pop();
a = stack.pop();
stack.push(a - b);
break;
case 'true':
stack.push(true);
break;
case 'truncate':
a = stack.pop();
a = a < 0 ? Math.ceil(a) : Math.floor(a);
stack.push(a);
break;
case 'xor':
b = stack.pop();
a = stack.pop();
if (isBool(a) && isBool(b)) {
stack.push(a != b);
} else {
stack.push(a ^ b);
}
break;
default:
error('Unknown operator ' + operator);
break;
}
}
return stack.stack;
}
};
return PostScriptEvaluator;
})();
var HIGHLIGHT_OFFSET = 4; // px
var SUPPORTED_TYPES = ['Link', 'Text', 'Widget'];
var Annotation = (function AnnotationClosure() {
// 12.5.5: Algorithm: Appearance streams
function getTransformMatrix(rect, bbox, matrix) {
var bounds = Util.getAxialAlignedBoundingBox(bbox, matrix);
var minX = bounds[0];
var minY = bounds[1];
var maxX = bounds[2];
var maxY = bounds[3];
if (minX === maxX || minY === maxY) {
// From real-life file, bbox was [0, 0, 0, 0]. In this case,
// just apply the transform for rect
return [1, 0, 0, 1, rect[0], rect[1]];
}
var xRatio = (rect[2] - rect[0]) / (maxX - minX);
var yRatio = (rect[3] - rect[1]) / (maxY - minY);
return [
xRatio,
0,
0,
yRatio,
rect[0] - minX * xRatio,
rect[1] - minY * yRatio
];
}
function getDefaultAppearance(dict) {
var appearanceState = dict.get('AP');
if (!isDict(appearanceState)) {
return;
}
var appearance;
var appearances = appearanceState.get('N');
if (isDict(appearances)) {
var as = dict.get('AS');
if (as && appearances.has(as.name)) {
appearance = appearances.get(as.name);
}
} else {
appearance = appearances;
}
return appearance;
}
function Annotation(params) {
if (params.data) {
this.data = params.data;
return;
}
var dict = params.dict;
var data = this.data = {};
data.subtype = dict.get('Subtype').name;
var rect = dict.get('Rect') || [0, 0, 0, 0];
data.rect = Util.normalizeRect(rect);
data.annotationFlags = dict.get('F');
var color = dict.get('C');
if (isArray(color) && color.length === 3) {
// TODO(mack): currently only supporting rgb; need support different
// colorspaces
data.color = color;
} else {
data.color = [0, 0, 0];
}
// Some types of annotations have border style dict which has more
// info than the border array
if (dict.has('BS')) {
var borderStyle = dict.get('BS');
data.borderWidth = borderStyle.has('W') ? borderStyle.get('W') : 1;
} else {
var borderArray = dict.get('Border') || [0, 0, 1];
data.borderWidth = borderArray[2] || 0;
// TODO: implement proper support for annotations with line dash patterns.
var dashArray = borderArray[3];
if (data.borderWidth > 0 && dashArray && isArray(dashArray)) {
var dashArrayLength = dashArray.length;
if (dashArrayLength > 0) {
// According to the PDF specification: the elements in a dashArray
// shall be numbers that are nonnegative and not all equal to zero.
var isInvalid = false;
var numPositive = 0;
for (var i = 0; i < dashArrayLength; i++) {
var validNumber = (+dashArray[i] >= 0);
if (!validNumber) {
isInvalid = true;
break;
} else if (dashArray[i] > 0) {
numPositive++;
}
}
if (isInvalid || numPositive === 0) {
data.borderWidth = 0;
}
}
}
}
this.appearance = getDefaultAppearance(dict);
data.hasAppearance = !!this.appearance;
}
Annotation.prototype = {
getData: function Annotation_getData() {
return this.data;
},
hasHtml: function Annotation_hasHtml() {
return false;
},
getHtmlElement: function Annotation_getHtmlElement(commonObjs) {
throw new NotImplementedException(
'getHtmlElement() should be implemented in subclass');
},
// TODO(mack): Remove this, it's not really that helpful.
getEmptyContainer: function Annotation_getEmptyContainer(tagName, rect,
borderWidth) {
assert(!isWorker,
'getEmptyContainer() should be called from main thread');
var bWidth = borderWidth || 0;
rect = rect || this.data.rect;
var element = document.createElement(tagName);
element.style.borderWidth = bWidth + 'px';
var width = rect[2] - rect[0] - 2 * bWidth;
var height = rect[3] - rect[1] - 2 * bWidth;
element.style.width = width + 'px';
element.style.height = height + 'px';
return element;
},
isInvisible: function Annotation_isInvisible() {
var data = this.data;
if (data && SUPPORTED_TYPES.indexOf(data.subtype) !== -1) {
return false;
} else {
return !!(data &&
data.annotationFlags && // Default: not invisible
data.annotationFlags & 0x1); // Invisible
}
},
isViewable: function Annotation_isViewable() {
var data = this.data;
return !!(!this.isInvisible() &&
data &&
(!data.annotationFlags ||
!(data.annotationFlags & 0x22)) && // Hidden or NoView
data.rect); // rectangle is nessessary
},
isPrintable: function Annotation_isPrintable() {
var data = this.data;
return !!(!this.isInvisible() &&
data &&
data.annotationFlags && // Default: not printable
data.annotationFlags & 0x4 && // Print
data.rect); // rectangle is nessessary
},
loadResources: function(keys) {
var promise = new LegacyPromise();
this.appearance.dict.getAsync('Resources').then(function(resources) {
if (!resources) {
promise.resolve();
return;
}
var objectLoader = new ObjectLoader(resources.map,
keys,
resources.xref);
objectLoader.load().then(function() {
promise.resolve(resources);
});
}.bind(this));
return promise;
},
getOperatorList: function Annotation_getOperatorList(evaluator) {
var promise = new LegacyPromise();
if (!this.appearance) {
promise.resolve(new OperatorList());
return promise;
}
var data = this.data;
var appearanceDict = this.appearance.dict;
var resourcesPromise = this.loadResources([
'ExtGState',
'ColorSpace',
'Pattern',
'Shading',
'XObject',
'Font'
// ProcSet
// Properties
]);
var bbox = appearanceDict.get('BBox') || [0, 0, 1, 1];
var matrix = appearanceDict.get('Matrix') || [1, 0, 0, 1, 0 ,0];
var transform = getTransformMatrix(data.rect, bbox, matrix);
var border = data.border;
resourcesPromise.then(function(resources) {
var opList = new OperatorList();
opList.addOp(OPS.beginAnnotation, [data.rect, transform, matrix]);
evaluator.getOperatorList(this.appearance, resources, opList);
opList.addOp(OPS.endAnnotation, []);
promise.resolve(opList);
this.appearance.reset();
}.bind(this));
return promise;
}
};
Annotation.getConstructor =
function Annotation_getConstructor(subtype, fieldType) {
if (!subtype) {
return;
}
// TODO(mack): Implement FreeText annotations
if (subtype === 'Link') {
return LinkAnnotation;
} else if (subtype === 'Text') {
return TextAnnotation;
} else if (subtype === 'Widget') {
if (!fieldType) {
return;
}
if (fieldType === 'Tx') {
return TextWidgetAnnotation;
} else {
return WidgetAnnotation;
}
} else {
return Annotation;
}
};
// TODO(mack): Support loading annotation from data
Annotation.fromData = function Annotation_fromData(data) {
var subtype = data.subtype;
var fieldType = data.fieldType;
var Constructor = Annotation.getConstructor(subtype, fieldType);
if (Constructor) {
return new Constructor({ data: data });
}
};
Annotation.fromRef = function Annotation_fromRef(xref, ref) {
var dict = xref.fetchIfRef(ref);
if (!isDict(dict)) {
return;
}
var subtype = dict.get('Subtype');
subtype = isName(subtype) ? subtype.name : '';
if (!subtype) {
return;
}
var fieldType = Util.getInheritableProperty(dict, 'FT');
fieldType = isName(fieldType) ? fieldType.name : '';
var Constructor = Annotation.getConstructor(subtype, fieldType);
if (!Constructor) {
return;
}
var params = {
dict: dict,
ref: ref,
};
var annotation = new Constructor(params);
if (annotation.isViewable() || annotation.isPrintable()) {
return annotation;
} else {
warn('unimplemented annotation type: ' + subtype);
}
};
Annotation.appendToOperatorList = function Annotation_appendToOperatorList(
annotations, opList, pdfManager, partialEvaluator, intent) {
function reject(e) {
annotationsReadyPromise.reject(e);
}
var annotationsReadyPromise = new LegacyPromise();
var annotationPromises = [];
for (var i = 0, n = annotations.length; i < n; ++i) {
if (intent === 'display' && annotations[i].isViewable() ||
intent === 'print' && annotations[i].isPrintable()) {
annotationPromises.push(
annotations[i].getOperatorList(partialEvaluator));
}
}
Promise.all(annotationPromises).then(function(datas) {
opList.addOp(OPS.beginAnnotations, []);
for (var i = 0, n = datas.length; i < n; ++i) {
var annotOpList = datas[i];
opList.addOpList(annotOpList);
}
opList.addOp(OPS.endAnnotations, []);
annotationsReadyPromise.resolve();
}, reject);
return annotationsReadyPromise;
};
return Annotation;
})();
PDFJS.Annotation = Annotation;
var WidgetAnnotation = (function WidgetAnnotationClosure() {
function WidgetAnnotation(params) {
Annotation.call(this, params);
if (params.data) {
return;
}
var dict = params.dict;
var data = this.data;
data.fieldValue = stringToPDFString(
Util.getInheritableProperty(dict, 'V') || '');
data.alternativeText = stringToPDFString(dict.get('TU') || '');
data.defaultAppearance = Util.getInheritableProperty(dict, 'DA') || '';
var fieldType = Util.getInheritableProperty(dict, 'FT');
data.fieldType = isName(fieldType) ? fieldType.name : '';
data.fieldFlags = Util.getInheritableProperty(dict, 'Ff') || 0;
this.fieldResources = Util.getInheritableProperty(dict, 'DR') || Dict.empty;
// Building the full field name by collecting the field and
// its ancestors 'T' data and joining them using '.'.
var fieldName = [];
var namedItem = dict;
var ref = params.ref;
while (namedItem) {
var parent = namedItem.get('Parent');
var parentRef = namedItem.getRaw('Parent');
var name = namedItem.get('T');
if (name) {
fieldName.unshift(stringToPDFString(name));
} else {
// The field name is absent, that means more than one field
// with the same name may exist. Replacing the empty name
// with the '`' plus index in the parent's 'Kids' array.
// This is not in the PDF spec but necessary to id the
// the input controls.
var kids = parent.get('Kids');
var j, jj;
for (j = 0, jj = kids.length; j < jj; j++) {
var kidRef = kids[j];
if (kidRef.num == ref.num && kidRef.gen == ref.gen) {
break;
}
}
fieldName.unshift('`' + j);
}
namedItem = parent;
ref = parentRef;
}
data.fullName = fieldName.join('.');
}
var parent = Annotation.prototype;
Util.inherit(WidgetAnnotation, Annotation, {
isViewable: function WidgetAnnotation_isViewable() {
if (this.data.fieldType === 'Sig') {
warn('unimplemented annotation type: Widget signature');
return false;
}
return parent.isViewable.call(this);
}
});
return WidgetAnnotation;
})();
var TextWidgetAnnotation = (function TextWidgetAnnotationClosure() {
function TextWidgetAnnotation(params) {
WidgetAnnotation.call(this, params);
if (params.data) {
return;
}
this.data.textAlignment = Util.getInheritableProperty(params.dict, 'Q');
}
// TODO(mack): This dupes some of the logic in CanvasGraphics.setFont()
function setTextStyles(element, item, fontObj) {
var style = element.style;
style.fontSize = item.fontSize + 'px';
style.direction = item.fontDirection < 0 ? 'rtl': 'ltr';
if (!fontObj) {
return;
}
style.fontWeight = fontObj.black ?
(fontObj.bold ? 'bolder' : 'bold') :
(fontObj.bold ? 'bold' : 'normal');
style.fontStyle = fontObj.italic ? 'italic' : 'normal';
var fontName = fontObj.loadedName;
var fontFamily = fontName ? '"' + fontName + '", ' : '';
// Use a reasonable default font if the font doesn't specify a fallback
var fallbackName = fontObj.fallbackName || 'Helvetica, sans-serif';
style.fontFamily = fontFamily + fallbackName;
}
var parent = WidgetAnnotation.prototype;
Util.inherit(TextWidgetAnnotation, WidgetAnnotation, {
hasHtml: function TextWidgetAnnotation_hasHtml() {
return !this.data.hasAppearance && !!this.data.fieldValue;
},
getHtmlElement: function TextWidgetAnnotation_getHtmlElement(commonObjs) {
assert(!isWorker, 'getHtmlElement() shall be called from main thread');
var item = this.data;
var element = this.getEmptyContainer('div');
element.style.display = 'table';
var content = document.createElement('div');
content.textContent = item.fieldValue;
var textAlignment = item.textAlignment;
content.style.textAlign = ['left', 'center', 'right'][textAlignment];
content.style.verticalAlign = 'middle';
content.style.display = 'table-cell';
var fontObj = item.fontRefName ?
commonObjs.getData(item.fontRefName) : null;
var cssRules = setTextStyles(content, item, fontObj);
element.appendChild(content);
return element;
},
getOperatorList: function TextWidgetAnnotation_getOperatorList(evaluator) {
if (this.appearance) {
return Annotation.prototype.getOperatorList.call(this, evaluator);
}
var promise = new LegacyPromise();
var opList = new OperatorList();
var data = this.data;
// Even if there is an appearance stream, ignore it. This is the
// behaviour used by Adobe Reader.
var defaultAppearance = data.defaultAppearance;
if (!defaultAppearance) {
promise.resolve(opList);
return promise;
}
// Include any font resources found in the default appearance
var stream = new Stream(stringToBytes(defaultAppearance));
evaluator.getOperatorList(stream, this.fieldResources, opList);
var appearanceFnArray = opList.fnArray;
var appearanceArgsArray = opList.argsArray;
var fnArray = [];
var argsArray = [];
// TODO(mack): Add support for stroke color
data.rgb = [0, 0, 0];
// TODO THIS DOESN'T MAKE ANY SENSE SINCE THE fnArray IS EMPTY!
for (var i = 0, n = fnArray.length; i < n; ++i) {
var fnId = appearanceFnArray[i];
var args = appearanceArgsArray[i];
if (fnId === OPS.setFont) {
data.fontRefName = args[0];
var size = args[1];
if (size < 0) {
data.fontDirection = -1;
data.fontSize = -size;
} else {
data.fontDirection = 1;
data.fontSize = size;
}
} else if (fnId === OPS.setFillRGBColor) {
data.rgb = args;
} else if (fnId === OPS.setFillGray) {
var rgbValue = args[0] * 255;
data.rgb = [rgbValue, rgbValue, rgbValue];
}
}
promise.resolve(opList);
return promise;
}
});
return TextWidgetAnnotation;
})();
var InteractiveAnnotation = (function InteractiveAnnotationClosure() {
function InteractiveAnnotation(params) {
Annotation.call(this, params);
}
Util.inherit(InteractiveAnnotation, Annotation, {
hasHtml: function InteractiveAnnotation_hasHtml() {
return true;
},
highlight: function InteractiveAnnotation_highlight() {
if (this.highlightElement &&
this.highlightElement.hasAttribute('hidden')) {
this.highlightElement.removeAttribute('hidden');
}
},
unhighlight: function InteractiveAnnotation_unhighlight() {
if (this.highlightElement &&
!this.highlightElement.hasAttribute('hidden')) {
this.highlightElement.setAttribute('hidden', true);
}
},
initContainer: function InteractiveAnnotation_initContainer() {
var item = this.data;
var rect = item.rect;
var container = this.getEmptyContainer('section', rect, item.borderWidth);
container.style.backgroundColor = item.color;
var color = item.color;
var rgb = [];
for (var i = 0; i < 3; ++i) {
rgb[i] = Math.round(color[i] * 255);
}
item.colorCssRgb = Util.makeCssRgb(rgb);
var highlight = document.createElement('div');
highlight.className = 'annotationHighlight';
highlight.style.left = highlight.style.top = -HIGHLIGHT_OFFSET + 'px';
highlight.style.right = highlight.style.bottom = -HIGHLIGHT_OFFSET + 'px';
highlight.setAttribute('hidden', true);
this.highlightElement = highlight;
container.appendChild(this.highlightElement);
return container;
}
});
return InteractiveAnnotation;
})();
var TextAnnotation = (function TextAnnotationClosure() {
function TextAnnotation(params) {
InteractiveAnnotation.call(this, params);
if (params.data) {
return;
}
var dict = params.dict;
var data = this.data;
var content = dict.get('Contents');
var title = dict.get('T');
data.content = stringToPDFString(content || '');
data.title = stringToPDFString(title || '');
if (data.hasAppearance) {
data.name = 'NoIcon';
} else {
data.name = dict.has('Name') ? dict.get('Name').name : 'Note';
}
if (dict.has('C')) {
data.hasBgColor = true;
}
}
var ANNOT_MIN_SIZE = 10;
Util.inherit(TextAnnotation, InteractiveAnnotation, {
getHtmlElement: function TextAnnotation_getHtmlElement(commonObjs) {
assert(!isWorker, 'getHtmlElement() shall be called from main thread');
var item = this.data;
var rect = item.rect;
// sanity check because of OOo-generated PDFs
if ((rect[3] - rect[1]) < ANNOT_MIN_SIZE) {
rect[3] = rect[1] + ANNOT_MIN_SIZE;
}
if ((rect[2] - rect[0]) < ANNOT_MIN_SIZE) {
rect[2] = rect[0] + (rect[3] - rect[1]); // make it square
}
var container = this.initContainer();
container.className = 'annotText';
var image = document.createElement('img');
image.style.height = container.style.height;
image.style.width = container.style.width;
var iconName = item.name;
image.src = PDFJS.imageResourcesPath + 'annotation-' +
iconName.toLowerCase() + '.svg';
image.alt = '[{{type}} Annotation]';
image.dataset.l10nId = 'text_annotation_type';
image.dataset.l10nArgs = JSON.stringify({type: iconName});
var contentWrapper = document.createElement('div');
contentWrapper.className = 'annotTextContentWrapper';
contentWrapper.style.left = Math.floor(rect[2] - rect[0] + 5) + 'px';
contentWrapper.style.top = '-10px';
var content = document.createElement('div');
content.className = 'annotTextContent';
content.setAttribute('hidden', true);
var i, ii;
if (item.hasBgColor) {
var color = item.color;
var rgb = [];
for (i = 0; i < 3; ++i) {
// Enlighten the color (70%)
var c = Math.round(color[i] * 255);
rgb[i] = Math.round((255 - c) * 0.7) + c;
}
content.style.backgroundColor = Util.makeCssRgb(rgb);
}
var title = document.createElement('h1');
var text = document.createElement('p');
title.textContent = item.title;
if (!item.content && !item.title) {
content.setAttribute('hidden', true);
} else {
var e = document.createElement('span');
var lines = item.content.split(/(?:\r\n?|\n)/);
for (i = 0, ii = lines.length; i < ii; ++i) {
var line = lines[i];
e.appendChild(document.createTextNode(line));
if (i < (ii - 1)) {
e.appendChild(document.createElement('br'));
}
}
text.appendChild(e);
var pinned = false;
var showAnnotation = function showAnnotation(pin) {
if (pin) {
pinned = true;
}
if (content.hasAttribute('hidden')) {
container.style.zIndex += 1;
content.removeAttribute('hidden');
}
};
var hideAnnotation = function hideAnnotation(unpin) {
if (unpin) {
pinned = false;
}
if (!content.hasAttribute('hidden') && !pinned) {
container.style.zIndex -= 1;
content.setAttribute('hidden', true);
}
};
var toggleAnnotation = function toggleAnnotation() {
if (pinned) {
hideAnnotation(true);
} else {
showAnnotation(true);
}
};
var self = this;
image.addEventListener('click', function image_clickHandler() {
toggleAnnotation();
}, false);
image.addEventListener('mouseover', function image_mouseOverHandler() {
showAnnotation();
}, false);
image.addEventListener('mouseout', function image_mouseOutHandler() {
hideAnnotation();
}, false);
content.addEventListener('click', function content_clickHandler() {
hideAnnotation(true);
}, false);
}
content.appendChild(title);
content.appendChild(text);
contentWrapper.appendChild(content);
container.appendChild(image);
container.appendChild(contentWrapper);
return container;
}
});
return TextAnnotation;
})();
var LinkAnnotation = (function LinkAnnotationClosure() {
function LinkAnnotation(params) {
InteractiveAnnotation.call(this, params);
if (params.data) {
return;
}
var dict = params.dict;
var data = this.data;
var action = dict.get('A');
if (action) {
var linkType = action.get('S').name;
if (linkType === 'URI') {
var url = action.get('URI');
if (isName(url)) {
// Some bad PDFs do not put parentheses around relative URLs.
url = '/' + url.name;
} else if (url) {
url = addDefaultProtocolToUrl(url);
}
// TODO: pdf spec mentions urls can be relative to a Base
// entry in the dictionary.
if (!isValidUrl(url, false)) {
url = '';
}
data.url = url;
} else if (linkType === 'GoTo') {
data.dest = action.get('D');
} else if (linkType === 'GoToR') {
var urlDict = action.get('F');
if (isDict(urlDict)) {
// We assume that the 'url' is a Filspec dictionary
// and fetch the url without checking any further
url = urlDict.get('F') || '';
}
// TODO: pdf reference says that GoToR
// can also have 'NewWindow' attribute
if (!isValidUrl(url, false)) {
url = '';
}
data.url = url;
data.dest = action.get('D');
} else if (linkType === 'Named') {
data.action = action.get('N').name;
} else {
warn('unrecognized link type: ' + linkType);
}
} else if (dict.has('Dest')) {
// simple destination link
var dest = dict.get('Dest');
data.dest = isName(dest) ? dest.name : dest;
}
}
// Lets URLs beginning with 'www.' default to using the 'http://' protocol.
function addDefaultProtocolToUrl(url) {
if (url && url.indexOf('www.') === 0) {
return ('http://' + url);
}
return url;
}
Util.inherit(LinkAnnotation, InteractiveAnnotation, {
hasOperatorList: function LinkAnnotation_hasOperatorList() {
return false;
},
getHtmlElement: function LinkAnnotation_getHtmlElement(commonObjs) {
var container = this.initContainer();
container.className = 'annotLink';
var item = this.data;
var rect = item.rect;
container.style.borderColor = item.colorCssRgb;
container.style.borderStyle = 'solid';
var link = document.createElement('a');
link.href = link.title = this.data.url || '';
container.appendChild(link);
return container;
}
});
return LinkAnnotation;
})();
/**
* The maximum allowed image size in total pixels e.g. width * height. Images
* above this value will not be drawn. Use -1 for no limit.
* @var {number}
*/
PDFJS.maxImageSize = (PDFJS.maxImageSize === undefined ?
-1 : PDFJS.maxImageSize);
/**
* The url of where the predefined Adobe CMaps are located. Include trailing
* slash.
* @var {string}
*/
PDFJS.cMapUrl = (PDFJS.cMapUrl === undefined ? null : PDFJS.cMapUrl);
/**
* Specifies if CMaps are binary packed.
* @var {boolean}
*/
PDFJS.cMapPacked = PDFJS.cMapPacked === undefined ? false : PDFJS.cMapPacked;
/*
* By default fonts are converted to OpenType fonts and loaded via font face
* rules. If disabled, the font will be rendered using a built in font renderer
* that constructs the glyphs with primitive path commands.
* @var {boolean}
*/
PDFJS.disableFontFace = (PDFJS.disableFontFace === undefined ?
false : PDFJS.disableFontFace);
/**
* Path for image resources, mainly for annotation icons. Include trailing
* slash.
* @var {string}
*/
PDFJS.imageResourcesPath = (PDFJS.imageResourcesPath === undefined ?
'' : PDFJS.imageResourcesPath);
/**
* Disable the web worker and run all code on the main thread. This will happen
* automatically if the browser doesn't support workers or sending typed arrays
* to workers.
* @var {boolean}
*/
PDFJS.disableWorker = (PDFJS.disableWorker === undefined ?
false : PDFJS.disableWorker);
/**
* Path and filename of the worker file. Required when the worker is enabled in
* development mode. If unspecified in the production build, the worker will be
* loaded based on the location of the pdf.js file.
* @var {string}
*/
PDFJS.workerSrc = (PDFJS.workerSrc === undefined ? null : PDFJS.workerSrc);
/**
* Disable range request loading of PDF files. When enabled and if the server
* supports partial content requests then the PDF will be fetched in chunks.
* Enabled (false) by default.
* @var {boolean}
*/
PDFJS.disableRange = (PDFJS.disableRange === undefined ?
false : PDFJS.disableRange);
/**
* Disable pre-fetching of PDF file data. When range requests are enabled PDF.js
* will automatically keep fetching more data even if it isn't needed to display
* the current page. This default behavior can be disabled.
* @var {boolean}
*/
PDFJS.disableAutoFetch = (PDFJS.disableAutoFetch === undefined ?
false : PDFJS.disableAutoFetch);
/**
* Enables special hooks for debugging PDF.js.
* @var {boolean}
*/
PDFJS.pdfBug = (PDFJS.pdfBug === undefined ? false : PDFJS.pdfBug);
/**
* Enables transfer usage in postMessage for ArrayBuffers.
* @var {boolean}
*/
PDFJS.postMessageTransfers = (PDFJS.postMessageTransfers === undefined ?
true : PDFJS.postMessageTransfers);
/**
* Disables URL.createObjectURL usage.
* @var {boolean}
*/
PDFJS.disableCreateObjectURL = (PDFJS.disableCreateObjectURL === undefined ?
false : PDFJS.disableCreateObjectURL);
/**
* Disables WebGL usage.
* @var {boolean}
*/
PDFJS.disableWebGL = (PDFJS.disableWebGL === undefined ?
true : PDFJS.disableWebGL);
/**
* Controls the logging level.
* The constants from PDFJS.VERBOSITY_LEVELS should be used:
* - errors
* - warnings [default]
* - infos
* @var {number}
*/
PDFJS.verbosity = (PDFJS.verbosity === undefined ?
PDFJS.VERBOSITY_LEVELS.warnings : PDFJS.verbosity);
/**
* Document initialization / loading parameters object.
*
* @typedef {Object} DocumentInitParameters
* @property {string} url - The URL of the PDF.
* @property {TypedArray} data - A typed array with PDF data.
* @property {Object} httpHeaders - Basic authentication headers.
* @property {boolean} withCredentials - Indicates whether or not cross-site
* Access-Control requests should be made using credentials such as cookies
* or authorization headers. The default is false.
* @property {string} password - For decrypting password-protected PDFs.
* @property {TypedArray} initialData - A typed array with the first portion or
* all of the pdf data. Used by the extension since some data is already
* loaded before the switch to range requests.
*/
/**
* This is the main entry point for loading a PDF and interacting with it.
* NOTE: If a URL is used to fetch the PDF data a standard XMLHttpRequest(XHR)
* is used, which means it must follow the same origin rules that any XHR does
* e.g. No cross domain requests without CORS.
*
* @param {string|TypedArray|DocumentInitParameters} source Can be a url to
* where a PDF is located, a typed array (Uint8Array) already populated with
* data or parameter object.
*
* @param {Object} pdfDataRangeTransport is optional. It is used if you want
* to manually serve range requests for data in the PDF. See viewer.js for
* an example of pdfDataRangeTransport's interface.
*
* @param {function} passwordCallback is optional. It is used to request a
* password if wrong or no password was provided. The callback receives two
* parameters: function that needs to be called with new password and reason
* (see {PasswordResponses}).
*
* @return {Promise} A promise that is resolved with {@link PDFDocumentProxy}
* object.
*/
PDFJS.getDocument = function getDocument(source,
pdfDataRangeTransport,
passwordCallback,
progressCallback) {
var workerInitializedPromise, workerReadyPromise, transport;
if (typeof source === 'string') {
source = { url: source };
} else if (isArrayBuffer(source)) {
source = { data: source };
} else if (typeof source !== 'object') {
error('Invalid parameter in getDocument, need either Uint8Array, ' +
'string or a parameter object');
}
if (!source.url && !source.data) {
error('Invalid parameter array, need either .data or .url');
}
// copy/use all keys as is except 'url' -- full path is required
var params = {};
for (var key in source) {
if (key === 'url' && typeof window !== 'undefined') {
params[key] = combineUrl(window.location.href, source[key]);
continue;
}
params[key] = source[key];
}
workerInitializedPromise = new PDFJS.LegacyPromise();
workerReadyPromise = new PDFJS.LegacyPromise();
transport = new WorkerTransport(workerInitializedPromise, workerReadyPromise,
pdfDataRangeTransport, progressCallback);
workerInitializedPromise.then(function transportInitialized() {
transport.passwordCallback = passwordCallback;
transport.fetchDocument(params);
});
return workerReadyPromise;
};
/**
* Proxy to a PDFDocument in the worker thread. Also, contains commonly used
* properties that can be read synchronously.
* @class
*/
var PDFDocumentProxy = (function PDFDocumentProxyClosure() {
function PDFDocumentProxy(pdfInfo, transport) {
this.pdfInfo = pdfInfo;
this.transport = transport;
}
PDFDocumentProxy.prototype = /** @lends PDFDocumentProxy.prototype */ {
/**
* @return {number} Total number of pages the PDF contains.
*/
get numPages() {
return this.pdfInfo.numPages;
},
/**
* @return {string} A unique ID to identify a PDF. Not guaranteed to be
* unique.
*/
get fingerprint() {
return this.pdfInfo.fingerprint;
},
/**
* @param {number} pageNumber The page number to get. The first page is 1.
* @return {Promise} A promise that is resolved with a {@link PDFPageProxy}
* object.
*/
getPage: function PDFDocumentProxy_getPage(pageNumber) {
return this.transport.getPage(pageNumber);
},
/**
* @param {{num: number, gen: number}} ref The page reference. Must have
* the 'num' and 'gen' properties.
* @return {Promise} A promise that is resolved with the page index that is
* associated with the reference.
*/
getPageIndex: function PDFDocumentProxy_getPageIndex(ref) {
return this.transport.getPageIndex(ref);
},
/**
* @return {Promise} A promise that is resolved with a lookup table for
* mapping named destinations to reference numbers.
*/
getDestinations: function PDFDocumentProxy_getDestinations() {
return this.transport.getDestinations();
},
/**
* @return {Promise} A promise that is resolved with an array of all the
* JavaScript strings in the name tree.
*/
getJavaScript: function PDFDocumentProxy_getJavaScript() {
var promise = new PDFJS.LegacyPromise();
var js = this.pdfInfo.javaScript;
promise.resolve(js);
return promise;
},
/**
* @return {Promise} A promise that is resolved with an {Array} that is a
* tree outline (if it has one) of the PDF. The tree is in the format of:
* [
* {
* title: string,
* bold: boolean,
* italic: boolean,
* color: rgb array,
* dest: dest obj,
* items: array of more items like this
* },
* ...
* ].
*/
getOutline: function PDFDocumentProxy_getOutline() {
var promise = new PDFJS.LegacyPromise();
var outline = this.pdfInfo.outline;
promise.resolve(outline);
return promise;
},
/**
* @return {Promise} A promise that is resolved with an {Object} that has
* info and metadata properties. Info is an {Object} filled with anything
* available in the information dictionary and similarly metadata is a
* {Metadata} object with information from the metadata section of the PDF.
*/
getMetadata: function PDFDocumentProxy_getMetadata() {
var promise = new PDFJS.LegacyPromise();
var info = this.pdfInfo.info;
var metadata = this.pdfInfo.metadata;
promise.resolve({
info: info,
metadata: (metadata ? new PDFJS.Metadata(metadata) : null)
});
return promise;
},
/**
* @return {Promise} A promise that is resolved with a TypedArray that has
* the raw data from the PDF.
*/
getData: function PDFDocumentProxy_getData() {
var promise = new PDFJS.LegacyPromise();
this.transport.getData(promise);
return promise;
},
/**
* @return {Promise} A promise that is resolved when the document's data
* is loaded. It is resolved with an {Object} that contains the length
* property that indicates size of the PDF data in bytes.
*/
getDownloadInfo: function PDFDocumentProxy_getDownloadInfo() {
return this.transport.downloadInfoPromise;
},
/**
* Cleans up resources allocated by the document, e.g. created @font-face.
*/
cleanup: function PDFDocumentProxy_cleanup() {
this.transport.startCleanup();
},
/**
* Destroys current document instance and terminates worker.
*/
destroy: function PDFDocumentProxy_destroy() {
this.transport.destroy();
}
};
return PDFDocumentProxy;
})();
/**
* Page text content.
*
* @typedef {Object} TextContent
* @property {array} items - array of {@link TextItem}
* @property {Object} styles - {@link TextStyles} objects, indexed by font
* name.
*/
/**
* Page text content part.
*
* @typedef {Object} TextItem
* @property {string} str - text content.
* @property {string} dir - text direction: 'ttb', 'ltr' or 'rtl'.
* @property {array} transform - transformation matrix.
* @property {number} width - width in device space.
* @property {number} height - height in device space.
* @property {string} fontName - font name used by pdf.js for converted font.
*/
/**
* Text style.
*
* @typedef {Object} TextStyle
* @property {number} ascent - font ascent.
* @property {number} descent - font descent.
* @property {boolean} vertical - text is in vertical mode.
* @property {string} fontFamily - possible font family
*/
/**
* Page render parameters.
*
* @typedef {Object} RenderParameters
* @property {Object} canvasContext - A 2D context of a DOM Canvas object.
* @property {PageViewport} viewport - Rendering viewport obtained by
* calling of PDFPage.getViewport method.
* @property {string} intent - Rendering intent, can be 'display' or 'print'
* (default value is 'display').
* @property {Object} imageLayer - (optional) An object that has beginLayout,
* endLayout and appendImage functions.
* @property {function} continueCallback - (optional) A function that will be
* called each time the rendering is paused. To continue
* rendering call the function that is the first argument
* to the callback.
*/
/**
* Proxy to a PDFPage in the worker thread.
* @class
*/
var PDFPageProxy = (function PDFPageProxyClosure() {
function PDFPageProxy(pageInfo, transport) {
this.pageInfo = pageInfo;
this.transport = transport;
this.stats = new StatTimer();
this.stats.enabled = !!globalScope.PDFJS.enableStats;
this.commonObjs = transport.commonObjs;
this.objs = new PDFObjects();
this.cleanupAfterRender = false;
this.pendingDestroy = false;
this.intentStates = {};
}
PDFPageProxy.prototype = /** @lends PDFPageProxy.prototype */ {
/**
* @return {number} Page number of the page. First page is 1.
*/
get pageNumber() {
return this.pageInfo.pageIndex + 1;
},
/**
* @return {number} The number of degrees the page is rotated clockwise.
*/
get rotate() {
return this.pageInfo.rotate;
},
/**
* @return {Object} The reference that points to this page. It has 'num' and
* 'gen' properties.
*/
get ref() {
return this.pageInfo.ref;
},
/**
* @return {Array} An array of the visible portion of the PDF page in the
* user space units - [x1, y1, x2, y2].
*/
get view() {
return this.pageInfo.view;
},
/**
* @param {number} scale The desired scale of the viewport.
* @param {number} rotate Degrees to rotate the viewport. If omitted this
* defaults to the page rotation.
* @return {PageViewport} Contains 'width' and 'height' properties along
* with transforms required for rendering.
*/
getViewport: function PDFPageProxy_getViewport(scale, rotate) {
if (arguments.length < 2) {
rotate = this.rotate;
}
return new PDFJS.PageViewport(this.view, scale, rotate, 0, 0);
},
/**
* @return {Promise} A promise that is resolved with an {Array} of the
* annotation objects.
*/
getAnnotations: function PDFPageProxy_getAnnotations() {
if (this.annotationsPromise) {
return this.annotationsPromise;
}
var promise = new PDFJS.LegacyPromise();
this.annotationsPromise = promise;
this.transport.getAnnotations(this.pageInfo.pageIndex);
return promise;
},
/**
* Begins the process of rendering a page to the desired context.
* @param {RenderParameters} params Page render parameters.
* @return {RenderTask} An object that contains the promise, which
* is resolved when the page finishes rendering.
*/
render: function PDFPageProxy_render(params) {
var stats = this.stats;
stats.time('Overall');
// If there was a pending destroy cancel it so no cleanup happens during
// this call to render.
this.pendingDestroy = false;
var renderingIntent = ('intent' in params ?
(params.intent == 'print' ? 'print' : 'display') : 'display');
if (!this.intentStates[renderingIntent]) {
this.intentStates[renderingIntent] = {};
}
var intentState = this.intentStates[renderingIntent];
// If there is no displayReadyPromise yet, then the operatorList was never
// requested before. Make the request and create the promise.
if (!intentState.displayReadyPromise) {
intentState.receivingOperatorList = true;
intentState.displayReadyPromise = new LegacyPromise();
intentState.operatorList = {
fnArray: [],
argsArray: [],
lastChunk: false
};
this.stats.time('Page Request');
this.transport.messageHandler.send('RenderPageRequest', {
pageIndex: this.pageNumber - 1,
intent: renderingIntent
});
}
var internalRenderTask = new InternalRenderTask(complete, params,
this.objs,
this.commonObjs,
intentState.operatorList,
this.pageNumber);
if (!intentState.renderTasks) {
intentState.renderTasks = [];
}
intentState.renderTasks.push(internalRenderTask);
var renderTask = new RenderTask(internalRenderTask);
var self = this;
intentState.displayReadyPromise.then(
function pageDisplayReadyPromise(transparency) {
if (self.pendingDestroy) {
complete();
return;
}
stats.time('Rendering');
internalRenderTask.initalizeGraphics(transparency);
internalRenderTask.operatorListChanged();
},
function pageDisplayReadPromiseError(reason) {
complete(reason);
}
);
function complete(error) {
var i = intentState.renderTasks.indexOf(internalRenderTask);
if (i >= 0) {
intentState.renderTasks.splice(i, 1);
}
if (self.cleanupAfterRender) {
self.pendingDestroy = true;
}
self._tryDestroy();
if (error) {
renderTask.promise.reject(error);
} else {
renderTask.promise.resolve();
}
stats.timeEnd('Rendering');
stats.timeEnd('Overall');
}
return renderTask;
},
/**
* @return {Promise} That is resolved a {@link TextContent}
* object that represent the page text content.
*/
getTextContent: function PDFPageProxy_getTextContent() {
var promise = new PDFJS.LegacyPromise();
this.transport.messageHandler.send('GetTextContent', {
pageIndex: this.pageNumber - 1
},
function textContentCallback(textContent) {
promise.resolve(textContent);
}
);
return promise;
},
/**
* Destroys resources allocated by the page.
*/
destroy: function PDFPageProxy_destroy() {
this.pendingDestroy = true;
this._tryDestroy();
},
/**
* For internal use only. Attempts to clean up if rendering is in a state
* where that's possible.
* @ignore
*/
_tryDestroy: function PDFPageProxy__destroy() {
if (!this.pendingDestroy ||
Object.keys(this.intentStates).some(function(intent) {
var intentState = this.intentStates[intent];
return (intentState.renderTasks.length !== 0 ||
intentState.receivingOperatorList);
}, this)) {
return;
}
Object.keys(this.intentStates).forEach(function(intent) {
delete this.intentStates[intent];
}, this);
this.objs.clear();
this.pendingDestroy = false;
},
/**
* For internal use only.
* @ignore
*/
_startRenderPage: function PDFPageProxy_startRenderPage(transparency,
intent) {
var intentState = this.intentStates[intent];
intentState.displayReadyPromise.resolve(transparency);
},
/**
* For internal use only.
* @ignore
*/
_renderPageChunk: function PDFPageProxy_renderPageChunk(operatorListChunk,
intent) {
var intentState = this.intentStates[intent];
var i, ii;
// Add the new chunk to the current operator list.
for (i = 0, ii = operatorListChunk.length; i < ii; i++) {
intentState.operatorList.fnArray.push(operatorListChunk.fnArray[i]);
intentState.operatorList.argsArray.push(
operatorListChunk.argsArray[i]);
}
intentState.operatorList.lastChunk = operatorListChunk.lastChunk;
// Notify all the rendering tasks there are more operators to be consumed.
for (i = 0; i < intentState.renderTasks.length; i++) {
intentState.renderTasks[i].operatorListChanged();
}
if (operatorListChunk.lastChunk) {
intentState.receivingOperatorList = false;
this._tryDestroy();
}
}
};
return PDFPageProxy;
})();
/**
* For internal use only.
* @ignore
*/
var WorkerTransport = (function WorkerTransportClosure() {
function WorkerTransport(workerInitializedPromise, workerReadyPromise,
pdfDataRangeTransport, progressCallback) {
this.pdfDataRangeTransport = pdfDataRangeTransport;
this.workerReadyPromise = workerReadyPromise;
this.progressCallback = progressCallback;
this.commonObjs = new PDFObjects();
this.pageCache = [];
this.pagePromises = [];
this.downloadInfoPromise = new PDFJS.LegacyPromise();
this.passwordCallback = null;
// If worker support isn't disabled explicit and the browser has worker
// support, create a new web worker and test if it/the browser fullfills
// all requirements to run parts of pdf.js in a web worker.
// Right now, the requirement is, that an Uint8Array is still an Uint8Array
// as it arrives on the worker. Chrome added this with version 15.
if (!globalScope.PDFJS.disableWorker && typeof Worker !== 'undefined') {
var workerSrc = PDFJS.workerSrc;
if (!workerSrc) {
error('No PDFJS.workerSrc specified');
}
try {
// Some versions of FF can't create a worker on localhost, see:
// https://bugzilla.mozilla.org/show_bug.cgi?id=683280
workerSrc += '.jsf?ln=pdf.js';
var worker = new Worker(workerSrc);
var messageHandler = new MessageHandler('main', worker);
this.messageHandler = messageHandler;
messageHandler.on('test', function transportTest(data) {
var supportTypedArray = data && data.supportTypedArray;
if (supportTypedArray) {
this.worker = worker;
if (!data.supportTransfers) {
PDFJS.postMessageTransfers = false;
}
this.setupMessageHandler(messageHandler);
workerInitializedPromise.resolve();
} else {
globalScope.PDFJS.disableWorker = true;
this.loadFakeWorkerFiles().then(function() {
this.setupFakeWorker();
workerInitializedPromise.resolve();
}.bind(this));
}
}.bind(this));
var testObj = new Uint8Array([PDFJS.postMessageTransfers ? 255 : 0]);
// Some versions of Opera throw a DATA_CLONE_ERR on serializing the
// typed array. Also, checking if we can use transfers.
try {
messageHandler.send('test', testObj, null, [testObj.buffer]);
} catch (ex) {
info('Cannot use postMessage transfers');
testObj[0] = 0;
messageHandler.send('test', testObj);
}
return;
} catch (e) {
info('The worker has been disabled.');
}
}
// Either workers are disabled, not supported or have thrown an exception.
// Thus, we fallback to a faked worker.
globalScope.PDFJS.disableWorker = true;
this.loadFakeWorkerFiles().then(function() {
this.setupFakeWorker();
workerInitializedPromise.resolve();
}.bind(this));
}
WorkerTransport.prototype = {
destroy: function WorkerTransport_destroy() {
this.pageCache = [];
this.pagePromises = [];
var self = this;
this.messageHandler.send('Terminate', null, function () {
FontLoader.clear();
if (self.worker) {
self.worker.terminate();
}
});
},
loadFakeWorkerFiles: function WorkerTransport_loadFakeWorkerFiles() {
if (!PDFJS.fakeWorkerFilesLoadedPromise) {
PDFJS.fakeWorkerFilesLoadedPromise = new LegacyPromise();
// In the developer build load worker_loader which in turn loads all the
// other files and resolves the promise. In production only the
// pdf.worker.js file is needed.
Util.loadScript(PDFJS.workerSrc, function() {
PDFJS.fakeWorkerFilesLoadedPromise.resolve();
});
}
return PDFJS.fakeWorkerFilesLoadedPromise;
},
setupFakeWorker: function WorkerTransport_setupFakeWorker() {
warn('Setting up fake worker.');
// If we don't use a worker, just post/sendMessage to the main thread.
var fakeWorker = {
postMessage: function WorkerTransport_postMessage(obj) {
fakeWorker.onmessage({data: obj});
},
terminate: function WorkerTransport_terminate() {}
};
var messageHandler = new MessageHandler('main', fakeWorker);
this.setupMessageHandler(messageHandler);
// If the main thread is our worker, setup the handling for the messages
// the main thread sends to it self.
PDFJS.WorkerMessageHandler.setup(messageHandler);
},
setupMessageHandler:
function WorkerTransport_setupMessageHandler(messageHandler) {
this.messageHandler = messageHandler;
function updatePassword(password) {
messageHandler.send('UpdatePassword', password);
}
var pdfDataRangeTransport = this.pdfDataRangeTransport;
if (pdfDataRangeTransport) {
pdfDataRangeTransport.addRangeListener(function(begin, chunk) {
messageHandler.send('OnDataRange', {
begin: begin,
chunk: chunk
});
});
pdfDataRangeTransport.addProgressListener(function(loaded) {
messageHandler.send('OnDataProgress', {
loaded: loaded
});
});
messageHandler.on('RequestDataRange',
function transportDataRange(data) {
pdfDataRangeTransport.requestDataRange(data.begin, data.end);
}, this);
}
messageHandler.on('GetDoc', function transportDoc(data) {
var pdfInfo = data.pdfInfo;
this.numPages = data.pdfInfo.numPages;
var pdfDocument = new PDFDocumentProxy(pdfInfo, this);
this.pdfDocument = pdfDocument;
this.workerReadyPromise.resolve(pdfDocument);
}, this);
messageHandler.on('NeedPassword', function transportPassword(data) {
if (this.passwordCallback) {
return this.passwordCallback(updatePassword,
PasswordResponses.NEED_PASSWORD);
}
this.workerReadyPromise.reject(data.exception.message, data.exception);
}, this);
messageHandler.on('IncorrectPassword', function transportBadPass(data) {
if (this.passwordCallback) {
return this.passwordCallback(updatePassword,
PasswordResponses.INCORRECT_PASSWORD);
}
this.workerReadyPromise.reject(data.exception.message, data.exception);
}, this);
messageHandler.on('InvalidPDF', function transportInvalidPDF(data) {
this.workerReadyPromise.reject(data.exception.name, data.exception);
}, this);
messageHandler.on('MissingPDF', function transportMissingPDF(data) {
this.workerReadyPromise.reject(data.exception.message, data.exception);
}, this);
messageHandler.on('UnknownError', function transportUnknownError(data) {
this.workerReadyPromise.reject(data.exception.message, data.exception);
}, this);
messageHandler.on('DataLoaded', function transportPage(data) {
this.downloadInfoPromise.resolve(data);
}, this);
messageHandler.on('GetPage', function transportPage(data) {
var pageInfo = data.pageInfo;
var page = new PDFPageProxy(pageInfo, this);
this.pageCache[pageInfo.pageIndex] = page;
var promise = this.pagePromises[pageInfo.pageIndex];
promise.resolve(page);
}, this);
messageHandler.on('GetAnnotations', function transportAnnotations(data) {
var annotations = data.annotations;
var promise = this.pageCache[data.pageIndex].annotationsPromise;
promise.resolve(annotations);
}, this);
messageHandler.on('StartRenderPage', function transportRender(data) {
var page = this.pageCache[data.pageIndex];
page.stats.timeEnd('Page Request');
page._startRenderPage(data.transparency, data.intent);
}, this);
messageHandler.on('RenderPageChunk', function transportRender(data) {
var page = this.pageCache[data.pageIndex];
page._renderPageChunk(data.operatorList, data.intent);
}, this);
messageHandler.on('commonobj', function transportObj(data) {
var id = data[0];
var type = data[1];
if (this.commonObjs.hasData(id)) {
return;
}
switch (type) {
case 'Font':
var exportedData = data[2];
var font;
if ('error' in exportedData) {
var error = exportedData.error;
warn('Error during font loading: ' + error);
this.commonObjs.resolve(id, error);
break;
} else {
font = new FontFace(exportedData);
}
FontLoader.bind(
[font],
function fontReady(fontObjs) {
this.commonObjs.resolve(id, font);
}.bind(this)
);
break;
case 'FontPath':
this.commonObjs.resolve(id, data[2]);
break;
default:
error('Got unknown common object type ' + type);
}
}, this);
messageHandler.on('obj', function transportObj(data) {
var id = data[0];
var pageIndex = data[1];
var type = data[2];
var pageProxy = this.pageCache[pageIndex];
var imageData;
if (pageProxy.objs.hasData(id)) {
return;
}
switch (type) {
case 'JpegStream':
imageData = data[3];
loadJpegStream(id, imageData, pageProxy.objs);
break;
case 'Image':
imageData = data[3];
pageProxy.objs.resolve(id, imageData);
// heuristics that will allow not to store large data
var MAX_IMAGE_SIZE_TO_STORE = 8000000;
if (imageData && 'data' in imageData &&
imageData.data.length > MAX_IMAGE_SIZE_TO_STORE) {
pageProxy.cleanupAfterRender = true;
}
break;
default:
error('Got unknown object type ' + type);
}
}, this);
messageHandler.on('DocProgress', function transportDocProgress(data) {
if (this.progressCallback) {
this.progressCallback({
loaded: data.loaded,
total: data.total
});
}
}, this);
messageHandler.on('DocError', function transportDocError(data) {
this.workerReadyPromise.reject(data);
}, this);
messageHandler.on('PageError', function transportError(data, intent) {
var page = this.pageCache[data.pageNum - 1];
var intentState = page.intentStates[intent];
if (intentState.displayReadyPromise) {
intentState.displayReadyPromise.reject(data.error);
} else {
error(data.error);
}
}, this);
messageHandler.on('JpegDecode', function(data, deferred) {
var imageUrl = data[0];
var components = data[1];
if (components != 3 && components != 1) {
error('Only 3 component or 1 component can be returned');
}
var img = new Image();
img.onload = (function messageHandler_onloadClosure() {
var width = img.width;
var height = img.height;
var size = width * height;
var rgbaLength = size * 4;
var buf = new Uint8Array(size * components);
var tmpCanvas = createScratchCanvas(width, height);
var tmpCtx = tmpCanvas.getContext('2d');
tmpCtx.drawImage(img, 0, 0);
var data = tmpCtx.getImageData(0, 0, width, height).data;
var i, j;
if (components == 3) {
for (i = 0, j = 0; i < rgbaLength; i += 4, j += 3) {
buf[j] = data[i];
buf[j + 1] = data[i + 1];
buf[j + 2] = data[i + 2];
}
} else if (components == 1) {
for (i = 0, j = 0; i < rgbaLength; i += 4, j++) {
buf[j] = data[i];
}
}
deferred.resolve({ data: buf, width: width, height: height});
}).bind(this);
img.src = imageUrl;
});
},
fetchDocument: function WorkerTransport_fetchDocument(source) {
source.disableAutoFetch = PDFJS.disableAutoFetch;
source.chunkedViewerLoading = !!this.pdfDataRangeTransport;
this.messageHandler.send('GetDocRequest', {
source: source,
disableRange: PDFJS.disableRange,
maxImageSize: PDFJS.maxImageSize,
cMapUrl: PDFJS.cMapUrl,
cMapPacked: PDFJS.cMapPacked,
disableFontFace: PDFJS.disableFontFace,
disableCreateObjectURL: PDFJS.disableCreateObjectURL,
verbosity: PDFJS.verbosity
});
},
getData: function WorkerTransport_getData(promise) {
this.messageHandler.send('GetData', null, function(data) {
promise.resolve(data);
});
},
getPage: function WorkerTransport_getPage(pageNumber, promise) {
if (pageNumber <= 0 || pageNumber > this.numPages ||
(pageNumber|0) !== pageNumber) {
var pagePromise = new PDFJS.LegacyPromise();
pagePromise.reject(new Error('Invalid page request'));
return pagePromise;
}
var pageIndex = pageNumber - 1;
if (pageIndex in this.pagePromises) {
return this.pagePromises[pageIndex];
}
promise = new PDFJS.LegacyPromise();
this.pagePromises[pageIndex] = promise;
this.messageHandler.send('GetPageRequest', { pageIndex: pageIndex });
return promise;
},
getPageIndex: function WorkerTransport_getPageIndexByRef(ref) {
var promise = new PDFJS.LegacyPromise();
this.messageHandler.send('GetPageIndex', { ref: ref },
function (pageIndex) {
promise.resolve(pageIndex);
}
);
return promise;
},
getAnnotations: function WorkerTransport_getAnnotations(pageIndex) {
this.messageHandler.send('GetAnnotationsRequest',
{ pageIndex: pageIndex });
},
getDestinations: function WorkerTransport_getDestinations() {
var promise = new PDFJS.LegacyPromise();
this.messageHandler.send('GetDestinations', null,
function transportDestinations(destinations) {
promise.resolve(destinations);
}
);
return promise;
},
startCleanup: function WorkerTransport_startCleanup() {
this.messageHandler.send('Cleanup', null,
function endCleanup() {
for (var i = 0, ii = this.pageCache.length; i < ii; i++) {
var page = this.pageCache[i];
if (page) {
page.destroy();
}
}
this.commonObjs.clear();
FontLoader.clear();
}.bind(this)
);
}
};
return WorkerTransport;
})();
/**
* A PDF document and page is built of many objects. E.g. there are objects
* for fonts, images, rendering code and such. These objects might get processed
* inside of a worker. The `PDFObjects` implements some basic functions to
* manage these objects.
* @ignore
*/
var PDFObjects = (function PDFObjectsClosure() {
function PDFObjects() {
this.objs = {};
}
PDFObjects.prototype = {
/**
* Internal function.
* Ensures there is an object defined for `objId`.
*/
ensureObj: function PDFObjects_ensureObj(objId) {
if (this.objs[objId]) {
return this.objs[objId];
}
var obj = {
promise: new LegacyPromise(),
data: null,
resolved: false
};
this.objs[objId] = obj;
return obj;
},
/**
* If called *without* callback, this returns the data of `objId` but the
* object needs to be resolved. If it isn't, this function throws.
*
* If called *with* a callback, the callback is called with the data of the
* object once the object is resolved. That means, if you call this
* function and the object is already resolved, the callback gets called
* right away.
*/
get: function PDFObjects_get(objId, callback) {
// If there is a callback, then the get can be async and the object is
// not required to be resolved right now
if (callback) {
this.ensureObj(objId).promise.then(callback);
return null;
}
// If there isn't a callback, the user expects to get the resolved data
// directly.
var obj = this.objs[objId];
// If there isn't an object yet or the object isn't resolved, then the
// data isn't ready yet!
if (!obj || !obj.resolved) {
error('Requesting object that isn\'t resolved yet ' + objId);
}
return obj.data;
},
/**
* Resolves the object `objId` with optional `data`.
*/
resolve: function PDFObjects_resolve(objId, data) {
var obj = this.ensureObj(objId);
obj.resolved = true;
obj.data = data;
obj.promise.resolve(data);
},
isResolved: function PDFObjects_isResolved(objId) {
var objs = this.objs;
if (!objs[objId]) {
return false;
} else {
return objs[objId].resolved;
}
},
hasData: function PDFObjects_hasData(objId) {
return this.isResolved(objId);
},
/**
* Returns the data of `objId` if object exists, null otherwise.
*/
getData: function PDFObjects_getData(objId) {
var objs = this.objs;
if (!objs[objId] || !objs[objId].resolved) {
return null;
} else {
return objs[objId].data;
}
},
clear: function PDFObjects_clear() {
this.objs = {};
}
};
return PDFObjects;
})();
/**
* Allows controlling of the rendering tasks.
* @class
*/
var RenderTask = (function RenderTaskClosure() {
function RenderTask(internalRenderTask) {
this.internalRenderTask = internalRenderTask;
/**
* Promise for rendering task completion.
* @type {Promise}
*/
this.promise = new PDFJS.LegacyPromise();
}
RenderTask.prototype = /** @lends RenderTask.prototype */ {
/**
* Cancels the rendering task. If the task is currently rendering it will
* not be cancelled until graphics pauses with a timeout. The promise that
* this object extends will resolved when cancelled.
*/
cancel: function RenderTask_cancel() {
this.internalRenderTask.cancel();
this.promise.reject(new Error('Rendering is cancelled'));
},
/**
* Registers callback to indicate the rendering task completion.
*
* @param {function} onFulfilled The callback for the rendering completion.
* @param {function} onRejected The callback for the rendering failure.
* @return {Promise} A promise that is resolved after the onFulfilled or
* onRejected callback.
*/
then: function RenderTask_then(onFulfilled, onRejected) {
return this.promise.then(onFulfilled, onRejected);
}
};
return RenderTask;
})();
/**
* For internal use only.
* @ignore
*/
var InternalRenderTask = (function InternalRenderTaskClosure() {
function InternalRenderTask(callback, params, objs, commonObjs, operatorList,
pageNumber) {
this.callback = callback;
this.params = params;
this.objs = objs;
this.commonObjs = commonObjs;
this.operatorListIdx = null;
this.operatorList = operatorList;
this.pageNumber = pageNumber;
this.running = false;
this.graphicsReadyCallback = null;
this.graphicsReady = false;
this.cancelled = false;
}
InternalRenderTask.prototype = {
initalizeGraphics:
function InternalRenderTask_initalizeGraphics(transparency) {
if (this.cancelled) {
return;
}
if (PDFJS.pdfBug && 'StepperManager' in globalScope &&
globalScope.StepperManager.enabled) {
this.stepper = globalScope.StepperManager.create(this.pageNumber - 1);
this.stepper.init(this.operatorList);
this.stepper.nextBreakPoint = this.stepper.getNextBreakPoint();
}
var params = this.params;
this.gfx = new CanvasGraphics(params.canvasContext, this.commonObjs,
this.objs, params.imageLayer);
this.gfx.beginDrawing(params.viewport, transparency);
this.operatorListIdx = 0;
this.graphicsReady = true;
if (this.graphicsReadyCallback) {
this.graphicsReadyCallback();
}
},
cancel: function InternalRenderTask_cancel() {
this.running = false;
this.cancelled = true;
this.callback('cancelled');
},
operatorListChanged: function InternalRenderTask_operatorListChanged() {
if (!this.graphicsReady) {
if (!this.graphicsReadyCallback) {
this.graphicsReadyCallback = this._continue.bind(this);
}
return;
}
if (this.stepper) {
this.stepper.updateOperatorList(this.operatorList);
}
if (this.running) {
return;
}
this._continue();
},
_continue: function InternalRenderTask__continue() {
this.running = true;
if (this.cancelled) {
return;
}
if (this.params.continueCallback) {
this.params.continueCallback(this._next.bind(this));
} else {
this._next();
}
},
_next: function InternalRenderTask__next() {
if (this.cancelled) {
return;
}
this.operatorListIdx = this.gfx.executeOperatorList(this.operatorList,
this.operatorListIdx,
this._continue.bind(this),
this.stepper);
if (this.operatorListIdx === this.operatorList.argsArray.length) {
this.running = false;
if (this.operatorList.lastChunk) {
this.gfx.endDrawing();
this.callback();
}
}
}
};
return InternalRenderTask;
})();
var Metadata = PDFJS.Metadata = (function MetadataClosure() {
function fixMetadata(meta) {
return meta.replace(/>\\376\\377([^<]+)/g, function(all, codes) {
var bytes = codes.replace(/\\([0-3])([0-7])([0-7])/g,
function(code, d1, d2, d3) {
return String.fromCharCode(d1 * 64 + d2 * 8 + d3 * 1);
});
var chars = '';
for (var i = 0; i < bytes.length; i += 2) {
var code = bytes.charCodeAt(i) * 256 + bytes.charCodeAt(i + 1);
chars += code >= 32 && code < 127 && code != 60 && code != 62 &&
code != 38 && false ? String.fromCharCode(code) :
'&#x' + (0x10000 + code).toString(16).substring(1) + ';';
}
return '>' + chars;
});
}
function Metadata(meta) {
if (typeof meta === 'string') {
// Ghostscript produces invalid metadata
meta = fixMetadata(meta);
var parser = new DOMParser();
meta = parser.parseFromString(meta, 'application/xml');
} else if (!(meta instanceof Document)) {
error('Metadata: Invalid metadata object');
}
this.metaDocument = meta;
this.metadata = {};
this.parse();
}
Metadata.prototype = {
parse: function Metadata_parse() {
var doc = this.metaDocument;
var rdf = doc.documentElement;
if (rdf.nodeName.toLowerCase() !== 'rdf:rdf') { // Wrapped in <xmpmeta>
rdf = rdf.firstChild;
while (rdf && rdf.nodeName.toLowerCase() !== 'rdf:rdf') {
rdf = rdf.nextSibling;
}
}
var nodeName = (rdf) ? rdf.nodeName.toLowerCase() : null;
if (!rdf || nodeName !== 'rdf:rdf' || !rdf.hasChildNodes()) {
return;
}
var children = rdf.childNodes, desc, entry, name, i, ii, length, iLength;
for (i = 0, length = children.length; i < length; i++) {
desc = children[i];
if (desc.nodeName.toLowerCase() !== 'rdf:description') {
continue;
}
for (ii = 0, iLength = desc.childNodes.length; ii < iLength; ii++) {
if (desc.childNodes[ii].nodeName.toLowerCase() !== '#text') {
entry = desc.childNodes[ii];
name = entry.nodeName.toLowerCase();
this.metadata[name] = entry.textContent.trim();
}
}
}
},
get: function Metadata_get(name) {
return this.metadata[name] || null;
},
has: function Metadata_has(name) {
return typeof this.metadata[name] !== 'undefined';
}
};
return Metadata;
})();
// <canvas> contexts store most of the state we need natively.
// However, PDF needs a bit more state, which we store here.
// Minimal font size that would be used during canvas fillText operations.
var MIN_FONT_SIZE = 16;
var MAX_GROUP_SIZE = 4096;
var COMPILE_TYPE3_GLYPHS = true;
function createScratchCanvas(width, height) {
var canvas = document.createElement('canvas');
canvas.width = width;
canvas.height = height;
return canvas;
}
function addContextCurrentTransform(ctx) {
// If the context doesn't expose a `mozCurrentTransform`, add a JS based on.
if (!ctx.mozCurrentTransform) {
// Store the original context
ctx._scaleX = ctx._scaleX || 1.0;
ctx._scaleY = ctx._scaleY || 1.0;
ctx._originalSave = ctx.save;
ctx._originalRestore = ctx.restore;
ctx._originalRotate = ctx.rotate;
ctx._originalScale = ctx.scale;
ctx._originalTranslate = ctx.translate;
ctx._originalTransform = ctx.transform;
ctx._originalSetTransform = ctx.setTransform;
ctx._transformMatrix = [ctx._scaleX, 0, 0, ctx._scaleY, 0, 0];
ctx._transformStack = [];
Object.defineProperty(ctx, 'mozCurrentTransform', {
get: function getCurrentTransform() {
return this._transformMatrix;
}
});
Object.defineProperty(ctx, 'mozCurrentTransformInverse', {
get: function getCurrentTransformInverse() {
// Calculation done using WolframAlpha:
// http://www.wolframalpha.com/input/?
// i=Inverse+{{a%2C+c%2C+e}%2C+{b%2C+d%2C+f}%2C+{0%2C+0%2C+1}}
var m = this._transformMatrix;
var a = m[0], b = m[1], c = m[2], d = m[3], e = m[4], f = m[5];
var ad_bc = a * d - b * c;
var bc_ad = b * c - a * d;
return [
d / ad_bc,
b / bc_ad,
c / bc_ad,
a / ad_bc,
(d * e - c * f) / bc_ad,
(b * e - a * f) / ad_bc
];
}
});
ctx.save = function ctxSave() {
var old = this._transformMatrix;
this._transformStack.push(old);
this._transformMatrix = old.slice(0, 6);
this._originalSave();
};
ctx.restore = function ctxRestore() {
var prev = this._transformStack.pop();
if (prev) {
this._transformMatrix = prev;
this._originalRestore();
}
};
ctx.translate = function ctxTranslate(x, y) {
var m = this._transformMatrix;
m[4] = m[0] * x + m[2] * y + m[4];
m[5] = m[1] * x + m[3] * y + m[5];
this._originalTranslate(x, y);
};
ctx.scale = function ctxScale(x, y) {
var m = this._transformMatrix;
m[0] = m[0] * x;
m[1] = m[1] * x;
m[2] = m[2] * y;
m[3] = m[3] * y;
this._originalScale(x, y);
};
ctx.transform = function ctxTransform(a, b, c, d, e, f) {
var m = this._transformMatrix;
this._transformMatrix = [
m[0] * a + m[2] * b,
m[1] * a + m[3] * b,
m[0] * c + m[2] * d,
m[1] * c + m[3] * d,
m[0] * e + m[2] * f + m[4],
m[1] * e + m[3] * f + m[5]
];
ctx._originalTransform(a, b, c, d, e, f);
};
ctx.setTransform = function ctxSetTransform(a, b, c, d, e, f) {
this._transformMatrix = [a, b, c, d, e, f];
ctx._originalSetTransform(a, b, c, d, e, f);
};
ctx.rotate = function ctxRotate(angle) {
var cosValue = Math.cos(angle);
var sinValue = Math.sin(angle);
var m = this._transformMatrix;
this._transformMatrix = [
m[0] * cosValue + m[2] * sinValue,
m[1] * cosValue + m[3] * sinValue,
m[0] * (-sinValue) + m[2] * cosValue,
m[1] * (-sinValue) + m[3] * cosValue,
m[4],
m[5]
];
this._originalRotate(angle);
};
}
}
var CachedCanvases = (function CachedCanvasesClosure() {
var cache = {};
return {
getCanvas: function CachedCanvases_getCanvas(id, width, height,
trackTransform) {
var canvasEntry;
if (id in cache) {
canvasEntry = cache[id];
canvasEntry.canvas.width = width;
canvasEntry.canvas.height = height;
// reset canvas transform for emulated mozCurrentTransform, if needed
canvasEntry.context.setTransform(1, 0, 0, 1, 0, 0);
} else {
var canvas = createScratchCanvas(width, height);
var ctx = canvas.getContext('2d');
if (trackTransform) {
addContextCurrentTransform(ctx);
}
cache[id] = canvasEntry = {canvas: canvas, context: ctx};
}
return canvasEntry;
},
clear: function () {
cache = {};
}
};
})();
function compileType3Glyph(imgData) {
var POINT_TO_PROCESS_LIMIT = 1000;
var width = imgData.width, height = imgData.height;
var i, j, j0, width1 = width + 1;
var points = new Uint8Array(width1 * (height + 1));
var POINT_TYPES =
new Uint8Array([0, 2, 4, 0, 1, 0, 5, 4, 8, 10, 0, 8, 0, 2, 1, 0]);
// decodes bit-packed mask data
var lineSize = (width + 7) & ~7, data0 = imgData.data;
var data = new Uint8Array(lineSize * height), pos = 0, ii;
for (i = 0, ii = data0.length; i < ii; i++) {
var mask = 128, elem = data0[i];
while (mask > 0) {
data[pos++] = (elem & mask) ? 0 : 255;
mask >>= 1;
}
}
// finding iteresting points: every point is located between mask pixels,
// so there will be points of the (width + 1)x(height + 1) grid. Every point
// will have flags assigned based on neighboring mask pixels:
// 4 | 8
// --P--
// 2 | 1
// We are interested only in points with the flags:
// - outside corners: 1, 2, 4, 8;
// - inside corners: 7, 11, 13, 14;
// - and, intersections: 5, 10.
var count = 0;
pos = 0;
if (data[pos] !== 0) {
points[0] = 1;
++count;
}
for (j = 1; j < width; j++) {
if (data[pos] !== data[pos + 1]) {
points[j] = data[pos] ? 2 : 1;
++count;
}
pos++;
}
if (data[pos] !== 0) {
points[j] = 2;
++count;
}
for (i = 1; i < height; i++) {
pos = i * lineSize;
j0 = i * width1;
if (data[pos - lineSize] !== data[pos]) {
points[j0] = data[pos] ? 1 : 8;
++count;
}
// 'sum' is the position of the current pixel configuration in the 'TYPES'
// array (in order 8-1-2-4, so we can use '>>2' to shift the column).
var sum = (data[pos] ? 4 : 0) + (data[pos - lineSize] ? 8 : 0);
for (j = 1; j < width; j++) {
sum = (sum >> 2) + (data[pos + 1] ? 4 : 0) +
(data[pos - lineSize + 1] ? 8 : 0);
if (POINT_TYPES[sum]) {
points[j0 + j] = POINT_TYPES[sum];
++count;
}
pos++;
}
if (data[pos - lineSize] !== data[pos]) {
points[j0 + j] = data[pos] ? 2 : 4;
++count;
}
if (count > POINT_TO_PROCESS_LIMIT) {
return null;
}
}
pos = lineSize * (height - 1);
j0 = i * width1;
if (data[pos] !== 0) {
points[j0] = 8;
++count;
}
for (j = 1; j < width; j++) {
if (data[pos] !== data[pos + 1]) {
points[j0 + j] = data[pos] ? 4 : 8;
++count;
}
pos++;
}
if (data[pos] !== 0) {
points[j0 + j] = 4;
++count;
}
if (count > POINT_TO_PROCESS_LIMIT) {
return null;
}
// building outlines
var steps = new Int32Array([0, width1, -1, 0, -width1, 0, 0, 0, 1]);
var outlines = [];
for (i = 0; count && i <= height; i++) {
var p = i * width1;
var end = p + width;
while (p < end && !points[p]) {
p++;
}
if (p === end) {
continue;
}
var coords = [p % width1, i];
var type = points[p], p0 = p, pp;
do {
var step = steps[type];
do {
p += step;
} while (!points[p]);
pp = points[p];
if (pp !== 5 && pp !== 10) {
// set new direction
type = pp;
// delete mark
points[p] = 0;
} else { // type is 5 or 10, ie, a crossing
// set new direction
type = pp & ((0x33 * type) >> 4);
// set new type for "future hit"
points[p] &= (type >> 2 | type << 2);
}
coords.push(p % width1);
coords.push((p / width1) | 0);
--count;
} while (p0 !== p);
outlines.push(coords);
--i;
}
var drawOutline = function(c) {
c.save();
// the path shall be painted in [0..1]x[0..1] space
c.scale(1 / width, -1 / height);
c.translate(0, -height);
c.beginPath();
for (var i = 0, ii = outlines.length; i < ii; i++) {
var o = outlines[i];
c.moveTo(o[0], o[1]);
for (var j = 2, jj = o.length; j < jj; j += 2) {
c.lineTo(o[j], o[j+1]);
}
}
c.fill();
c.beginPath();
c.restore();
};
return drawOutline;
}
var CanvasExtraState = (function CanvasExtraStateClosure() {
function CanvasExtraState(old) {
// Are soft masks and alpha values shapes or opacities?
this.alphaIsShape = false;
this.fontSize = 0;
this.fontSizeScale = 1;
this.textMatrix = IDENTITY_MATRIX;
this.fontMatrix = FONT_IDENTITY_MATRIX;
this.leading = 0;
// Current point (in user coordinates)
this.x = 0;
this.y = 0;
// Start of text line (in text coordinates)
this.lineX = 0;
this.lineY = 0;
// Character and word spacing
this.charSpacing = 0;
this.wordSpacing = 0;
this.textHScale = 1;
this.textRenderingMode = TextRenderingMode.FILL;
this.textRise = 0;
// Color spaces
this.fillColorSpace = ColorSpace.singletons.gray;
this.fillColorSpaceObj = null;
this.strokeColorSpace = ColorSpace.singletons.gray;
this.strokeColorSpaceObj = null;
this.fillColorObj = null;
this.strokeColorObj = null;
// Default fore and background colors
this.fillColor = '#000000';
this.strokeColor = '#000000';
// Note: fill alpha applies to all non-stroking operations
this.fillAlpha = 1;
this.strokeAlpha = 1;
this.lineWidth = 1;
this.activeSMask = null; // nonclonable field (see the save method below)
this.old = old;
}
CanvasExtraState.prototype = {
clone: function CanvasExtraState_clone() {
return Object.create(this);
},
setCurrentPoint: function CanvasExtraState_setCurrentPoint(x, y) {
this.x = x;
this.y = y;
}
};
return CanvasExtraState;
})();
var CanvasGraphics = (function CanvasGraphicsClosure() {
// Defines the time the executeOperatorList is going to be executing
// before it stops and shedules a continue of execution.
var EXECUTION_TIME = 15;
function CanvasGraphics(canvasCtx, commonObjs, objs, imageLayer) {
this.ctx = canvasCtx;
this.current = new CanvasExtraState();
this.stateStack = [];
this.pendingClip = null;
this.pendingEOFill = false;
this.res = null;
this.xobjs = null;
this.commonObjs = commonObjs;
this.objs = objs;
this.imageLayer = imageLayer;
this.groupStack = [];
this.processingType3 = null;
// Patterns are painted relative to the initial page/form transform, see pdf
// spec 8.7.2 NOTE 1.
this.baseTransform = null;
this.baseTransformStack = [];
this.groupLevel = 0;
this.smaskStack = [];
this.smaskCounter = 0;
this.tempSMask = null;
if (canvasCtx) {
addContextCurrentTransform(canvasCtx);
}
}
function putBinaryImageData(ctx, imgData) {
if (typeof ImageData !== 'undefined' && imgData instanceof ImageData) {
ctx.putImageData(imgData, 0, 0);
return;
}
// Put the image data to the canvas in chunks, rather than putting the
// whole image at once. This saves JS memory, because the ImageData object
// is smaller. It also possibly saves C++ memory within the implementation
// of putImageData(). (E.g. in Firefox we make two short-lived copies of
// the data passed to putImageData()). |n| shouldn't be too small, however,
// because too many putImageData() calls will slow things down.
//
// Note: as written, if the last chunk is partial, the putImageData() call
// will (conceptually) put pixels past the bounds of the canvas. But
// that's ok; any such pixels are ignored.
var height = imgData.height, width = imgData.width;
var fullChunkHeight = 16;
var fracChunks = height / fullChunkHeight;
var fullChunks = Math.floor(fracChunks);
var totalChunks = Math.ceil(fracChunks);
var partialChunkHeight = height - fullChunks * fullChunkHeight;
var chunkImgData = ctx.createImageData(width, fullChunkHeight);
var srcPos = 0, destPos;
var src = imgData.data;
var dest = chunkImgData.data;
var i, j, thisChunkHeight, elemsInThisChunk;
// There are multiple forms in which the pixel data can be passed, and
// imgData.kind tells us which one this is.
if (imgData.kind === ImageKind.GRAYSCALE_1BPP) {
// Grayscale, 1 bit per pixel (i.e. black-and-white).
var destDataLength = dest.length;
var srcLength = src.byteLength;
var dest32 = PDFJS.hasCanvasTypedArrays ? new Uint32Array(dest.buffer) :
new Uint32ArrayView(dest);
var dest32DataLength = dest32.length;
var fullSrcDiff = (width + 7) >> 3;
var white = 0xFFFFFFFF;
var black = (PDFJS.isLittleEndian || !PDFJS.hasCanvasTypedArrays) ?
0xFF000000 : 0x000000FF;
for (i = 0; i < totalChunks; i++) {
thisChunkHeight =
(i < fullChunks) ? fullChunkHeight : partialChunkHeight;
destPos = 0;
for (j = 0; j < thisChunkHeight; j++) {
var srcDiff = srcLength - srcPos;
var k = 0;
var kEnd = (srcDiff > fullSrcDiff) ? width : srcDiff * 8 - 7;
var kEndUnrolled = kEnd & ~7;
var mask = 0;
var srcByte = 0;
for (; k < kEndUnrolled; k += 8) {
srcByte = src[srcPos++];
dest32[destPos++] = (srcByte & 128) ? white : black;
dest32[destPos++] = (srcByte & 64) ? white : black;
dest32[destPos++] = (srcByte & 32) ? white : black;
dest32[destPos++] = (srcByte & 16) ? white : black;
dest32[destPos++] = (srcByte & 8) ? white : black;
dest32[destPos++] = (srcByte & 4) ? white : black;
dest32[destPos++] = (srcByte & 2) ? white : black;
dest32[destPos++] = (srcByte & 1) ? white : black;
}
for (; k < kEnd; k++) {
if (mask === 0) {
srcByte = src[srcPos++];
mask = 128;
}
dest32[destPos++] = (srcByte & mask) ? white : black;
mask >>= 1;
}
}
// We ran out of input. Make all remaining pixels transparent.
while (destPos < dest32DataLength) {
dest32[destPos++] = 0;
}
ctx.putImageData(chunkImgData, 0, i * fullChunkHeight);
}
} else if (imgData.kind === ImageKind.RGBA_32BPP) {
// RGBA, 32-bits per pixel.
for (i = 0; i < totalChunks; i++) {
thisChunkHeight =
(i < fullChunks) ? fullChunkHeight : partialChunkHeight;
elemsInThisChunk = imgData.width * thisChunkHeight * 4;
dest.set(src.subarray(srcPos, srcPos + elemsInThisChunk));
srcPos += elemsInThisChunk;
ctx.putImageData(chunkImgData, 0, i * fullChunkHeight);
}
} else if (imgData.kind === ImageKind.RGB_24BPP) {
// RGB, 24-bits per pixel.
for (i = 0; i < totalChunks; i++) {
thisChunkHeight =
(i < fullChunks) ? fullChunkHeight : partialChunkHeight;
elemsInThisChunk = imgData.width * thisChunkHeight * 3;
destPos = 0;
for (j = 0; j < elemsInThisChunk; j += 3) {
dest[destPos++] = src[srcPos++];
dest[destPos++] = src[srcPos++];
dest[destPos++] = src[srcPos++];
dest[destPos++] = 255;
}
ctx.putImageData(chunkImgData, 0, i * fullChunkHeight);
}
} else {
error('bad image kind: ' + imgData.kind);
}
}
function putBinaryImageMask(ctx, imgData) {
var height = imgData.height, width = imgData.width;
var fullChunkHeight = 16;
var fracChunks = height / fullChunkHeight;
var fullChunks = Math.floor(fracChunks);
var totalChunks = Math.ceil(fracChunks);
var partialChunkHeight = height - fullChunks * fullChunkHeight;
var chunkImgData = ctx.createImageData(width, fullChunkHeight);
var srcPos = 0;
var src = imgData.data;
var dest = chunkImgData.data;
for (var i = 0; i < totalChunks; i++) {
var thisChunkHeight =
(i < fullChunks) ? fullChunkHeight : partialChunkHeight;
// Expand the mask so it can be used by the canvas. Any required
// inversion has already been handled.
var destPos = 3; // alpha component offset
for (var j = 0; j < thisChunkHeight; j++) {
var mask = 0;
for (var k = 0; k < width; k++) {
if (!mask) {
var elem = src[srcPos++];
mask = 128;
}
dest[destPos] = (elem & mask) ? 0 : 255;
destPos += 4;
mask >>= 1;
}
}
ctx.putImageData(chunkImgData, 0, i * fullChunkHeight);
}
}
function copyCtxState(sourceCtx, destCtx) {
var properties = ['strokeStyle', 'fillStyle', 'fillRule', 'globalAlpha',
'lineWidth', 'lineCap', 'lineJoin', 'miterLimit',
'globalCompositeOperation', 'font'];
for (var i = 0, ii = properties.length; i < ii; i++) {
var property = properties[i];
if (property in sourceCtx) {
destCtx[property] = sourceCtx[property];
}
}
if ('setLineDash' in sourceCtx) {
destCtx.setLineDash(sourceCtx.getLineDash());
destCtx.lineDashOffset = sourceCtx.lineDashOffset;
} else if ('mozDash' in sourceCtx) {
destCtx.mozDash = sourceCtx.mozDash;
destCtx.mozDashOffset = sourceCtx.mozDashOffset;
}
}
function genericComposeSMask(maskCtx, layerCtx, width, height,
subtype, backdrop) {
var addBackdropFn;
if (backdrop) {
addBackdropFn = function (r0, g0, b0, bytes) {
var length = bytes.length;
for (var i = 3; i < length; i += 4) {
var alpha = bytes[i] / 255;
if (alpha === 0) {
bytes[i - 3] = r0;
bytes[i - 2] = g0;
bytes[i - 1] = b0;
} else if (alpha < 1) {
var alpha_ = 1 - alpha;
bytes[i - 3] = (bytes[i - 3] * alpha + r0 * alpha_) | 0;
bytes[i - 2] = (bytes[i - 2] * alpha + g0 * alpha_) | 0;
bytes[i - 1] = (bytes[i - 1] * alpha + b0 * alpha_) | 0;
}
}
}.bind(null, backdrop[0], backdrop[1], backdrop[2]);
} else {
addBackdropFn = function () {};
}
var composeFn;
if (subtype === 'Luminosity') {
composeFn = function (maskDataBytes, layerDataBytes) {
var length = maskDataBytes.length;
for (var i = 3; i < length; i += 4) {
var y = ((maskDataBytes[i - 3] * 77) + // * 0.3 / 255 * 0x10000
(maskDataBytes[i - 2] * 152) + // * 0.59 ....
(maskDataBytes[i - 1] * 28)) | 0; // * 0.11 ....
layerDataBytes[i] = (layerDataBytes[i] * y) >> 16;
}
};
} else {
composeFn = function (maskDataBytes, layerDataBytes) {
var length = maskDataBytes.length;
for (var i = 3; i < length; i += 4) {
var alpha = maskDataBytes[i];
layerDataBytes[i] = (layerDataBytes[i] * alpha / 255) | 0;
}
};
}
// processing image in chunks to save memory
var PIXELS_TO_PROCESS = 65536;
var chunkSize = Math.min(height, Math.ceil(PIXELS_TO_PROCESS / width));
for (var row = 0; row < height; row += chunkSize) {
var chunkHeight = Math.min(chunkSize, height - row);
var maskData = maskCtx.getImageData(0, row, width, chunkHeight);
var layerData = layerCtx.getImageData(0, row, width, chunkHeight);
addBackdropFn(maskData.data);
composeFn(maskData.data, layerData.data);
maskCtx.putImageData(layerData, 0, row);
}
}
function composeSMask(ctx, smask, layerCtx) {
var mask = smask.canvas;
var maskCtx = smask.context;
ctx.setTransform(smask.scaleX, 0, 0, smask.scaleY,
smask.offsetX, smask.offsetY);
var backdrop;
if (smask.backdrop) {
var cs = smask.colorSpace || ColorSpace.singletons.rgb;
backdrop = cs.getRgb(smask.backdrop, 0);
}
if (WebGLUtils.isEnabled) {
var composed = WebGLUtils.composeSMask(layerCtx.canvas, mask,
{subtype: smask.subtype, backdrop: backdrop});
ctx.setTransform(1, 0, 0, 1, 0, 0);
ctx.drawImage(composed, smask.offsetX, smask.offsetY);
return;
}
genericComposeSMask(maskCtx, layerCtx, mask.width, mask.height,
smask.subtype, backdrop);
ctx.drawImage(mask, 0, 0);
}
var LINE_CAP_STYLES = ['butt', 'round', 'square'];
var LINE_JOIN_STYLES = ['miter', 'round', 'bevel'];
var NORMAL_CLIP = {};
var EO_CLIP = {};
CanvasGraphics.prototype = {
beginDrawing: function CanvasGraphics_beginDrawing(viewport, transparency) {
// For pdfs that use blend modes we have to clear the canvas else certain
// blend modes can look wrong since we'd be blending with a white
// backdrop. The problem with a transparent backdrop though is we then
// don't get sub pixel anti aliasing on text, so we fill with white if
// we can.
var width = this.ctx.canvas.width;
var height = this.ctx.canvas.height;
if (transparency) {
this.ctx.clearRect(0, 0, width, height);
} else {
this.ctx.mozOpaque = true;
this.ctx.save();
this.ctx.fillStyle = 'rgb(255, 255, 255)';
this.ctx.fillRect(0, 0, width, height);
this.ctx.restore();
}
var transform = viewport.transform;
this.ctx.save();
this.ctx.transform.apply(this.ctx, transform);
this.baseTransform = this.ctx.mozCurrentTransform.slice();
if (this.imageLayer) {
this.imageLayer.beginLayout();
}
},
executeOperatorList: function CanvasGraphics_executeOperatorList(
operatorList,
executionStartIdx, continueCallback,
stepper) {
var argsArray = operatorList.argsArray;
var fnArray = operatorList.fnArray;
var i = executionStartIdx || 0;
var argsArrayLen = argsArray.length;
// Sometimes the OperatorList to execute is empty.
if (argsArrayLen == i) {
return i;
}
var executionEndIdx;
var endTime = Date.now() + EXECUTION_TIME;
var commonObjs = this.commonObjs;
var objs = this.objs;
var fnId;
var deferred = Promise.resolve();
while (true) {
if (stepper && i === stepper.nextBreakPoint) {
stepper.breakIt(i, continueCallback);
return i;
}
fnId = fnArray[i];
if (fnId !== OPS.dependency) {
this[fnId].apply(this, argsArray[i]);
} else {
var deps = argsArray[i];
for (var n = 0, nn = deps.length; n < nn; n++) {
var depObjId = deps[n];
var common = depObjId.substring(0, 2) == 'g_';
// If the promise isn't resolved yet, add the continueCallback
// to the promise and bail out.
if (!common && !objs.isResolved(depObjId)) {
objs.get(depObjId, continueCallback);
return i;
}
if (common && !commonObjs.isResolved(depObjId)) {
commonObjs.get(depObjId, continueCallback);
return i;
}
}
}
i++;
// If the entire operatorList was executed, stop as were done.
if (i == argsArrayLen) {
return i;
}
// If the execution took longer then a certain amount of time, schedule
// to continue exeution after a short delay.
// However, this is only possible if a 'continueCallback' is passed in.
if (continueCallback && Date.now() > endTime) {
deferred.then(continueCallback);
return i;
}
// If the operatorList isn't executed completely yet OR the execution
// time was short enough, do another execution round.
}
},
endDrawing: function CanvasGraphics_endDrawing() {
this.ctx.restore();
CachedCanvases.clear();
WebGLUtils.clear();
if (this.imageLayer) {
this.imageLayer.endLayout();
}
},
// Graphics state
setLineWidth: function CanvasGraphics_setLineWidth(width) {
this.current.lineWidth = width;
this.ctx.lineWidth = width;
},
setLineCap: function CanvasGraphics_setLineCap(style) {
this.ctx.lineCap = LINE_CAP_STYLES[style];
},
setLineJoin: function CanvasGraphics_setLineJoin(style) {
this.ctx.lineJoin = LINE_JOIN_STYLES[style];
},
setMiterLimit: function CanvasGraphics_setMiterLimit(limit) {
this.ctx.miterLimit = limit;
},
setDash: function CanvasGraphics_setDash(dashArray, dashPhase) {
var ctx = this.ctx;
if ('setLineDash' in ctx) {
ctx.setLineDash(dashArray);
ctx.lineDashOffset = dashPhase;
} else {
ctx.mozDash = dashArray;
ctx.mozDashOffset = dashPhase;
}
},
setRenderingIntent: function CanvasGraphics_setRenderingIntent(intent) {
// Maybe if we one day fully support color spaces this will be important
// for now we can ignore.
// TODO set rendering intent?
},
setFlatness: function CanvasGraphics_setFlatness(flatness) {
// There's no way to control this with canvas, but we can safely ignore.
// TODO set flatness?
},
setGState: function CanvasGraphics_setGState(states) {
for (var i = 0, ii = states.length; i < ii; i++) {
var state = states[i];
var key = state[0];
var value = state[1];
switch (key) {
case 'LW':
this.setLineWidth(value);
break;
case 'LC':
this.setLineCap(value);
break;
case 'LJ':
this.setLineJoin(value);
break;
case 'ML':
this.setMiterLimit(value);
break;
case 'D':
this.setDash(value[0], value[1]);
break;
case 'RI':
this.setRenderingIntent(value);
break;
case 'FL':
this.setFlatness(value);
break;
case 'Font':
this.setFont(value[0], value[1]);
break;
case 'CA':
this.current.strokeAlpha = state[1];
break;
case 'ca':
this.current.fillAlpha = state[1];
this.ctx.globalAlpha = state[1];
break;
case 'BM':
if (value && value.name && (value.name !== 'Normal')) {
var mode = value.name.replace(/([A-Z])/g,
function(c) {
return '-' + c.toLowerCase();
}
).substring(1);
this.ctx.globalCompositeOperation = mode;
if (this.ctx.globalCompositeOperation !== mode) {
warn('globalCompositeOperation "' + mode +
'" is not supported');
}
} else {
this.ctx.globalCompositeOperation = 'source-over';
}
break;
case 'SMask':
if (this.current.activeSMask) {
this.endSMaskGroup();
}
this.current.activeSMask = value ? this.tempSMask : null;
if (this.current.activeSMask) {
this.beginSMaskGroup();
}
this.tempSMask = null;
break;
}
}
},
beginSMaskGroup: function CanvasGraphics_beginSMaskGroup() {
var activeSMask = this.current.activeSMask;
var drawnWidth = activeSMask.canvas.width;
var drawnHeight = activeSMask.canvas.height;
var cacheId = 'smaskGroupAt' + this.groupLevel;
var scratchCanvas = CachedCanvases.getCanvas(
cacheId, drawnWidth, drawnHeight, true);
var currentCtx = this.ctx;
var currentTransform = currentCtx.mozCurrentTransform;
this.ctx.save();
var groupCtx = scratchCanvas.context;
groupCtx.scale(1 / activeSMask.scaleX, 1 / activeSMask.scaleY);
groupCtx.translate(-activeSMask.offsetX, -activeSMask.offsetY);
groupCtx.transform.apply(groupCtx, currentTransform);
copyCtxState(currentCtx, groupCtx);
this.ctx = groupCtx;
this.setGState([
['BM', 'Normal'],
['ca', 1],
['CA', 1]
]);
this.groupStack.push(currentCtx);
this.groupLevel++;
},
endSMaskGroup: function CanvasGraphics_endSMaskGroup() {
var groupCtx = this.ctx;
this.groupLevel--;
this.ctx = this.groupStack.pop();
composeSMask(this.ctx, this.current.activeSMask, groupCtx);
this.ctx.restore();
},
save: function CanvasGraphics_save() {
this.ctx.save();
var old = this.current;
this.stateStack.push(old);
this.current = old.clone();
if (this.current.activeSMask) {
this.current.activeSMask = null;
}
},
restore: function CanvasGraphics_restore() {
var prev = this.stateStack.pop();
if (prev) {
if (this.current.activeSMask) {
this.endSMaskGroup();
}
this.current = prev;
this.ctx.restore();
}
},
transform: function CanvasGraphics_transform(a, b, c, d, e, f) {
this.ctx.transform(a, b, c, d, e, f);
},
// Path
moveTo: function CanvasGraphics_moveTo(x, y) {
this.ctx.moveTo(x, y);
this.current.setCurrentPoint(x, y);
},
lineTo: function CanvasGraphics_lineTo(x, y) {
this.ctx.lineTo(x, y);
this.current.setCurrentPoint(x, y);
},
curveTo: function CanvasGraphics_curveTo(x1, y1, x2, y2, x3, y3) {
this.ctx.bezierCurveTo(x1, y1, x2, y2, x3, y3);
this.current.setCurrentPoint(x3, y3);
},
curveTo2: function CanvasGraphics_curveTo2(x2, y2, x3, y3) {
var current = this.current;
this.ctx.bezierCurveTo(current.x, current.y, x2, y2, x3, y3);
current.setCurrentPoint(x3, y3);
},
curveTo3: function CanvasGraphics_curveTo3(x1, y1, x3, y3) {
this.curveTo(x1, y1, x3, y3, x3, y3);
this.current.setCurrentPoint(x3, y3);
},
closePath: function CanvasGraphics_closePath() {
this.ctx.closePath();
},
rectangle: function CanvasGraphics_rectangle(x, y, width, height) {
if (width === 0) {
width = this.getSinglePixelWidth();
}
if (height === 0) {
height = this.getSinglePixelWidth();
}
this.ctx.rect(x, y, width, height);
},
stroke: function CanvasGraphics_stroke(consumePath) {
consumePath = typeof consumePath !== 'undefined' ? consumePath : true;
var ctx = this.ctx;
var strokeColor = this.current.strokeColor;
if (this.current.lineWidth === 0) {
ctx.lineWidth = this.getSinglePixelWidth();
}
// For stroke we want to temporarily change the global alpha to the
// stroking alpha.
ctx.globalAlpha = this.current.strokeAlpha;
if (strokeColor && strokeColor.hasOwnProperty('type') &&
strokeColor.type === 'Pattern') {
// for patterns, we transform to pattern space, calculate
// the pattern, call stroke, and restore to user space
ctx.save();
ctx.strokeStyle = strokeColor.getPattern(ctx, this);
ctx.stroke();
ctx.restore();
} else {
ctx.stroke();
}
if (consumePath) {
this.consumePath();
}
// Restore the global alpha to the fill alpha
ctx.globalAlpha = this.current.fillAlpha;
},
closeStroke: function CanvasGraphics_closeStroke() {
this.closePath();
this.stroke();
},
fill: function CanvasGraphics_fill(consumePath) {
consumePath = typeof consumePath !== 'undefined' ? consumePath : true;
var ctx = this.ctx;
var fillColor = this.current.fillColor;
var needRestore = false;
if (fillColor && fillColor.hasOwnProperty('type') &&
fillColor.type === 'Pattern') {
ctx.save();
ctx.fillStyle = fillColor.getPattern(ctx, this);
needRestore = true;
}
if (this.pendingEOFill) {
if ('mozFillRule' in this.ctx) {
this.ctx.mozFillRule = 'evenodd';
this.ctx.fill();
this.ctx.mozFillRule = 'nonzero';
} else {
try {
this.ctx.fill('evenodd');
} catch (ex) {
// shouldn't really happen, but browsers might think differently
this.ctx.fill();
}
}
this.pendingEOFill = false;
} else {
this.ctx.fill();
}
if (needRestore) {
ctx.restore();
}
if (consumePath) {
this.consumePath();
}
},
eoFill: function CanvasGraphics_eoFill() {
this.pendingEOFill = true;
this.fill();
},
fillStroke: function CanvasGraphics_fillStroke() {
this.fill(false);
this.stroke(false);
this.consumePath();
},
eoFillStroke: function CanvasGraphics_eoFillStroke() {
this.pendingEOFill = true;
this.fillStroke();
},
closeFillStroke: function CanvasGraphics_closeFillStroke() {
this.closePath();
this.fillStroke();
},
closeEOFillStroke: function CanvasGraphics_closeEOFillStroke() {
this.pendingEOFill = true;
this.closePath();
this.fillStroke();
},
endPath: function CanvasGraphics_endPath() {
this.consumePath();
},
// Clipping
clip: function CanvasGraphics_clip() {
this.pendingClip = NORMAL_CLIP;
},
eoClip: function CanvasGraphics_eoClip() {
this.pendingClip = EO_CLIP;
},
// Text
beginText: function CanvasGraphics_beginText() {
this.current.textMatrix = IDENTITY_MATRIX;
this.current.x = this.current.lineX = 0;
this.current.y = this.current.lineY = 0;
},
endText: function CanvasGraphics_endText() {
if (!('pendingTextPaths' in this)) {
this.ctx.beginPath();
return;
}
var paths = this.pendingTextPaths;
var ctx = this.ctx;
ctx.save();
ctx.beginPath();
for (var i = 0; i < paths.length; i++) {
var path = paths[i];
ctx.setTransform.apply(ctx, path.transform);
ctx.translate(path.x, path.y);
path.addToPath(ctx, path.fontSize);
}
ctx.restore();
ctx.clip();
ctx.beginPath();
delete this.pendingTextPaths;
},
setCharSpacing: function CanvasGraphics_setCharSpacing(spacing) {
this.current.charSpacing = spacing;
},
setWordSpacing: function CanvasGraphics_setWordSpacing(spacing) {
this.current.wordSpacing = spacing;
},
setHScale: function CanvasGraphics_setHScale(scale) {
this.current.textHScale = scale / 100;
},
setLeading: function CanvasGraphics_setLeading(leading) {
this.current.leading = -leading;
},
setFont: function CanvasGraphics_setFont(fontRefName, size) {
var fontObj = this.commonObjs.get(fontRefName);
var current = this.current;
if (!fontObj) {
error('Can\'t find font for ' + fontRefName);
}
current.fontMatrix = (fontObj.fontMatrix ?
fontObj.fontMatrix : FONT_IDENTITY_MATRIX);
// A valid matrix needs all main diagonal elements to be non-zero
// This also ensures we bypass FF bugzilla bug #719844.
if (current.fontMatrix[0] === 0 ||
current.fontMatrix[3] === 0) {
warn('Invalid font matrix for font ' + fontRefName);
}
// The spec for Tf (setFont) says that 'size' specifies the font 'scale',
// and in some docs this can be negative (inverted x-y axes).
if (size < 0) {
size = -size;
current.fontDirection = -1;
} else {
current.fontDirection = 1;
}
this.current.font = fontObj;
this.current.fontSize = size;
if (fontObj.coded) {
return; // we don't need ctx.font for Type3 fonts
}
var name = fontObj.loadedName || 'sans-serif';
var bold = fontObj.black ? (fontObj.bold ? 'bolder' : 'bold') :
(fontObj.bold ? 'bold' : 'normal');
var italic = fontObj.italic ? 'italic' : 'normal';
var typeface = '"' + name + '", ' + fontObj.fallbackName;
// Some font backends cannot handle fonts below certain size.
// Keeping the font at minimal size and using the fontSizeScale to change
// the current transformation matrix before the fillText/strokeText.
// See https://bugzilla.mozilla.org/show_bug.cgi?id=726227
var browserFontSize = size >= MIN_FONT_SIZE ? size : MIN_FONT_SIZE;
this.current.fontSizeScale = browserFontSize != MIN_FONT_SIZE ? 1.0 :
size / MIN_FONT_SIZE;
var rule = italic + ' ' + bold + ' ' + browserFontSize + 'px ' + typeface;
this.ctx.font = rule;
},
setTextRenderingMode: function CanvasGraphics_setTextRenderingMode(mode) {
this.current.textRenderingMode = mode;
},
setTextRise: function CanvasGraphics_setTextRise(rise) {
this.current.textRise = rise;
},
moveText: function CanvasGraphics_moveText(x, y) {
this.current.x = this.current.lineX += x;
this.current.y = this.current.lineY += y;
},
setLeadingMoveText: function CanvasGraphics_setLeadingMoveText(x, y) {
this.setLeading(-y);
this.moveText(x, y);
},
setTextMatrix: function CanvasGraphics_setTextMatrix(a, b, c, d, e, f) {
this.current.textMatrix = [a, b, c, d, e, f];
this.current.x = this.current.lineX = 0;
this.current.y = this.current.lineY = 0;
},
nextLine: function CanvasGraphics_nextLine() {
this.moveText(0, this.current.leading);
},
applyTextTransforms: function CanvasGraphics_applyTextTransforms() {
var ctx = this.ctx;
var current = this.current;
ctx.transform.apply(ctx, current.textMatrix);
ctx.translate(current.x, current.y + current.textRise);
if (current.fontDirection > 0) {
ctx.scale(current.textHScale, -1);
} else {
ctx.scale(-current.textHScale, 1);
}
},
paintChar: function (character, x, y) {
var ctx = this.ctx;
var current = this.current;
var font = current.font;
var fontSize = current.fontSize / current.fontSizeScale;
var textRenderingMode = current.textRenderingMode;
var fillStrokeMode = textRenderingMode &
TextRenderingMode.FILL_STROKE_MASK;
var isAddToPathSet = !!(textRenderingMode &
TextRenderingMode.ADD_TO_PATH_FLAG);
var addToPath;
if (font.disableFontFace || isAddToPathSet) {
addToPath = font.getPathGenerator(this.commonObjs, character);
}
if (font.disableFontFace) {
ctx.save();
ctx.translate(x, y);
ctx.beginPath();
addToPath(ctx, fontSize);
if (fillStrokeMode === TextRenderingMode.FILL ||
fillStrokeMode === TextRenderingMode.FILL_STROKE) {
ctx.fill();
}
if (fillStrokeMode === TextRenderingMode.STROKE ||
fillStrokeMode === TextRenderingMode.FILL_STROKE) {
ctx.stroke();
}
ctx.restore();
} else {
if (fillStrokeMode === TextRenderingMode.FILL ||
fillStrokeMode === TextRenderingMode.FILL_STROKE) {
ctx.fillText(character, x, y);
}
if (fillStrokeMode === TextRenderingMode.STROKE ||
fillStrokeMode === TextRenderingMode.FILL_STROKE) {
ctx.strokeText(character, x, y);
}
}
if (isAddToPathSet) {
var paths = this.pendingTextPaths || (this.pendingTextPaths = []);
paths.push({
transform: ctx.mozCurrentTransform,
x: x,
y: y,
fontSize: fontSize,
addToPath: addToPath
});
}
},
get isFontSubpixelAAEnabled() {
// Checks if anti-aliasing is enabled when scaled text is painted.
// On Windows GDI scaled fonts looks bad.
var ctx = document.createElement('canvas').getContext('2d');
ctx.scale(1.5, 1);
ctx.fillText('I', 0, 10);
var data = ctx.getImageData(0, 0, 10, 10).data;
var enabled = false;
for (var i = 3; i < data.length; i += 4) {
if (data[i] > 0 && data[i] < 255) {
enabled = true;
break;
}
}
return shadow(this, 'isFontSubpixelAAEnabled', enabled);
},
showText: function CanvasGraphics_showText(glyphs) {
var ctx = this.ctx;
var current = this.current;
var font = current.font;
var fontSize = current.fontSize;
var fontSizeScale = current.fontSizeScale;
var charSpacing = current.charSpacing;
var wordSpacing = current.wordSpacing;
var textHScale = current.textHScale * current.fontDirection;
var fontMatrix = current.fontMatrix || FONT_IDENTITY_MATRIX;
var glyphsLength = glyphs.length;
var vertical = font.vertical;
var defaultVMetrics = font.defaultVMetrics;
var i, glyph, width;
var VERTICAL_TEXT_ROTATION = Math.PI / 2;
if (fontSize === 0) {
return;
}
// Type3 fonts - each glyph is a "mini-PDF"
if (font.coded) {
ctx.save();
ctx.transform.apply(ctx, current.textMatrix);
ctx.translate(current.x, current.y);
ctx.scale(textHScale, 1);
for (i = 0; i < glyphsLength; ++i) {
glyph = glyphs[i];
if (glyph === null) {
// word break
this.ctx.translate(wordSpacing, 0);
current.x += wordSpacing * textHScale;
continue;
}
this.processingType3 = glyph;
this.save();
ctx.scale(fontSize, fontSize);
ctx.transform.apply(ctx, fontMatrix);
this.executeOperatorList(glyph.operatorList);
this.restore();
var transformed = Util.applyTransform([glyph.width, 0], fontMatrix);
width = ((transformed[0] * fontSize + charSpacing) *
current.fontDirection);
ctx.translate(width, 0);
current.x += width * textHScale;
}
ctx.restore();
this.processingType3 = null;
} else {
ctx.save();
this.applyTextTransforms();
var lineWidth = current.lineWidth;
var a1 = current.textMatrix[0], b1 = current.textMatrix[1];
var scale = Math.sqrt(a1 * a1 + b1 * b1);
if (scale === 0 || lineWidth === 0) {
lineWidth = this.getSinglePixelWidth();
} else {
lineWidth /= scale;
}
if (fontSizeScale != 1.0) {
ctx.scale(fontSizeScale, fontSizeScale);
lineWidth /= fontSizeScale;
}
ctx.lineWidth = lineWidth;
var x = 0;
for (i = 0; i < glyphsLength; ++i) {
glyph = glyphs[i];
if (glyph === null) {
// word break
x += current.fontDirection * wordSpacing;
continue;
}
var restoreNeeded = false;
var character = glyph.fontChar;
var vmetric = glyph.vmetric || defaultVMetrics;
if (vertical) {
var vx = glyph.vmetric ? vmetric[1] : glyph.width * 0.5;
vx = -vx * fontSize * current.fontMatrix[0];
var vy = vmetric[2] * fontSize * current.fontMatrix[0];
}
width = vmetric ? -vmetric[0] : glyph.width;
var charWidth = width * fontSize * current.fontMatrix[0] +
charSpacing * current.fontDirection;
var accent = glyph.accent;
var scaledX, scaledY, scaledAccentX, scaledAccentY;
if (vertical) {
scaledX = vx / fontSizeScale;
scaledY = (x + vy) / fontSizeScale;
} else {
scaledX = x / fontSizeScale;
scaledY = 0;
}
if (font.remeasure && width > 0 && this.isFontSubpixelAAEnabled) {
// some standard fonts may not have the exact width, trying to
// rescale per character
var measuredWidth = ctx.measureText(character).width * 1000 /
current.fontSize * current.fontSizeScale;
var characterScaleX = width / measuredWidth;
restoreNeeded = true;
ctx.save();
ctx.scale(characterScaleX, 1);
scaledX /= characterScaleX;
if (accent) {
scaledAccentX /= characterScaleX;
}
}
this.paintChar(character, scaledX, scaledY);
if (accent) {
scaledAccentX = scaledX + accent.offset.x / fontSizeScale;
scaledAccentY = scaledY - accent.offset.y / fontSizeScale;
this.paintChar(accent.fontChar, scaledAccentX, scaledAccentY);
}
x += charWidth;
if (restoreNeeded) {
ctx.restore();
}
}
if (vertical) {
current.y -= x * textHScale;
} else {
current.x += x * textHScale;
}
ctx.restore();
}
},
showSpacedText: function CanvasGraphics_showSpacedText(arr) {
var ctx = this.ctx;
var current = this.current;
var font = current.font;
var fontSize = current.fontSize;
// TJ array's number is independent from fontMatrix
var textHScale = current.textHScale * 0.001 * current.fontDirection;
var arrLength = arr.length;
var vertical = font.vertical;
for (var i = 0; i < arrLength; ++i) {
var e = arr[i];
if (isNum(e)) {
var spacingLength = -e * fontSize * textHScale;
if (vertical) {
current.y += spacingLength;
} else {
current.x += spacingLength;
}
} else {
this.showText(e);
}
}
},
nextLineShowText: function CanvasGraphics_nextLineShowText(text) {
this.nextLine();
this.showText(text);
},
nextLineSetSpacingShowText:
function CanvasGraphics_nextLineSetSpacingShowText(wordSpacing,
charSpacing,
text) {
this.setWordSpacing(wordSpacing);
this.setCharSpacing(charSpacing);
this.nextLineShowText(text);
},
// Type3 fonts
setCharWidth: function CanvasGraphics_setCharWidth(xWidth, yWidth) {
// We can safely ignore this since the width should be the same
// as the width in the Widths array.
},
setCharWidthAndBounds: function CanvasGraphics_setCharWidthAndBounds(xWidth,
yWidth,
llx,
lly,
urx,
ury) {
// TODO According to the spec we're also suppose to ignore any operators
// that set color or include images while processing this type3 font.
this.rectangle(llx, lly, urx - llx, ury - lly);
this.clip();
this.endPath();
},
// Color
setStrokeColorSpace: function CanvasGraphics_setStrokeColorSpace(raw) {
this.current.strokeColorSpace = ColorSpace.fromIR(raw);
},
setFillColorSpace: function CanvasGraphics_setFillColorSpace(raw) {
this.current.fillColorSpace = ColorSpace.fromIR(raw);
},
setStrokeColor: function CanvasGraphics_setStrokeColor(/*...*/) {
var cs = this.current.strokeColorSpace;
var rgbColor = cs.getRgb(arguments, 0);
var color = Util.makeCssRgb(rgbColor);
this.ctx.strokeStyle = color;
this.current.strokeColor = color;
},
getColorN_Pattern: function CanvasGraphics_getColorN_Pattern(IR, cs) {
var pattern;
if (IR[0] == 'TilingPattern') {
var args = IR[1];
var base = cs.base;
var color;
if (base) {
var baseComps = base.numComps;
color = base.getRgb(args, 0);
}
pattern = new TilingPattern(IR, color, this.ctx, this.objs,
this.commonObjs, this.baseTransform);
} else {
pattern = getShadingPatternFromIR(IR);
}
return pattern;
},
setStrokeColorN: function CanvasGraphics_setStrokeColorN(/*...*/) {
var cs = this.current.strokeColorSpace;
if (cs.name == 'Pattern') {
this.current.strokeColor = this.getColorN_Pattern(arguments, cs);
} else {
this.setStrokeColor.apply(this, arguments);
}
},
setFillColor: function CanvasGraphics_setFillColor(/*...*/) {
var cs = this.current.fillColorSpace;
var rgbColor = cs.getRgb(arguments, 0);
var color = Util.makeCssRgb(rgbColor);
this.ctx.fillStyle = color;
this.current.fillColor = color;
},
setFillColorN: function CanvasGraphics_setFillColorN(/*...*/) {
var cs = this.current.fillColorSpace;
if (cs.name == 'Pattern') {
this.current.fillColor = this.getColorN_Pattern(arguments, cs);
} else {
this.setFillColor.apply(this, arguments);
}
},
setStrokeGray: function CanvasGraphics_setStrokeGray(gray) {
this.current.strokeColorSpace = ColorSpace.singletons.gray;
var rgbColor = this.current.strokeColorSpace.getRgb(arguments, 0);
var color = Util.makeCssRgb(rgbColor);
this.ctx.strokeStyle = color;
this.current.strokeColor = color;
},
setFillGray: function CanvasGraphics_setFillGray(gray) {
this.current.fillColorSpace = ColorSpace.singletons.gray;
var rgbColor = this.current.fillColorSpace.getRgb(arguments, 0);
var color = Util.makeCssRgb(rgbColor);
this.ctx.fillStyle = color;
this.current.fillColor = color;
},
setStrokeRGBColor: function CanvasGraphics_setStrokeRGBColor(r, g, b) {
this.current.strokeColorSpace = ColorSpace.singletons.rgb;
var rgbColor = this.current.strokeColorSpace.getRgb(arguments, 0);
var color = Util.makeCssRgb(rgbColor);
this.ctx.strokeStyle = color;
this.current.strokeColor = color;
},
setFillRGBColor: function CanvasGraphics_setFillRGBColor(r, g, b) {
this.current.fillColorSpace = ColorSpace.singletons.rgb;
var rgbColor = this.current.fillColorSpace.getRgb(arguments, 0);
var color = Util.makeCssRgb(rgbColor);
this.ctx.fillStyle = color;
this.current.fillColor = color;
},
setStrokeCMYKColor: function CanvasGraphics_setStrokeCMYKColor(c, m, y, k) {
this.current.strokeColorSpace = ColorSpace.singletons.cmyk;
var color = Util.makeCssCmyk(arguments);
this.ctx.strokeStyle = color;
this.current.strokeColor = color;
},
setFillCMYKColor: function CanvasGraphics_setFillCMYKColor(c, m, y, k) {
this.current.fillColorSpace = ColorSpace.singletons.cmyk;
var color = Util.makeCssCmyk(arguments);
this.ctx.fillStyle = color;
this.current.fillColor = color;
},
shadingFill: function CanvasGraphics_shadingFill(patternIR) {
var ctx = this.ctx;
this.save();
var pattern = getShadingPatternFromIR(patternIR);
ctx.fillStyle = pattern.getPattern(ctx, this, true);
var inv = ctx.mozCurrentTransformInverse;
if (inv) {
var canvas = ctx.canvas;
var width = canvas.width;
var height = canvas.height;
var bl = Util.applyTransform([0, 0], inv);
var br = Util.applyTransform([0, height], inv);
var ul = Util.applyTransform([width, 0], inv);
var ur = Util.applyTransform([width, height], inv);
var x0 = Math.min(bl[0], br[0], ul[0], ur[0]);
var y0 = Math.min(bl[1], br[1], ul[1], ur[1]);
var x1 = Math.max(bl[0], br[0], ul[0], ur[0]);
var y1 = Math.max(bl[1], br[1], ul[1], ur[1]);
this.ctx.fillRect(x0, y0, x1 - x0, y1 - y0);
} else {
// HACK to draw the gradient onto an infinite rectangle.
// PDF gradients are drawn across the entire image while
// Canvas only allows gradients to be drawn in a rectangle
// The following bug should allow us to remove this.
// https://bugzilla.mozilla.org/show_bug.cgi?id=664884
this.ctx.fillRect(-1e10, -1e10, 2e10, 2e10);
}
this.restore();
},
// Images
beginInlineImage: function CanvasGraphics_beginInlineImage() {
error('Should not call beginInlineImage');
},
beginImageData: function CanvasGraphics_beginImageData() {
error('Should not call beginImageData');
},
paintFormXObjectBegin: function CanvasGraphics_paintFormXObjectBegin(matrix,
bbox) {
this.save();
this.baseTransformStack.push(this.baseTransform);
if (matrix && isArray(matrix) && 6 == matrix.length) {
this.transform.apply(this, matrix);
}
this.baseTransform = this.ctx.mozCurrentTransform;
if (bbox && isArray(bbox) && 4 == bbox.length) {
var width = bbox[2] - bbox[0];
var height = bbox[3] - bbox[1];
this.rectangle(bbox[0], bbox[1], width, height);
this.clip();
this.endPath();
}
},
paintFormXObjectEnd: function CanvasGraphics_paintFormXObjectEnd() {
this.restore();
this.baseTransform = this.baseTransformStack.pop();
},
beginGroup: function CanvasGraphics_beginGroup(group) {
this.save();
var currentCtx = this.ctx;
// TODO non-isolated groups - according to Rik at adobe non-isolated
// group results aren't usually that different and they even have tools
// that ignore this setting. Notes from Rik on implmenting:
// - When you encounter an transparency group, create a new canvas with
// the dimensions of the bbox
// - copy the content from the previous canvas to the new canvas
// - draw as usual
// - remove the backdrop alpha:
// alphaNew = 1 - (1 - alpha)/(1 - alphaBackdrop) with 'alpha' the alpha
// value of your transparency group and 'alphaBackdrop' the alpha of the
// backdrop
// - remove background color:
// colorNew = color - alphaNew *colorBackdrop /(1 - alphaNew)
if (!group.isolated) {
info('TODO: Support non-isolated groups.');
}
// TODO knockout - supposedly possible with the clever use of compositing
// modes.
if (group.knockout) {
warn('Knockout groups not supported.');
}
var currentTransform = currentCtx.mozCurrentTransform;
if (group.matrix) {
currentCtx.transform.apply(currentCtx, group.matrix);
}
assert(group.bbox, 'Bounding box is required.');
// Based on the current transform figure out how big the bounding box
// will actually be.
var bounds = Util.getAxialAlignedBoundingBox(
group.bbox,
currentCtx.mozCurrentTransform);
// Clip the bounding box to the current canvas.
var canvasBounds = [0,
0,
currentCtx.canvas.width,
currentCtx.canvas.height];
bounds = Util.intersect(bounds, canvasBounds) || [0, 0, 0, 0];
// Use ceil in case we're between sizes so we don't create canvas that is
// too small and make the canvas at least 1x1 pixels.
var offsetX = Math.floor(bounds[0]);
var offsetY = Math.floor(bounds[1]);
var drawnWidth = Math.max(Math.ceil(bounds[2]) - offsetX, 1);
var drawnHeight = Math.max(Math.ceil(bounds[3]) - offsetY, 1);
var scaleX = 1, scaleY = 1;
if (drawnWidth > MAX_GROUP_SIZE) {
scaleX = drawnWidth / MAX_GROUP_SIZE;
drawnWidth = MAX_GROUP_SIZE;
}
if (drawnHeight > MAX_GROUP_SIZE) {
scaleY = drawnHeight / MAX_GROUP_SIZE;
drawnHeight = MAX_GROUP_SIZE;
}
var cacheId = 'groupAt' + this.groupLevel;
if (group.smask) {
// Using two cache entries is case if masks are used one after another.
cacheId += '_smask_' + ((this.smaskCounter++) % 2);
}
var scratchCanvas = CachedCanvases.getCanvas(
cacheId, drawnWidth, drawnHeight, true);
var groupCtx = scratchCanvas.context;
// Since we created a new canvas that is just the size of the bounding box
// we have to translate the group ctx.
groupCtx.scale(1 / scaleX, 1 / scaleY);
groupCtx.translate(-offsetX, -offsetY);
groupCtx.transform.apply(groupCtx, currentTransform);
if (group.smask) {
// Saving state and cached mask to be used in setGState.
this.smaskStack.push({
canvas: scratchCanvas.canvas,
context: groupCtx,
offsetX: offsetX,
offsetY: offsetY,
scaleX: scaleX,
scaleY: scaleY,
subtype: group.smask.subtype,
backdrop: group.smask.backdrop,
colorSpace: group.colorSpace && ColorSpace.fromIR(group.colorSpace)
});
} else {
// Setup the current ctx so when the group is popped we draw it at the
// right location.
currentCtx.setTransform(1, 0, 0, 1, 0, 0);
currentCtx.translate(offsetX, offsetY);
currentCtx.scale(scaleX, scaleY);
}
// The transparency group inherits all off the current graphics state
// except the blend mode, soft mask, and alpha constants.
copyCtxState(currentCtx, groupCtx);
this.ctx = groupCtx;
this.setGState([
['BM', 'Normal'],
['ca', 1],
['CA', 1]
]);
this.groupStack.push(currentCtx);
this.groupLevel++;
},
endGroup: function CanvasGraphics_endGroup(group) {
this.groupLevel--;
var groupCtx = this.ctx;
this.ctx = this.groupStack.pop();
// Turn off image smoothing to avoid sub pixel interpolation which can
// look kind of blurry for some pdfs.
if ('imageSmoothingEnabled' in this.ctx) {
this.ctx.imageSmoothingEnabled = false;
} else {
this.ctx.mozImageSmoothingEnabled = false;
}
if (group.smask) {
this.tempSMask = this.smaskStack.pop();
} else {
this.ctx.drawImage(groupCtx.canvas, 0, 0);
}
this.restore();
},
beginAnnotations: function CanvasGraphics_beginAnnotations() {
this.save();
this.current = new CanvasExtraState();
},
endAnnotations: function CanvasGraphics_endAnnotations() {
this.restore();
},
beginAnnotation: function CanvasGraphics_beginAnnotation(rect, transform,
matrix) {
this.save();
if (rect && isArray(rect) && 4 == rect.length) {
var width = rect[2] - rect[0];
var height = rect[3] - rect[1];
this.rectangle(rect[0], rect[1], width, height);
this.clip();
this.endPath();
}
this.transform.apply(this, transform);
this.transform.apply(this, matrix);
},
endAnnotation: function CanvasGraphics_endAnnotation() {
this.restore();
},
paintJpegXObject: function CanvasGraphics_paintJpegXObject(objId, w, h) {
var domImage = this.objs.get(objId);
if (!domImage) {
warn('Dependent image isn\'t ready yet');
return;
}
this.save();
var ctx = this.ctx;
// scale the image to the unit square
ctx.scale(1 / w, -1 / h);
ctx.drawImage(domImage, 0, 0, domImage.width, domImage.height,
0, -h, w, h);
if (this.imageLayer) {
var currentTransform = ctx.mozCurrentTransformInverse;
var position = this.getCanvasPosition(0, 0);
this.imageLayer.appendImage({
objId: objId,
left: position[0],
top: position[1],
width: w / currentTransform[0],
height: h / currentTransform[3]
});
}
this.restore();
},
paintImageMaskXObject: function CanvasGraphics_paintImageMaskXObject(img) {
var ctx = this.ctx;
var width = img.width, height = img.height;
var glyph = this.processingType3;
if (COMPILE_TYPE3_GLYPHS && glyph && !('compiled' in glyph)) {
var MAX_SIZE_TO_COMPILE = 1000;
if (width <= MAX_SIZE_TO_COMPILE && height <= MAX_SIZE_TO_COMPILE) {
glyph.compiled =
compileType3Glyph({data: img.data, width: width, height: height});
} else {
glyph.compiled = null;
}
}
if (glyph && glyph.compiled) {
glyph.compiled(ctx);
return;
}
var maskCanvas = CachedCanvases.getCanvas('maskCanvas', width, height);
var maskCtx = maskCanvas.context;
maskCtx.save();
putBinaryImageMask(maskCtx, img);
maskCtx.globalCompositeOperation = 'source-in';
var fillColor = this.current.fillColor;
maskCtx.fillStyle = (fillColor && fillColor.hasOwnProperty('type') &&
fillColor.type === 'Pattern') ?
fillColor.getPattern(maskCtx, this) : fillColor;
maskCtx.fillRect(0, 0, width, height);
maskCtx.restore();
this.paintInlineImageXObject(maskCanvas.canvas);
},
paintImageMaskXObjectRepeat:
function CanvasGraphics_paintImageMaskXObjectRepeat(imgData, scaleX,
scaleY, positions) {
var width = imgData.width;
var height = imgData.height;
var ctx = this.ctx;
var maskCanvas = CachedCanvases.getCanvas('maskCanvas', width, height);
var maskCtx = maskCanvas.context;
maskCtx.save();
putBinaryImageMask(maskCtx, imgData);
maskCtx.globalCompositeOperation = 'source-in';
var fillColor = this.current.fillColor;
maskCtx.fillStyle = (fillColor && fillColor.hasOwnProperty('type') &&
fillColor.type === 'Pattern') ?
fillColor.getPattern(maskCtx, this) : fillColor;
maskCtx.fillRect(0, 0, width, height);
maskCtx.restore();
for (var i = 0, ii = positions.length; i < ii; i += 2) {
ctx.save();
ctx.transform(scaleX, 0, 0, scaleY, positions[i], positions[i + 1]);
ctx.scale(1, -1);
ctx.drawImage(maskCanvas.canvas, 0, 0, width, height,
0, -1, 1, 1);
ctx.restore();
}
},
paintImageMaskXObjectGroup:
function CanvasGraphics_paintImageMaskXObjectGroup(images) {
var ctx = this.ctx;
for (var i = 0, ii = images.length; i < ii; i++) {
var image = images[i];
var width = image.width, height = image.height;
var maskCanvas = CachedCanvases.getCanvas('maskCanvas', width, height);
var maskCtx = maskCanvas.context;
maskCtx.save();
putBinaryImageMask(maskCtx, image);
maskCtx.globalCompositeOperation = 'source-in';
var fillColor = this.current.fillColor;
maskCtx.fillStyle = (fillColor && fillColor.hasOwnProperty('type') &&
fillColor.type === 'Pattern') ?
fillColor.getPattern(maskCtx, this) : fillColor;
maskCtx.fillRect(0, 0, width, height);
maskCtx.restore();
ctx.save();
ctx.transform.apply(ctx, image.transform);
ctx.scale(1, -1);
ctx.drawImage(maskCanvas.canvas, 0, 0, width, height,
0, -1, 1, 1);
ctx.restore();
}
},
paintImageXObject: function CanvasGraphics_paintImageXObject(objId) {
var imgData = this.objs.get(objId);
if (!imgData) {
warn('Dependent image isn\'t ready yet');
return;
}
this.paintInlineImageXObject(imgData);
},
paintImageXObjectRepeat:
function CanvasGraphics_paintImageXObjectRepeat(objId, scaleX, scaleY,
positions) {
var imgData = this.objs.get(objId);
if (!imgData) {
warn('Dependent image isn\'t ready yet');
return;
}
var width = imgData.width;
var height = imgData.height;
var map = [];
for (var i = 0, ii = positions.length; i < ii; i += 2) {
map.push({transform: [scaleX, 0, 0, scaleY, positions[i],
positions[i + 1]], x: 0, y: 0, w: width, h: height});
}
this.paintInlineImageXObjectGroup(imgData, map);
},
paintInlineImageXObject:
function CanvasGraphics_paintInlineImageXObject(imgData) {
var width = imgData.width;
var height = imgData.height;
var ctx = this.ctx;
this.save();
// scale the image to the unit square
ctx.scale(1 / width, -1 / height);
var currentTransform = ctx.mozCurrentTransformInverse;
var a = currentTransform[0], b = currentTransform[1];
var widthScale = Math.max(Math.sqrt(a * a + b * b), 1);
var c = currentTransform[2], d = currentTransform[3];
var heightScale = Math.max(Math.sqrt(c * c + d * d), 1);
var imgToPaint, tmpCanvas;
// instanceof HTMLElement does not work in jsdom node.js module
if (imgData instanceof HTMLElement || !imgData.data) {
imgToPaint = imgData;
} else {
tmpCanvas = CachedCanvases.getCanvas('inlineImage', width, height);
var tmpCtx = tmpCanvas.context;
putBinaryImageData(tmpCtx, imgData);
imgToPaint = tmpCanvas.canvas;
}
var paintWidth = width, paintHeight = height;
var tmpCanvasId = 'prescale1';
// Vertial or horizontal scaling shall not be more than 2 to not loose the
// pixels during drawImage operation, painting on the temporary canvas(es)
// that are twice smaller in size
while ((widthScale > 2 && paintWidth > 1) ||
(heightScale > 2 && paintHeight > 1)) {
var newWidth = paintWidth, newHeight = paintHeight;
if (widthScale > 2 && paintWidth > 1) {
newWidth = Math.ceil(paintWidth / 2);
widthScale /= paintWidth / newWidth;
}
if (heightScale > 2 && paintHeight > 1) {
newHeight = Math.ceil(paintHeight / 2);
heightScale /= paintHeight / newHeight;
}
tmpCanvas = CachedCanvases.getCanvas(tmpCanvasId, newWidth, newHeight);
tmpCtx = tmpCanvas.context;
tmpCtx.clearRect(0, 0, newWidth, newHeight);
tmpCtx.drawImage(imgToPaint, 0, 0, paintWidth, paintHeight,
0, 0, newWidth, newHeight);
imgToPaint = tmpCanvas.canvas;
paintWidth = newWidth;
paintHeight = newHeight;
tmpCanvasId = tmpCanvasId === 'prescale1' ? 'prescale2' : 'prescale1';
}
ctx.drawImage(imgToPaint, 0, 0, paintWidth, paintHeight,
0, -height, width, height);
if (this.imageLayer) {
var position = this.getCanvasPosition(0, -height);
this.imageLayer.appendImage({
imgData: imgData,
left: position[0],
top: position[1],
width: width / currentTransform[0],
height: height / currentTransform[3]
});
}
this.restore();
},
paintInlineImageXObjectGroup:
function CanvasGraphics_paintInlineImageXObjectGroup(imgData, map) {
var ctx = this.ctx;
var w = imgData.width;
var h = imgData.height;
var tmpCanvas = CachedCanvases.getCanvas('inlineImage', w, h);
var tmpCtx = tmpCanvas.context;
putBinaryImageData(tmpCtx, imgData);
for (var i = 0, ii = map.length; i < ii; i++) {
var entry = map[i];
ctx.save();
ctx.transform.apply(ctx, entry.transform);
ctx.scale(1, -1);
ctx.drawImage(tmpCanvas.canvas, entry.x, entry.y, entry.w, entry.h,
0, -1, 1, 1);
if (this.imageLayer) {
var position = this.getCanvasPosition(entry.x, entry.y);
this.imageLayer.appendImage({
imgData: imgData,
left: position[0],
top: position[1],
width: w,
height: h
});
}
ctx.restore();
}
},
paintSolidColorImageMask:
function CanvasGraphics_paintSolidColorImageMask() {
this.ctx.fillRect(0, 0, 1, 1);
},
// Marked content
markPoint: function CanvasGraphics_markPoint(tag) {
// TODO Marked content.
},
markPointProps: function CanvasGraphics_markPointProps(tag, properties) {
// TODO Marked content.
},
beginMarkedContent: function CanvasGraphics_beginMarkedContent(tag) {
// TODO Marked content.
},
beginMarkedContentProps: function CanvasGraphics_beginMarkedContentProps(
tag, properties) {
// TODO Marked content.
},
endMarkedContent: function CanvasGraphics_endMarkedContent() {
// TODO Marked content.
},
// Compatibility
beginCompat: function CanvasGraphics_beginCompat() {
// TODO ignore undefined operators (should we do that anyway?)
},
endCompat: function CanvasGraphics_endCompat() {
// TODO stop ignoring undefined operators
},
// Helper functions
consumePath: function CanvasGraphics_consumePath() {
if (this.pendingClip) {
if (this.pendingClip == EO_CLIP) {
if ('mozFillRule' in this.ctx) {
this.ctx.mozFillRule = 'evenodd';
this.ctx.clip();
this.ctx.mozFillRule = 'nonzero';
} else {
try {
this.ctx.clip('evenodd');
} catch (ex) {
// shouldn't really happen, but browsers might think differently
this.ctx.clip();
}
}
} else {
this.ctx.clip();
}
this.pendingClip = null;
}
this.ctx.beginPath();
},
getSinglePixelWidth: function CanvasGraphics_getSinglePixelWidth(scale) {
var inverse = this.ctx.mozCurrentTransformInverse;
// max of the current horizontal and vertical scale
return Math.sqrt(Math.max(
(inverse[0] * inverse[0] + inverse[1] * inverse[1]),
(inverse[2] * inverse[2] + inverse[3] * inverse[3])));
},
getCanvasPosition: function CanvasGraphics_getCanvasPosition(x, y) {
var transform = this.ctx.mozCurrentTransform;
return [
transform[0] * x + transform[2] * y + transform[4],
transform[1] * x + transform[3] * y + transform[5]
];
}
};
for (var op in OPS) {
CanvasGraphics.prototype[OPS[op]] = CanvasGraphics.prototype[op];
}
return CanvasGraphics;
})();
var WebGLUtils = (function WebGLUtilsClosure() {
function loadShader(gl, code, shaderType) {
var shader = gl.createShader(shaderType);
gl.shaderSource(shader, code);
gl.compileShader(shader);
var compiled = gl.getShaderParameter(shader, gl.COMPILE_STATUS);
if (!compiled) {
var errorMsg = gl.getShaderInfoLog(shader);
throw new Error('Error during shader compilation: ' + errorMsg);
}
return shader;
}
function createVertexShader(gl, code) {
return loadShader(gl, code, gl.VERTEX_SHADER);
}
function createFragmentShader(gl, code) {
return loadShader(gl, code, gl.FRAGMENT_SHADER);
}
function createProgram(gl, shaders) {
var program = gl.createProgram();
for (var i = 0, ii = shaders.length; i < ii; ++i) {
gl.attachShader(program, shaders[i]);
}
gl.linkProgram(program);
var linked = gl.getProgramParameter(program, gl.LINK_STATUS);
if (!linked) {
var errorMsg = gl.getProgramInfoLog(program);
throw new Error('Error during program linking: ' + errorMsg);
}
return program;
}
function createTexture(gl, image, textureId) {
gl.activeTexture(textureId);
var texture = gl.createTexture();
gl.bindTexture(gl.TEXTURE_2D, texture);
// Set the parameters so we can render any size image.
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
// Upload the image into the texture.
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image);
return texture;
}
var currentGL, currentCanvas;
function generageGL() {
if (currentGL) {
return;
}
currentCanvas = document.createElement('canvas');
currentGL = currentCanvas.getContext('webgl',
{ premultipliedalpha: false });
}
var smaskVertexShaderCode = '\
attribute vec2 a_position; \
attribute vec2 a_texCoord; \
\
uniform vec2 u_resolution; \
\
varying vec2 v_texCoord; \
\
void main() { \
vec2 clipSpace = (a_position / u_resolution) * 2.0 - 1.0; \
gl_Position = vec4(clipSpace * vec2(1, -1), 0, 1); \
\
v_texCoord = a_texCoord; \
} ';
var smaskFragmentShaderCode = '\
precision mediump float; \
\
uniform vec4 u_backdrop; \
uniform int u_subtype; \
uniform sampler2D u_image; \
uniform sampler2D u_mask; \
\
varying vec2 v_texCoord; \
\
void main() { \
vec4 imageColor = texture2D(u_image, v_texCoord); \
vec4 maskColor = texture2D(u_mask, v_texCoord); \
if (u_backdrop.a > 0.0) { \
maskColor.rgb = maskColor.rgb * maskColor.a + \
u_backdrop.rgb * (1.0 - maskColor.a); \
} \
float lum; \
if (u_subtype == 0) { \
lum = maskColor.a; \
} else { \
lum = maskColor.r * 0.3 + maskColor.g * 0.59 + \
maskColor.b * 0.11; \
} \
imageColor.a *= lum; \
imageColor.rgb *= imageColor.a; \
gl_FragColor = imageColor; \
} ';
var smaskCache = null;
function initSmaskGL() {
var canvas, gl;
generageGL();
canvas = currentCanvas;
currentCanvas = null;
gl = currentGL;
currentGL = null;
// setup a GLSL program
var vertexShader = createVertexShader(gl, smaskVertexShaderCode);
var fragmentShader = createFragmentShader(gl, smaskFragmentShaderCode);
var program = createProgram(gl, [vertexShader, fragmentShader]);
gl.useProgram(program);
var cache = {};
cache.gl = gl;
cache.canvas = canvas;
cache.resolutionLocation = gl.getUniformLocation(program, 'u_resolution');
cache.positionLocation = gl.getAttribLocation(program, 'a_position');
cache.backdropLocation = gl.getUniformLocation(program, 'u_backdrop');
cache.subtypeLocation = gl.getUniformLocation(program, 'u_subtype');
var texCoordLocation = gl.getAttribLocation(program, 'a_texCoord');
var texLayerLocation = gl.getUniformLocation(program, 'u_image');
var texMaskLocation = gl.getUniformLocation(program, 'u_mask');
// provide texture coordinates for the rectangle.
var texCoordBuffer = gl.createBuffer();
gl.bindBuffer(gl.ARRAY_BUFFER, texCoordBuffer);
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([
0.0, 0.0,
1.0, 0.0,
0.0, 1.0,
0.0, 1.0,
1.0, 0.0,
1.0, 1.0]), gl.STATIC_DRAW);
gl.enableVertexAttribArray(texCoordLocation);
gl.vertexAttribPointer(texCoordLocation, 2, gl.FLOAT, false, 0, 0);
gl.uniform1i(texLayerLocation, 0);
gl.uniform1i(texMaskLocation, 1);
smaskCache = cache;
}
function composeSMask(layer, mask, properties) {
var width = layer.width, height = layer.height;
if (!smaskCache) {
initSmaskGL();
}
var cache = smaskCache,canvas = cache.canvas, gl = cache.gl;
canvas.width = width;
canvas.height = height;
gl.viewport(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight);
gl.uniform2f(cache.resolutionLocation, width, height);
if (properties.backdrop) {
gl.uniform4f(cache.resolutionLocation, properties.backdrop[0],
properties.backdrop[1], properties.backdrop[2], 1);
} else {
gl.uniform4f(cache.resolutionLocation, 0, 0, 0, 0);
}
gl.uniform1i(cache.subtypeLocation,
properties.subtype === 'Luminosity' ? 1 : 0);
// Create a textures
var texture = createTexture(gl, layer, gl.TEXTURE0);
var maskTexture = createTexture(gl, mask, gl.TEXTURE1);
// Create a buffer and put a single clipspace rectangle in
// it (2 triangles)
var buffer = gl.createBuffer();
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([
0, 0,
width, 0,
0, height,
0, height,
width, 0,
width, height]), gl.STATIC_DRAW);
gl.enableVertexAttribArray(cache.positionLocation);
gl.vertexAttribPointer(cache.positionLocation, 2, gl.FLOAT, false, 0, 0);
// draw
gl.clearColor(0, 0, 0, 0);
gl.enable(gl.BLEND);
gl.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA);
gl.clear(gl.COLOR_BUFFER_BIT);
gl.drawArrays(gl.TRIANGLES, 0, 6);
gl.flush();
gl.deleteTexture(texture);
gl.deleteTexture(maskTexture);
gl.deleteBuffer(buffer);
return canvas;
}
var figuresVertexShaderCode = '\
attribute vec2 a_position; \
attribute vec3 a_color; \
\
uniform vec2 u_resolution; \
uniform vec2 u_scale; \
uniform vec2 u_offset; \
\
varying vec4 v_color; \
\
void main() { \
vec2 position = (a_position + u_offset) * u_scale; \
vec2 clipSpace = (position / u_resolution) * 2.0 - 1.0; \
gl_Position = vec4(clipSpace * vec2(1, -1), 0, 1); \
\
v_color = vec4(a_color / 255.0, 1.0); \
} ';
var figuresFragmentShaderCode = '\
precision mediump float; \
\
varying vec4 v_color; \
\
void main() { \
gl_FragColor = v_color; \
} ';
var figuresCache = null;
function initFiguresGL() {
var canvas, gl;
generageGL();
canvas = currentCanvas;
currentCanvas = null;
gl = currentGL;
currentGL = null;
// setup a GLSL program
var vertexShader = createVertexShader(gl, figuresVertexShaderCode);
var fragmentShader = createFragmentShader(gl, figuresFragmentShaderCode);
var program = createProgram(gl, [vertexShader, fragmentShader]);
gl.useProgram(program);
var cache = {};
cache.gl = gl;
cache.canvas = canvas;
cache.resolutionLocation = gl.getUniformLocation(program, 'u_resolution');
cache.scaleLocation = gl.getUniformLocation(program, 'u_scale');
cache.offsetLocation = gl.getUniformLocation(program, 'u_offset');
cache.positionLocation = gl.getAttribLocation(program, 'a_position');
cache.colorLocation = gl.getAttribLocation(program, 'a_color');
figuresCache = cache;
}
function drawFigures(width, height, backgroundColor, figures, context) {
if (!figuresCache) {
initFiguresGL();
}
var cache = figuresCache, canvas = cache.canvas, gl = cache.gl;
canvas.width = width;
canvas.height = height;
gl.viewport(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight);
gl.uniform2f(cache.resolutionLocation, width, height);
// count triangle points
var count = 0;
var i, ii, rows;
for (i = 0, ii = figures.length; i < ii; i++) {
switch (figures[i].type) {
case 'lattice':
rows = (figures[i].coords.length / figures[i].verticesPerRow) | 0;
count += (rows - 1) * (figures[i].verticesPerRow - 1) * 6;
break;
case 'triangles':
count += figures[i].coords.length;
break;
}
}
// transfer data
var coords = new Float32Array(count * 2);
var colors = new Uint8Array(count * 3);
var coordsMap = context.coords, colorsMap = context.colors;
var pIndex = 0, cIndex = 0;
for (i = 0, ii = figures.length; i < ii; i++) {
var figure = figures[i], ps = figure.coords, cs = figure.colors;
switch (figure.type) {
case 'lattice':
var cols = figure.verticesPerRow;
rows = (ps.length / cols) | 0;
for (var row = 1; row < rows; row++) {
var offset = row * cols + 1;
for (var col = 1; col < cols; col++, offset++) {
coords[pIndex] = coordsMap[ps[offset - cols - 1]];
coords[pIndex + 1] = coordsMap[ps[offset - cols - 1] + 1];
coords[pIndex + 2] = coordsMap[ps[offset - cols]];
coords[pIndex + 3] = coordsMap[ps[offset - cols] + 1];
coords[pIndex + 4] = coordsMap[ps[offset - 1]];
coords[pIndex + 5] = coordsMap[ps[offset - 1] + 1];
colors[cIndex] = colorsMap[cs[offset - cols - 1]];
colors[cIndex + 1] = colorsMap[cs[offset - cols - 1] + 1];
colors[cIndex + 2] = colorsMap[cs[offset - cols - 1] + 2];
colors[cIndex + 3] = colorsMap[cs[offset - cols]];
colors[cIndex + 4] = colorsMap[cs[offset - cols] + 1];
colors[cIndex + 5] = colorsMap[cs[offset - cols] + 2];
colors[cIndex + 6] = colorsMap[cs[offset - 1]];
colors[cIndex + 7] = colorsMap[cs[offset - 1] + 1];
colors[cIndex + 8] = colorsMap[cs[offset - 1] + 2];
coords[pIndex + 6] = coords[pIndex + 2];
coords[pIndex + 7] = coords[pIndex + 3];
coords[pIndex + 8] = coords[pIndex + 4];
coords[pIndex + 9] = coords[pIndex + 5];
coords[pIndex + 10] = coordsMap[ps[offset]];
coords[pIndex + 11] = coordsMap[ps[offset] + 1];
colors[cIndex + 9] = colors[cIndex + 3];
colors[cIndex + 10] = colors[cIndex + 4];
colors[cIndex + 11] = colors[cIndex + 5];
colors[cIndex + 12] = colors[cIndex + 6];
colors[cIndex + 13] = colors[cIndex + 7];
colors[cIndex + 14] = colors[cIndex + 8];
colors[cIndex + 15] = colorsMap[cs[offset]];
colors[cIndex + 16] = colorsMap[cs[offset] + 1];
colors[cIndex + 17] = colorsMap[cs[offset] + 2];
pIndex += 12;
cIndex += 18;
}
}
break;
case 'triangles':
for (var j = 0, jj = ps.length; j < jj; j++) {
coords[pIndex] = coordsMap[ps[j]];
coords[pIndex + 1] = coordsMap[ps[j] + 1];
colors[cIndex] = colorsMap[cs[i]];
colors[cIndex + 1] = colorsMap[cs[j] + 1];
colors[cIndex + 2] = colorsMap[cs[j] + 2];
pIndex += 2;
cIndex += 3;
}
break;
}
}
// draw
if (backgroundColor) {
gl.clearColor(backgroundColor[0] / 255, backgroundColor[1] / 255,
backgroundColor[2] / 255, 1.0);
} else {
gl.clearColor(0, 0, 0, 0);
}
gl.clear(gl.COLOR_BUFFER_BIT);
var coordsBuffer = gl.createBuffer();
gl.bindBuffer(gl.ARRAY_BUFFER, coordsBuffer);
gl.bufferData(gl.ARRAY_BUFFER, coords, gl.STATIC_DRAW);
gl.enableVertexAttribArray(cache.positionLocation);
gl.vertexAttribPointer(cache.positionLocation, 2, gl.FLOAT, false, 0, 0);
var colorsBuffer = gl.createBuffer();
gl.bindBuffer(gl.ARRAY_BUFFER, colorsBuffer);
gl.bufferData(gl.ARRAY_BUFFER, colors, gl.STATIC_DRAW);
gl.enableVertexAttribArray(cache.colorLocation);
gl.vertexAttribPointer(cache.colorLocation, 3, gl.UNSIGNED_BYTE, false,
0, 0);
gl.uniform2f(cache.scaleLocation, context.scaleX, context.scaleY);
gl.uniform2f(cache.offsetLocation, context.offsetX, context.offsetY);
gl.drawArrays(gl.TRIANGLES, 0, count);
gl.flush();
gl.deleteBuffer(coordsBuffer);
gl.deleteBuffer(colorsBuffer);
return canvas;
}
function cleanup() {
smaskCache = null;
figuresCache = null;
}
return {
get isEnabled() {
if (PDFJS.disableWebGL) {
return false;
}
var enabled = false;
try {
generageGL();
enabled = !!currentGL;
} catch (e) { }
return shadow(this, 'isEnabled', enabled);
},
composeSMask: composeSMask,
drawFigures: drawFigures,
clear: cleanup
};
})();
var ShadingIRs = {};
ShadingIRs.RadialAxial = {
fromIR: function RadialAxial_fromIR(raw) {
var type = raw[1];
var colorStops = raw[2];
var p0 = raw[3];
var p1 = raw[4];
var r0 = raw[5];
var r1 = raw[6];
return {
type: 'Pattern',
getPattern: function RadialAxial_getPattern(ctx) {
var grad;
if (type === 'axial') {
grad = ctx.createLinearGradient(p0[0], p0[1], p1[0], p1[1]);
} else if (type === 'radial') {
grad = ctx.createRadialGradient(p0[0], p0[1], r0, p1[0], p1[1], r1);
}
for (var i = 0, ii = colorStops.length; i < ii; ++i) {
var c = colorStops[i];
grad.addColorStop(c[0], c[1]);
}
return grad;
}
};
}
};
var createMeshCanvas = (function createMeshCanvasClosure() {
function drawTriangle(data, context, p1, p2, p3, c1, c2, c3) {
// Very basic Gouraud-shaded triangle rasterization algorithm.
var coords = context.coords, colors = context.colors;
var bytes = data.data, rowSize = data.width * 4;
var tmp;
if (coords[p1 + 1] > coords[p2 + 1]) {
tmp = p1; p1 = p2; p2 = tmp; tmp = c1; c1 = c2; c2 = tmp;
}
if (coords[p2 + 1] > coords[p3 + 1]) {
tmp = p2; p2 = p3; p3 = tmp; tmp = c2; c2 = c3; c3 = tmp;
}
if (coords[p1 + 1] > coords[p2 + 1]) {
tmp = p1; p1 = p2; p2 = tmp; tmp = c1; c1 = c2; c2 = tmp;
}
var x1 = (coords[p1] + context.offsetX) * context.scaleX;
var y1 = (coords[p1 + 1] + context.offsetY) * context.scaleY;
var x2 = (coords[p2] + context.offsetX) * context.scaleX;
var y2 = (coords[p2 + 1] + context.offsetY) * context.scaleY;
var x3 = (coords[p3] + context.offsetX) * context.scaleX;
var y3 = (coords[p3 + 1] + context.offsetY) * context.scaleY;
if (y1 >= y3) {
return;
}
var c1r = colors[c1], c1g = colors[c1 + 1], c1b = colors[c1 + 2];
var c2r = colors[c2], c2g = colors[c2 + 1], c2b = colors[c2 + 2];
var c3r = colors[c3], c3g = colors[c3 + 1], c3b = colors[c3 + 2];
var minY = Math.round(y1), maxY = Math.round(y3);
var xa, car, cag, cab;
var xb, cbr, cbg, cbb;
var k;
for (var y = minY; y <= maxY; y++) {
if (y < y2) {
k = y < y1 ? 0 : y1 === y2 ? 1 : (y1 - y) / (y1 - y2);
xa = x1 - (x1 - x2) * k;
car = c1r - (c1r - c2r) * k;
cag = c1g - (c1g - c2g) * k;
cab = c1b - (c1b - c2b) * k;
} else {
k = y > y3 ? 1 : y2 === y3 ? 0 : (y2 - y) / (y2 - y3);
xa = x2 - (x2 - x3) * k;
car = c2r - (c2r - c3r) * k;
cag = c2g - (c2g - c3g) * k;
cab = c2b - (c2b - c3b) * k;
}
k = y < y1 ? 0 : y > y3 ? 1 : (y1 - y) / (y1 - y3);
xb = x1 - (x1 - x3) * k;
cbr = c1r - (c1r - c3r) * k;
cbg = c1g - (c1g - c3g) * k;
cbb = c1b - (c1b - c3b) * k;
var x1_ = Math.round(Math.min(xa, xb));
var x2_ = Math.round(Math.max(xa, xb));
var j = rowSize * y + x1_ * 4;
for (var x = x1_; x <= x2_; x++) {
k = (xa - x) / (xa - xb);
k = k < 0 ? 0 : k > 1 ? 1 : k;
bytes[j++] = (car - (car - cbr) * k) | 0;
bytes[j++] = (cag - (cag - cbg) * k) | 0;
bytes[j++] = (cab - (cab - cbb) * k) | 0;
bytes[j++] = 255;
}
}
}
function drawFigure(data, figure, context) {
var ps = figure.coords;
var cs = figure.colors;
var i, ii;
switch (figure.type) {
case 'lattice':
var verticesPerRow = figure.verticesPerRow;
var rows = Math.floor(ps.length / verticesPerRow) - 1;
var cols = verticesPerRow - 1;
for (i = 0; i < rows; i++) {
var q = i * verticesPerRow;
for (var j = 0; j < cols; j++, q++) {
drawTriangle(data, context,
ps[q], ps[q + 1], ps[q + verticesPerRow],
cs[q], cs[q + 1], cs[q + verticesPerRow]);
drawTriangle(data, context,
ps[q + verticesPerRow + 1], ps[q + 1], ps[q + verticesPerRow],
cs[q + verticesPerRow + 1], cs[q + 1], cs[q + verticesPerRow]);
}
}
break;
case 'triangles':
for (i = 0, ii = ps.length; i < ii; i += 3) {
drawTriangle(data, context,
ps[i], ps[i + 1], ps[i + 2],
cs[i], cs[i + 1], cs[i + 2]);
}
break;
default:
error('illigal figure');
break;
}
}
function createMeshCanvas(bounds, combinesScale, coords, colors, figures,
backgroundColor) {
// we will increase scale on some weird factor to let antialiasing take
// care of "rough" edges
var EXPECTED_SCALE = 1.1;
// MAX_PATTERN_SIZE is used to avoid OOM situation.
var MAX_PATTERN_SIZE = 3000; // 10in @ 300dpi shall be enough
var offsetX = Math.floor(bounds[0]);
var offsetY = Math.floor(bounds[1]);
var boundsWidth = Math.ceil(bounds[2]) - offsetX;
var boundsHeight = Math.ceil(bounds[3]) - offsetY;
var width = Math.min(Math.ceil(Math.abs(boundsWidth * combinesScale[0] *
EXPECTED_SCALE)), MAX_PATTERN_SIZE);
var height = Math.min(Math.ceil(Math.abs(boundsHeight * combinesScale[1] *
EXPECTED_SCALE)), MAX_PATTERN_SIZE);
var scaleX = boundsWidth / width;
var scaleY = boundsHeight / height;
var context = {
coords: coords,
colors: colors,
offsetX: -offsetX,
offsetY: -offsetY,
scaleX: 1 / scaleX,
scaleY: 1 / scaleY
};
var canvas, tmpCanvas, i, ii;
if (WebGLUtils.isEnabled) {
canvas = WebGLUtils.drawFigures(width, height, backgroundColor,
figures, context);
// https://bugzilla.mozilla.org/show_bug.cgi?id=972126
tmpCanvas = CachedCanvases.getCanvas('mesh', width, height, false);
tmpCanvas.context.drawImage(canvas, 0, 0);
canvas = tmpCanvas.canvas;
} else {
tmpCanvas = CachedCanvases.getCanvas('mesh', width, height, false);
var tmpCtx = tmpCanvas.context;
var data = tmpCtx.createImageData(width, height);
if (backgroundColor) {
var bytes = data.data;
for (i = 0, ii = bytes.length; i < ii; i += 4) {
bytes[i] = backgroundColor[0];
bytes[i + 1] = backgroundColor[1];
bytes[i + 2] = backgroundColor[2];
bytes[i + 3] = 255;
}
}
for (i = 0; i < figures.length; i++) {
drawFigure(data, figures[i], context);
}
tmpCtx.putImageData(data, 0, 0);
canvas = tmpCanvas.canvas;
}
return {canvas: canvas, offsetX: offsetX, offsetY: offsetY,
scaleX: scaleX, scaleY: scaleY};
}
return createMeshCanvas;
})();
ShadingIRs.Mesh = {
fromIR: function Mesh_fromIR(raw) {
var type = raw[1];
var coords = raw[2];
var colors = raw[3];
var figures = raw[4];
var bounds = raw[5];
var matrix = raw[6];
var bbox = raw[7];
var background = raw[8];
return {
type: 'Pattern',
getPattern: function Mesh_getPattern(ctx, owner, shadingFill) {
var combinedScale;
// Obtain scale from matrix and current transformation matrix.
if (shadingFill) {
combinedScale = Util.singularValueDecompose2dScale(
ctx.mozCurrentTransform);
} else {
var matrixScale = Util.singularValueDecompose2dScale(matrix);
var curMatrixScale = Util.singularValueDecompose2dScale(
owner.baseTransform);
combinedScale = [matrixScale[0] * curMatrixScale[0],
matrixScale[1] * curMatrixScale[1]];
}
// Rasterizing on the main thread since sending/queue large canvases
// might cause OOM.
var temporaryPatternCanvas = createMeshCanvas(bounds, combinedScale,
coords, colors, figures, shadingFill ? null : background);
if (!shadingFill) {
ctx.setTransform.apply(ctx, owner.baseTransform);
if (matrix) {
ctx.transform.apply(ctx, matrix);
}
}
ctx.translate(temporaryPatternCanvas.offsetX,
temporaryPatternCanvas.offsetY);
ctx.scale(temporaryPatternCanvas.scaleX,
temporaryPatternCanvas.scaleY);
return ctx.createPattern(temporaryPatternCanvas.canvas, 'no-repeat');
}
};
}
};
ShadingIRs.Dummy = {
fromIR: function Dummy_fromIR() {
return {
type: 'Pattern',
getPattern: function Dummy_fromIR_getPattern() {
return 'hotpink';
}
};
}
};
function getShadingPatternFromIR(raw) {
var shadingIR = ShadingIRs[raw[0]];
if (!shadingIR) {
error('Unknown IR type: ' + raw[0]);
}
return shadingIR.fromIR(raw);
}
var TilingPattern = (function TilingPatternClosure() {
var PaintType = {
COLORED: 1,
UNCOLORED: 2
};
var MAX_PATTERN_SIZE = 3000; // 10in @ 300dpi shall be enough
function TilingPattern(IR, color, ctx, objs, commonObjs, baseTransform) {
this.name = IR[1][0].name;
this.operatorList = IR[2];
this.matrix = IR[3] || [1, 0, 0, 1, 0, 0];
this.bbox = IR[4];
this.xstep = IR[5];
this.ystep = IR[6];
this.paintType = IR[7];
this.tilingType = IR[8];
this.color = color;
this.objs = objs;
this.commonObjs = commonObjs;
this.baseTransform = baseTransform;
this.type = 'Pattern';
this.ctx = ctx;
}
TilingPattern.prototype = {
createPatternCanvas: function TilinPattern_createPatternCanvas(owner) {
var operatorList = this.operatorList;
var bbox = this.bbox;
var xstep = this.xstep;
var ystep = this.ystep;
var paintType = this.paintType;
var tilingType = this.tilingType;
var color = this.color;
var objs = this.objs;
var commonObjs = this.commonObjs;
var ctx = this.ctx;
info('TilingType: ' + tilingType);
var x0 = bbox[0], y0 = bbox[1], x1 = bbox[2], y1 = bbox[3];
var topLeft = [x0, y0];
// we want the canvas to be as large as the step size
var botRight = [x0 + xstep, y0 + ystep];
var width = botRight[0] - topLeft[0];
var height = botRight[1] - topLeft[1];
// Obtain scale from matrix and current transformation matrix.
var matrixScale = Util.singularValueDecompose2dScale(this.matrix);
var curMatrixScale = Util.singularValueDecompose2dScale(
this.baseTransform);
var combinedScale = [matrixScale[0] * curMatrixScale[0],
matrixScale[1] * curMatrixScale[1]];
// MAX_PATTERN_SIZE is used to avoid OOM situation.
// Use width and height values that are as close as possible to the end
// result when the pattern is used. Too low value makes the pattern look
// blurry. Too large value makes it look too crispy.
width = Math.min(Math.ceil(Math.abs(width * combinedScale[0])),
MAX_PATTERN_SIZE);
height = Math.min(Math.ceil(Math.abs(height * combinedScale[1])),
MAX_PATTERN_SIZE);
var tmpCanvas = CachedCanvases.getCanvas('pattern', width, height, true);
var tmpCtx = tmpCanvas.context;
var graphics = new CanvasGraphics(tmpCtx, commonObjs, objs);
graphics.groupLevel = owner.groupLevel;
this.setFillAndStrokeStyleToContext(tmpCtx, paintType, color);
this.setScale(width, height, xstep, ystep);
this.transformToScale(graphics);
// transform coordinates to pattern space
var tmpTranslate = [1, 0, 0, 1, -topLeft[0], -topLeft[1]];
graphics.transform.apply(graphics, tmpTranslate);
this.clipBbox(graphics, bbox, x0, y0, x1, y1);
graphics.executeOperatorList(operatorList);
return tmpCanvas.canvas;
},
setScale: function TilingPattern_setScale(width, height, xstep, ystep) {
this.scale = [width / xstep, height / ystep];
},
transformToScale: function TilingPattern_transformToScale(graphics) {
var scale = this.scale;
var tmpScale = [scale[0], 0, 0, scale[1], 0, 0];
graphics.transform.apply(graphics, tmpScale);
},
scaleToContext: function TilingPattern_scaleToContext() {
var scale = this.scale;
this.ctx.scale(1 / scale[0], 1 / scale[1]);
},
clipBbox: function clipBbox(graphics, bbox, x0, y0, x1, y1) {
if (bbox && isArray(bbox) && 4 == bbox.length) {
var bboxWidth = x1 - x0;
var bboxHeight = y1 - y0;
graphics.rectangle(x0, y0, bboxWidth, bboxHeight);
graphics.clip();
graphics.endPath();
}
},
setFillAndStrokeStyleToContext:
function setFillAndStrokeStyleToContext(context, paintType, color) {
switch (paintType) {
case PaintType.COLORED:
var ctx = this.ctx;
context.fillStyle = ctx.fillStyle;
context.strokeStyle = ctx.strokeStyle;
break;
case PaintType.UNCOLORED:
var rgbColor = ColorSpace.singletons.rgb.getRgb(color, 0);
var cssColor = Util.makeCssRgb(rgbColor);
context.fillStyle = cssColor;
context.strokeStyle = cssColor;
break;
default:
error('Unsupported paint type: ' + paintType);
}
},
getPattern: function TilingPattern_getPattern(ctx, owner) {
var temporaryPatternCanvas = this.createPatternCanvas(owner);
ctx = this.ctx;
ctx.setTransform.apply(ctx, this.baseTransform);
ctx.transform.apply(ctx, this.matrix);
this.scaleToContext();
return ctx.createPattern(temporaryPatternCanvas, 'repeat');
}
};
return TilingPattern;
})();
PDFJS.disableFontFace = false;
var FontLoader = {
insertRule: function fontLoaderInsertRule(rule) {
var styleElement = document.getElementById('PDFJS_FONT_STYLE_TAG');
if (!styleElement) {
styleElement = document.createElement('style');
styleElement.id = 'PDFJS_FONT_STYLE_TAG';
document.documentElement.getElementsByTagName('head')[0].appendChild(
styleElement);
}
var styleSheet = styleElement.sheet;
styleSheet.insertRule(rule, styleSheet.cssRules.length);
},
clear: function fontLoaderClear() {
var styleElement = document.getElementById('PDFJS_FONT_STYLE_TAG');
if (styleElement) {
styleElement.parentNode.removeChild(styleElement);
}
},
get loadTestFont() {
// This is a CFF font with 1 glyph for '.' that fills its entire width and
// height.
return shadow(this, 'loadTestFont', atob(
'T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQ' +
'AABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwA' +
'AAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbm' +
'FtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAA' +
'AADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6A' +
'ABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAA' +
'MQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAA' +
'AAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAA' +
'AAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQ' +
'AAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMA' +
'AQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAA' +
'EAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAA' +
'AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAA' +
'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' +
'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' +
'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' +
'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAA' +
'AAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgc' +
'A/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWF' +
'hYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQA' +
'AAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAg' +
'ABAAAAAAAAAAAD6AAAAAAAAA=='
));
},
loadTestFontId: 0,
loadingContext: {
requests: [],
nextRequestId: 0
},
isSyncFontLoadingSupported: (function detectSyncFontLoadingSupport() {
if (isWorker) {
return false;
}
// User agent string sniffing is bad, but there is no reliable way to tell
// if font is fully loaded and ready to be used with canvas.
var userAgent = window.navigator.userAgent;
var m = /Mozilla\/5.0.*?rv:(\d+).*? Gecko/.exec(userAgent);
if (m && m[1] >= 14) {
return true;
}
// TODO other browsers
return false;
})(),
bind: function fontLoaderBind(fonts, callback) {
assert(!isWorker, 'bind() shall be called from main thread');
var rules = [], fontsToLoad = [];
for (var i = 0, ii = fonts.length; i < ii; i++) {
var font = fonts[i];
// Add the font to the DOM only once or skip if the font
// is already loaded.
if (font.attached || font.loading === false) {
continue;
}
font.attached = true;
var rule = font.bindDOM();
if (rule) {
rules.push(rule);
fontsToLoad.push(font);
}
}
var request = FontLoader.queueLoadingCallback(callback);
if (rules.length > 0 && !this.isSyncFontLoadingSupported) {
FontLoader.prepareFontLoadEvent(rules, fontsToLoad, request);
} else {
request.complete();
}
},
queueLoadingCallback: function FontLoader_queueLoadingCallback(callback) {
function LoadLoader_completeRequest() {
assert(!request.end, 'completeRequest() cannot be called twice');
request.end = Date.now();
// sending all completed requests in order how they were queued
while (context.requests.length > 0 && context.requests[0].end) {
var otherRequest = context.requests.shift();
setTimeout(otherRequest.callback, 0);
}
}
var context = FontLoader.loadingContext;
var requestId = 'pdfjs-font-loading-' + (context.nextRequestId++);
var request = {
id: requestId,
complete: LoadLoader_completeRequest,
callback: callback,
started: Date.now()
};
context.requests.push(request);
return request;
},
prepareFontLoadEvent: function fontLoaderPrepareFontLoadEvent(rules,
fonts,
request) {
/** Hack begin */
// There's currently no event when a font has finished downloading so the
// following code is a dirty hack to 'guess' when a font is
// ready. It's assumed fonts are loaded in order, so add a known test
// font after the desired fonts and then test for the loading of that
// test font.
function int32(data, offset) {
return (data.charCodeAt(offset) << 24) |
(data.charCodeAt(offset + 1) << 16) |
(data.charCodeAt(offset + 2) << 8) |
(data.charCodeAt(offset + 3) & 0xff);
}
function spliceString(s, offset, remove, insert) {
var chunk1 = s.substr(0, offset);
var chunk2 = s.substr(offset + remove);
return chunk1 + insert + chunk2;
}
var i, ii;
var canvas = document.createElement('canvas');
canvas.width = 1;
canvas.height = 1;
var ctx = canvas.getContext('2d');
var called = 0;
function isFontReady(name, callback) {
called++;
// With setTimeout clamping this gives the font ~100ms to load.
if(called > 30) {
warn('Load test font never loaded.');
callback();
return;
}
ctx.font = '30px ' + name;
ctx.fillText('.', 0, 20);
var imageData = ctx.getImageData(0, 0, 1, 1);
if (imageData.data[3] > 0) {
callback();
return;
}
setTimeout(isFontReady.bind(null, name, callback));
}
var loadTestFontId = 'lt' + Date.now() + this.loadTestFontId++;
// Chromium seems to cache fonts based on a hash of the actual font data,
// so the font must be modified for each load test else it will appear to
// be loaded already.
// TODO: This could maybe be made faster by avoiding the btoa of the full
// font by splitting it in chunks before hand and padding the font id.
var data = this.loadTestFont;
var COMMENT_OFFSET = 976; // has to be on 4 byte boundary (for checksum)
data = spliceString(data, COMMENT_OFFSET, loadTestFontId.length,
loadTestFontId);
// CFF checksum is important for IE, adjusting it
var CFF_CHECKSUM_OFFSET = 16;
var XXXX_VALUE = 0x58585858; // the "comment" filled with 'X'
var checksum = int32(data, CFF_CHECKSUM_OFFSET);
for (i = 0, ii = loadTestFontId.length - 3; i < ii; i += 4) {
checksum = (checksum - XXXX_VALUE + int32(loadTestFontId, i)) | 0;
}
if (i < loadTestFontId.length) { // align to 4 bytes boundary
checksum = (checksum - XXXX_VALUE +
int32(loadTestFontId + 'XXX', i)) | 0;
}
data = spliceString(data, CFF_CHECKSUM_OFFSET, 4, string32(checksum));
var url = 'url(data:font/opentype;base64,' + btoa(data) + ');';
var rule = '@font-face { font-family:"' + loadTestFontId + '";src:' +
url + '}';
FontLoader.insertRule(rule);
var names = [];
for (i = 0, ii = fonts.length; i < ii; i++) {
names.push(fonts[i].loadedName);
}
names.push(loadTestFontId);
var div = document.createElement('div');
div.setAttribute('style',
'visibility: hidden;' +
'width: 10px; height: 10px;' +
'position: absolute; top: 0px; left: 0px;');
for (i = 0, ii = names.length; i < ii; ++i) {
var span = document.createElement('span');
span.textContent = 'Hi';
span.style.fontFamily = names[i];
div.appendChild(span);
}
document.body.appendChild(div);
isFontReady(loadTestFontId, function() {
document.body.removeChild(div);
request.complete();
});
/** Hack end */
}
};
var FontFace = (function FontFaceClosure() {
function FontFace(name, file, properties) {
this.compiledGlyphs = {};
if (arguments.length === 1) {
// importing translated data
var data = arguments[0];
for (var i in data) {
this[i] = data[i];
}
return;
}
}
FontFace.prototype = {
bindDOM: function FontFace_bindDOM() {
if (!this.data) {
return null;
}
if (PDFJS.disableFontFace) {
this.disableFontFace = true;
return null;
}
var data = bytesToString(new Uint8Array(this.data));
var fontName = this.loadedName;
// Add the font-face rule to the document
var url = ('url(data:' + this.mimetype + ';base64,' +
window.btoa(data) + ');');
var rule = '@font-face { font-family:"' + fontName + '";src:' + url + '}';
FontLoader.insertRule(rule);
if (PDFJS.pdfBug && 'FontInspector' in globalScope &&
globalScope['FontInspector'].enabled) {
globalScope['FontInspector'].fontAdded(this, url);
}
return rule;
},
getPathGenerator: function (objs, character) {
if (!(character in this.compiledGlyphs)) {
var js = objs.get(this.loadedName + '_path_' + character);
/*jshint -W054 */
this.compiledGlyphs[character] = new Function('c', 'size', js);
}
return this.compiledGlyphs[character];
}
};
return FontFace;
})();
}).call((typeof window === 'undefined') ? this : window);
if (!PDFJS.workerSrc && typeof document !== 'undefined') {
// workerSrc is not set -- using last script url to define default location
PDFJS.workerSrc = (function () {
'use strict';
var scriptTagContainer = document.body ||
document.getElementsByTagName('head')[0];
var pdfjsSrc = scriptTagContainer.lastChild.src;
return pdfjsSrc && pdfjsSrc.replace(/\.js$/i, '.worker.js');
})();
}
| javaopensource2017/devweb | devweb/framework/resources/META-INF/resources/pdf.js/pdf.js | JavaScript | gpl-3.0 | 277,125 |
var searchData=
[
['point',['Point',['../class_point.html',1,'Point'],['../class_point.html#ad92f2337b839a94ce97dcdb439b4325a',1,'Point::Point()'],['../class_point.html#a2eba7d268926b0d1e7fa56b698321652',1,'Point::Point(tuple< double, double > xy)'],['../class_point.html#a78b55e8d5466bb8c2cf60fa55f2562ff',1,'Point::Point(double x, double y)']]],
['polar',['Polar',['../class_polar.html',1,'Polar'],['../class_polar.html#ab83f4c79b87843dcb9d06623a9b86708',1,'Polar::Polar(bool r)'],['../class_polar.html#ac2193c3dbc5e562b1f336952ab282a19',1,'Polar::Polar(double x, double y, double a, bool r)'],['../class_polar.html#a4b8bc748b52c75bfdc80ce22221a19e2',1,'Polar::Polar(tuple< double, double, double > xya, bool r)']]],
['print',['print',['../class_point.html#a76c5855c06d98aed16b5796a9a50bbee',1,'Point::print()'],['../class_point.html#aa0501d08555050d82e94eec05123b969',1,'Point::print(double x, double y)'],['../class_polar.html#aaf0f82f233bbb515ffabe79cd617ac5b',1,'Polar::print() override'],['../class_polar.html#ad56e5966698bcb8ea979c88dc2c10458',1,'Polar::print(double x, double y, double a)'],['../class_vertices.html#a2a7120d2770d86a5b8e8f36b6847d748',1,'Vertices::print()']]]
];
| dpointer80906/polar | doc/html/search/all_3.js | JavaScript | gpl-3.0 | 1,206 |
/*******************************************************************************
* Copyright 2017, 2018 CNES - CENTRE NATIONAL d'ETUDES SPATIALES
*
* This file is part of MIZAR.
*
* MIZAR is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* MIZAR is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with MIZAR. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
import _ from "underscore";
import AbstractRasterLayer from "./AbstractRasterLayer";
import Utils from "../Utils/Utils";
import Constants from "../Utils/Constants";
import HEALPixTiling from "../Tiling/HEALPixTiling";
import CoordinateSystemFactory from "../Crs/CoordinateSystemFactory";
import HipsMetadata from "./HipsMetadata";
/**
* AbstractHipsLayer configuration
* @typedef {AbstractLayer.configuration} AbstractHipsLayer.configuration
* @property {Crs} [coordinateSystem = CoordinateSystemFactory.create({geoideName: Constants.MappingCrsHips2Mizar[this.hipsMetadata.hips_frame]})] - Coordinate reference system
* @property {int} [tilePixelSize = hipsMetadata['hips_tile_width'] - Tiles width in pixels
* @property {int} [baseLevel = 2] - min HiPS order
* @property {HEALPixTiling} [tiling = new HEALPixTiling(options.baseLevel, {coordinateSystem: options.coordinateSystem})] - Tiling
* @property {int} [numberOfLevels = hipsMetadata['hips_order']] - Deepest order min
* @property {string} [name = hipsMetadata['obs_title']] - Data set title
* @property {string} [attribution = <a href=\"" + this.hipsMetadata['obs_copyright_url'] + "\" target=\"_blank\">" + this.hipsMetadata['obs_copyright'] + "</a>"] - URL to a copyright mention
* @property {string} [ack = hipsMetadata['obs_ack']] - Acknowledgment mention
* @property {string} [icon = ""] - icon used as metadata representation on the map
* @property {string} [description = hipsMetadata['obs_description']] - Data set description
* @property {boolean} [visible = false] visibility by default on the map
* @property {Object} properties - other metadata
* @property {float} [properties.initialRa = undefined] - Initial RA
* @property {float} [properties.initialDec = undefined] - Initial DEC
* @property {float} [properties.initialFov = undefined] - Initial field of view
* @property {float} [properties.mocCoverage = undefined] - Sky fraction coverage
* @property {boolean} [pickable = false] - Pickable layer
* @property {Array} [availableServices = {}] - List of services related to the layer
* @property {Array} [format = hipsMetadata['hips_tile_format']] - List of available tile formats
* @property {string} [baseUrl = hipsMetadata['hips_service_url']] - Endpoint service
* @property {string} [category = Image] - Default category
* @property {boolean} background - Tell if the layer is set as background
*/
/**
* @name AbstractHipsLayer
* @class
* Abstract class for HIPS
* @augments AbstractRasterLayer
* @param {HipsMetadata} hipsMetadata
* @param {AbstractHipsLayer.configuration} options - AbstractHipsLayer configuration
* @see {@link http://www.ivoa.net/documents/HiPS/20170406/index.html Hips standard}
* @throws ReferenceError - Some required parameters are missing
* @constructor
*/
var AbstractHipsLayer = function (hipsMetadata, options) {
_checkAndSetDefaultOptions.call(this, options);
this.hipsMetadata = _createMetadata.call(this, hipsMetadata, options.baseUrl);
_overloadHipsMetataByConfiguration.call(this, options, this.hipsMetadata);
options.tiling = new HEALPixTiling(options.baseLevel || 2, {
coordinateSystem: options.coordinateSystem
});
options.icon = options.hasOwnProperty("icon")
? options.icon
: options.mizarBaseUrl
? options.mizarBaseUrl + "css/images/star.png"
: "";
options.visible = options.hasOwnProperty("visible") ? options.visible : false;
options.properties = options.hasOwnProperty("properties") ? options.properties : {};
options.pickable = options.hasOwnProperty("pickable") ? options.pickable : false;
options.services = options.hasOwnProperty("services") ? options.services : {};
options.category = options.hasOwnProperty("category") ? options.category : "Image"; //this.hipsMetadata.client_category;
if (this.hipsMetadata.hasOwnProperty("moc_access_url")) {
options.services.Moc = {
baseUrl: this.hipsMetadata.moc_access_url,
skyFraction: this.hipsMetadata.moc_sky_fraction
};
}
//Hack : set Galactic layer as background because only background owns two grids (equetorial and galactic)
if (options.coordinateSystem.getGeoideName() === Constants.CRS.Galactic) {
options.background = true;
}
AbstractRasterLayer.prototype.constructor.call(this, Constants.LAYER.Hips, options);
this.fitsSupported = _.contains(this.hipsMetadata.hips_tile_format, "fits");
};
/**
* Check options.
* @param options
* @throws ReferenceError - Some required parameters are missing
* @private
*/
function _checkAndSetDefaultOptions(options) {
if (!options) {
throw new ReferenceError("Some required parameters are missing", "AbstractHipsLayer.js");
} else {
options.category = options.category || "Image";
options.pickable = options.pickable || false;
}
}
/**
* Creates metadata.
* @param hipsMetadata
* @param baseUrl
* @returns {*}
* @private
*/
function _createMetadata(hipsMetadata, baseUrl) {
var metadata = hipsMetadata;
if (typeof metadata === "undefined") {
var hipsProperties = new HipsMetadata(baseUrl);
metadata = hipsProperties.getHipsMetadata();
}
return metadata;
}
/**
*
* @param options
* @param hipsMetadata
* @private
*/
function _overloadHipsMetataByConfiguration(options, hipsMetadata) {
options.coordinateSystem = options.hasOwnProperty("coordinateSystem")
? CoordinateSystemFactory.create(options.coordinateSystem)
: CoordinateSystemFactory.create({
geoideName: Constants.MappingCrsHips2Mizar[hipsMetadata.hips_frame]
});
options.tilePixelSize = options.hasOwnProperty("tilePixelSize")
? options.tilePixelSize
: hipsMetadata.hips_tile_width;
options.baseLevel = options.hasOwnProperty("baseLevel")
? options.baseLevel
: hipsMetadata.hasOwnProperty("hips_order_min") && hipsMetadata.hips_order_min >= 2
? parseInt(hipsMetadata.hips_order_min)
: 2;
options.numberOfLevels = options.hasOwnProperty("numberOfLevels")
? options.numberOfLevels
: parseInt(hipsMetadata.hips_order);
options.name = options.hasOwnProperty("name") ? options.name : hipsMetadata.obs_title;
options.attribution = options.hasOwnProperty("attribution")
? options.attribution
: '<a href="' + hipsMetadata.obs_copyright_url + '" target="_blank">' + hipsMetadata.obs_copyright + "</a>";
options.copyrightUrl = options.hasOwnProperty("copyrightUrl") ? options.copyrightUrl : hipsMetadata.obs_copyright_url;
options.ack = options.hasOwnProperty("ack") ? options.ack : hipsMetadata.obs_ack;
options.description = options.hasOwnProperty("description") ? options.description : hipsMetadata.obs_description;
options.format = options.hasOwnProperty("format") ? options.format : hipsMetadata.hips_tile_format;
options.baseUrl = options.hasOwnProperty("baseUrl") ? options.baseUrl : hipsMetadata.hips_service_url;
options.properties = options.hasOwnProperty("properties") ? options.properties : {};
if (hipsMetadata.hasOwnProperty("obs_initial_ra")) {
options.properties.initialRa = parseFloat(hipsMetadata.obs_initial_ra);
}
if (hipsMetadata.hasOwnProperty("obs_initial_dec")) {
options.properties.initialDec = parseFloat(hipsMetadata.obs_initial_dec);
}
if (hipsMetadata.hasOwnProperty("obs_initial_fov")) {
options.properties.initialFov = Math.sqrt(((360 * 360) / Math.PI) * parseFloat(hipsMetadata.obs_initial_fov));
}
if (hipsMetadata.hasOwnProperty("moc_sky_fraction")) {
options.properties.moc_sky_fraction = parseFloat(hipsMetadata.moc_sky_fraction);
}
}
/**************************************************************************************************************/
Utils.inherits(AbstractRasterLayer, AbstractHipsLayer);
/**************************************************************************************************************/
/**
* Returns the Metadata related to Hips protocol.
* @return {Object}
* @memberof AbstractHipsLayer#
*/
AbstractHipsLayer.prototype.getHipsMetadata = function () {
return this.hipsMetadata;
};
export default AbstractHipsLayer;
| MizarWeb/Mizar | src/Layer/AbstractHipsLayer.js | JavaScript | gpl-3.0 | 8,933 |
import React, { Component } from 'react';
import { Link } from 'react-router-dom';
import Thumbnail from 'components/Thumbnail';
/* Import Venue Images */
import Harvard from 'static/images/Harvard.jpg';
import Walters from 'static/images/Walters.jpg';
import Auckland from 'static/images/Auckland.jpg';
import Cooper from 'static/images/Cooper.jpg';
import Finnish from 'static/images/Finnish.jpg';
/* Import Interior Images */
import iHarvard from 'static/images/Harvard_interior.jpg';
import iWalters from 'static/images/Walters_interior.jpg';
import iAuckland from 'static/images/Auckland_interior.jpg';
import iCooper from 'static/images/Cooper_interior.jpg';
import iFinnish from 'static/images/Finnish_interior.jpg';
/*
Build MUSEUMS Array with corresponding Image and Name
The Name will be used as a parameter to search in the FullWorks Page to get
all instances of the work in that venue
*/
const MUSEUMS = [
[Harvard, iHarvard, 'Harvard+Art+Museum'],
[Walters, iWalters, 'The+Walters+Art+Museum'],
[Auckland, iAuckland, 'Auckland+Museum'],
[Cooper, iCooper, 'Cooper+Hewitt,+Smithsonian+Design+Museum'],
[Finnish, iFinnish, 'Finnish+National+Gallery']
];
const PARAMETERS = '&maptype=satellite&zoom=19';
const BASE_URL = 'https://www.google.com/maps/embed/v1/place?key=AIzaSyAEh4yg0EoQBAqs3ieHnEPCD_ENLeYKUwM&q=';
class Venue extends Component {
constructor() {
super();
this.state = { venue: [], works: [] };
this.museum_url = '';
this.imuseum_url = '';
this.map_location = '';
this.museum_name = '';
}
/* Fetches the data from our database and parses it accordingly */
componentDidMount() {
const venue_id = parseInt(this.props.match.params.number, 10)
if(1 <= venue_id && venue_id <= 5) {
const museum = MUSEUMS[venue_id - 1]
this.museum_url = museum[0];
this.imuseum_url = museum[1];
this.museum_name = museum[2];
}
fetch(`http://api.museumary.me/venue/` + venue_id)
.then(result=>result.json())
.then(venue=> {
this.setState({ venue })
let add = [
// Format Street if there is one, empty otherwise
venue.street ? venue.street.replace(/ /g, '+') : '',
venue.city,
venue.country
];
this.map_location = BASE_URL + add.join(',') + PARAMETERS;
for (let i = 0; i < 4; i++) {
fetch('http://api.museumary.me/work/' + venue.work_ids[i])
.then(result => result.json())
.then(responseJson => this.setState({works: this.state.works.concat([responseJson])}))
}
})
}
render() {
var venue_obj = this.state.venue;
var work_list = this.state.works;
if(venue_obj && work_list && work_list.length > 0){
// Do all React code within this div. 'Venue_obj' is the object that
// associated with this Venue page, you should be able to access it
// like any other JSON
// Create 4 Work Thumbnails
let works = work_list.map(function(obj) {
obj.url = '/works/' + obj.id;
obj.name = obj.name.substring(0, 25) + (obj.name.length > 25 ? '...': '')
obj.details = [obj.name, 'N/A', 'N/A'];
return <Thumbnail key={obj.id} {...obj} />;
})
return (
<div className="Venue">
{/* Venue Name and Base / Interior Images */}
<h1>{venue_obj.name}</h1>
<div className="container">
<div className="row">
<div className="col-md-6">
<img src={ this.museum_url } alt="Harvard" className="img-rounded" width="500" height="300"/>
</div>
<div className="col-md-6">
<img src={ this.imuseum_url } alt="Harvard Interior" className="img-rounded" width="500" height="300"/>
</div>
</div>
</div>
{/* 4 Works Gallery and link to FullPage */}
<Link to={'/works?venue='+this.museum_name}><h2><strong>Gallery of Works</strong></h2></Link><br/>
<div className="container">
<div className="row">
{works}
</div>
</div>
<br />
{/* Map */}
<iframe width="800" height="600" frameBorder="0" src={ this.map_location } allowFullScreen align="center"></iframe><br/>
<p><strong>Address:</strong> {venue_obj.street} {venue_obj.city} {venue_obj.country}</p><br/><br/>
</div>
);
}
else {
return <div className="Venue"></div>;
}
}
}
export default Venue;
| museumary/Museumary | react/src/components/Models/SinglePages/Venue.js | JavaScript | gpl-3.0 | 5,180 |
import express from 'express';
import mongoose from 'mongoose';
import { Text } from '../../data/model';
const router = express.Router();
router.get('/', (req, res) => {
function getAnnotationTypeForTrainingset() {
if (req.query.annotationType) {
const annotationTypeId = mongoose.Types.ObjectId(req.query.annotationType);
return req.set.getAnnotationTypeById(annotationTypeId);
}
return req.set.getFirstAnnotationType();
}
const page = parseInt(req.query.page) || 1;
const amount = parseInt(req.query.amount) || 200;
const annotationType = getAnnotationTypeForTrainingset();
Text.find({ setId: req.set._id })
.skip((page - 1) * amount)
.limit(amount)
.cursor()
.map(text => text.mapAnnotationStatusWithOptionName(req.set, annotationType))
.on('cursor', () => { res.write('['); })
.on('data', (() => {
let index = 0;
res.setHeader('Content-Type', 'application/json');
return text => res.write((!(index++) ? '' : ',') + JSON.stringify(text));
})())
.on('end', () => { res.write(']\n'); res.end(); });
});
export default router;
| annomania/annomania-api | src/controller/route/trainingset.js | JavaScript | gpl-3.0 | 1,118 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.