text
stringlengths 2
6.14k
|
|---|
var fs = require('fs'),
path = require('path');
var gui = require('nw.gui');
function dirTree(filename) {
var stats = fs.lstatSync(filename),
info = {
title: path.basename(filename),
key: filename,
path: filename,
name: path.basename(filename)
};
if (stats.isDirectory()) {
info.type = "folder";
info.children = fs.readdirSync(filename).map(function (child) {
return dirTree(filename + '\\' + child);
});
} else {
// Assuming it's a file. In real life it could be a symlink or
// something else!
info.type = "file";
}
return info;
}
$(function () {
window.editorCreated = 0;
$("textarea").sceditor({
plugins: "xhtml",
style: "minified/jquery.sceditor.default.min.css"
});
$("#folderSelector").on("change", function () {
var files = $(this)[0].files;
$("#currentWorkingFolder").val(files[0].path);
var pwd = files[0].path;
var dirJson = JSON.stringify(dirTree(pwd));
var arr = getTreeFromJson(dirJson);
loadFullTree(arr);
});
$("#currentWorkingFolder").prop("readonly", true);
$("#divEditor").addClass('disabledbutton');
function Menu(cutLabel, copyLabel, pasteLabel) {
var gui = require('nw.gui')
, menu = new gui.Menu()
, cut = new gui.MenuItem({
label: cutLabel || "Cut"
, click: function () {
document.execCommand("cut");
console.log('Menu:', 'cutted to clipboard');
}
})
, copy = new gui.MenuItem({
label: copyLabel || "Copy"
, click: function () {
document.execCommand("copy");
console.log('Menu:', 'copied to clipboard');
}
})
, paste = new gui.MenuItem({
label: pasteLabel || "Paste"
, click: function () {
document.execCommand("paste");
console.log('Menu:', 'pasted to textarea');
}
})
;
menu.append(cut);
menu.append(copy);
menu.append(paste);
return menu;
}
var menu = new Menu(/* pass cut, copy, paste labels if you need i18n*/);
$(document).on("contextmenu", function (e) {
e.preventDefault();
menu.popup(e.originalEvent.x, e.originalEvent.y);
});
});
function loadFullTree(tree) {
try {
var tree1 = $("#treeDiv").fancytree('getTree');
tree1.reload(tree);
} catch (ex) {
$("#treeDiv").fancytree({
source: tree,
click: function (event, data) {
//console.log(data.node.title);
window.currFileName = data.node.key;
if (data.node.key.endsWith('.html') || (data.node.key.endsWith('.htm'))) {
$("#divEditor").removeClass('disabledbutton');
loadFileIntoEditor(window.currFileName);
} else {
$("#divEditor").addClass('disabledbutton');
}
}
});
}
}
function loadFileIntoEditor(filename) {
fs.readFile(filename, 'utf8', function (err, htmlData) {
if (err) {
return console.log(err);
}
var bodyStr = htmlData.replace(/^[\s\S]*<body.*?>|<\/body>[\s\S]*$/g, '');
$("textarea").sceditor('instance')[0].insert(bodyStr);
var iframe = document.getElementsByTagName("iframe")[0];
$(iframe).attr('sandbox', 'allow-scripts allow-same-origin');
$(iframe).attr('nwdisable', '');
var iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
var iframeDocHead = iframeDocument.getElementsByTagName('head')[0];
var currHeadVal = $(iframeDocHead).val();
var newHeadVal = currHeadVal + '<script type="text/x-mathjax-config">MathJax.Hub.Config({tex2jax: {inlineMath: [[\'$\',\'$\'], [\'\\\\(\',\'\\\\)\']]}});</script><script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>';
$(iframeDocHead).val(newHeadVal);
});
}
String.prototype.endsWith = function (suffix) {
return this.indexOf(suffix, this.length - suffix.length) !== -1;
};
function getTreeFromJson(json) {
// preserve newlines, etc - use valid JSON
json = json.replace(/\\n/g, "\\n")
.replace(/\\'/g, "\\'")
.replace(/\\"/g, '\\"')
.replace(/\\&/g, "\\&")
.replace(/\\r/g, "\\r")
.replace(/\\t/g, "\\t")
.replace(/\\b/g, "\\b")
.replace(/\\f/g, "\\f");
// remove non-printable and other non-valid JSON chars
json = json.replace(/[\u0000-\u0019]+/g, "");
//console.log(json);
var arr = JSON.parse(json);
return arr;
}
function saveIframeContents() {
var iframe = document.getElementsByTagName("iframe")[0];
var iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
var iframeHtml = iframeDocument.getElementsByTagName('html')[0];
var bodyHtml = iframeHtml.getElementsByTagName('body')[0];
$(bodyHtml).removeAttr('contenteditable');
$(bodyHtml).removeAttr('dir');
var str = $(iframeHtml).prop('outerHTML');
var stream = fs.createWriteStream(window.currFileName);
stream.once('open', function(fd) {
stream.end(str);
});
loadFileIntoEditor(window.currFileName);
}
function getDirectories(srcpath) {
return fs.readdirSync(srcpath).filter(function (file) {
return fs.statSync(path.join(srcpath, file)).isDirectory();
});
}
|
/* global module */
/**
* Created by chriscai on 2015/1/23.
*/
var fs = require('fs');
var connect = require('connect'),
log4js = require('log4js'),
logger = log4js.getLogger();
var path = require("path");
var dbPath = path.join(__dirname , ".." , "project.db");
var ProjectService = function(clusters) {
var dispatchCluster = function(data) {
for (var i = 0; i < clusters.length; i++) {
clusters[i].send(data);
}
};
connect()
.use('/getProjects', connect.query())
.use('/getProjects', connect.bodyParser())
.use('/getProjects', function(req, res) {
var param = req.query;
if (req.method === "POST") {
param = req.body;
}
if (param.auth != "badjsAccepter" || !param.projectsInfo) {
} else {
dispatchCluster({
projectsInfo: param.projectsInfo
});
fs.writeFile(dbPath, param.projectsInfo || "", function() {
logger.info('update project.db :' + param.projectsInfo);
});
}
res.writeHead(200);
res.end();
})
.listen(9001);
var info = fs.readFileSync(dbPath, "utf-8");
dispatchCluster({
projectsInfo: info
});
logger.info('load project.db :' + info);
};
module.exports = ProjectService;
|
var config = module.exports = {};
//app
config.app = {};
config.app.port = 3000;
//mongodb
config.mongo = {};
config.mongo.uri = '127.0.0.1';
config.mongo.db = 'movies';
|
'use strict';
angular.module('adminApp')
.controller('StudentReportCtrl', function ($scope, QueryService) {
$scope.query = {
grade: 'all'
};
$scope.refreshView = function() {
var p = {};
if ($scope.query.grade != 'all') {
p.grade = $scope.query.grade;
}
QueryService.student.query('', 'detail', p, function(results) {
$scope.students = results;
});
};
$scope.refreshView();
$scope.export = function() {
window.open(QueryService.student.urlFor($routeParams.grade, 'export'));
};
});
|
/**
* @version $Id$
* Kunena Component
* @package Kunena
*
* @Copyright (C) 2008 - 2011 Kunena Team. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
* @link http://www.kunena.org
**/
window.addEvent('domready', function() {
function insert_text(textString,nb)
{
var polltexthelp = document.id('kpoll-text-help');
//Remove the content of the html tag <p></p> before to add something else
//i don't know if it's possible to use something else than innerHTML() function for do this purpose
polltexthelp.innerHTML='';
var newinfo = document.createElement("p");
newinfo.setAttribute('id','kpoll-text-infos');
var image = document.createElement("img");
if(nb == '1'){
image.setAttribute('src',KUNENA_ICON_ERROR);
texte = document.createTextNode(' '+textString);
}else {
image.setAttribute('src',KUNENA_ICON_INFO);
texte = document.createTextNode(' '+textString);
}
polltexthelp.appendChild(newinfo);
newinfo.appendChild(image);
newinfo.appendChild(texte);
}
if(document.id('kpoll-form-vote') != undefined) {
document.id('kpoll-form-vote').addEvent('submit', function(e) {
var jsonurl = document.id('kpollvotejsonurl').getProperty('value');
document.id('kpoll-form-vote').setProperty('action',jsonurl);
//Prevents the default submit event from loading a new page.
e.stop();
var datano = '0';
$$('.kpoll-boxvote').each(function(el){
if(el.checked==true){
datano = "1";
}
});
if(datano == "0") {
var nbimages = '1';
insert_text(KUNENA_POLL_SAVE_ALERT_ERROR_NOT_CHECK,nbimages);
} else {
//Set the options of the form's Request handler.
//("this" refers to the document.id('myForm') element).
this.set('send', {onComplete: function(response) {
var json = JSON.decode(response);
var nb = '0';
if(json.results == '1'){
insert_text(KUNENA_POLL_SAVE_ALERT_OK,nb);
} else if(json.results == '2') {
nb = '1';
insert_text(KUNENA_POLL_CANNOT_VOTE_NEW_TIME,nb);
} else if(json.results == '3') {
nb = '1';
insert_text(KUNENA_POLL_WAIT_BEFORE_VOTE,nb);
}
}});
//Send the form.
this.send();
}
});
}
});
|
// PreMeFi - A MetaFilter viewer for Palm's WebOS
// Copyright (C) 2011 Gaelan D'costa <gdcosta@gmail.com>
//
// 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 of the License, 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 this program. If not, see <http://www.gnu.org/licenses/>.
/**
* @constructor
*
* @param {String} feedTitle
* Free-text title of feed
* @param {String} feedURL
* URL for feed (RSS, not associated web page)
*/
function MetaFeed(feedTitle, feedURL) {
/** Feed Title */
this.m_title = feedTitle;
/** Feed URL */
this.m_url = feedURL;
/** List of stories in feed. Note that stories should be stored
* in reverse chronological order.
*/
this.m_list = [];
}
/**
* Asychronously request the latest feed data from the feed URL.
*/
MetaFeed.prototype.update = function() {
Mojo.Controller.getAppController().sendToNotificationChain({
updating : true
});
var request = new Ajax.Request(this.m_url, {
method : "get",
onSuccess : this.updateSuccess.bind(this),
onFailure : this.updateFailure.bind(this)
});
};
/**
* Ajax.Request failure handler
*
* @param {Ajax.Response} transport response object
*/
MetaFeed.prototype.updateFailure = function(transport) {
Mojo.Controller.getAppController().sendToNotificationChain({
updating : false
});
Mojo.Log.warn("Our update failed :(");
};
/**
* Ajax.Request success handler
*
* @param {Ajax.Response} transport response object
*/
MetaFeed.prototype.updateSuccess = function(transport) {
// Ensure that this is an RSS feed, even if not automatically parsed as one
var xml_text = new DOMParser().parseFromString(transport.responseText,
"text/xml");
if (xml_text.getElementsByTagName("rss").length === 0) {
Mojo.Log.warn("We did not get a valid RSS feed!");
} else {
var new_list = FeedProcessor.processRSS(xml_text);
this.merge(new_list);
//this.m_list = FeedProcessor.processRSS(xml_text);
}
Mojo.Controller.getAppController().sendToNotificationChain({
updating : false
});
MetaFeedList.save(MetaFeedList.depot);
};
/**
* Feed title getter
* @returns Feed title
* @type String
*/
MetaFeed.prototype.get_title = function() {
return this.m_title;
};
/**
* Merge processed RSS list into feed object.
* @param {MetaFeed} new_list List to merge into feed.
*/
MetaFeed.prototype.merge = function(new_list) {
// The lists are in reverse chronological order, but we want
// to iterate such that earlier entries are added before later
// entries (if they aren't already on the feed)
new_list.reverse();
for(var i = 0; i < new_list.length; i++) {
var new_feed = new_list[i];
var matched = false;
for(var j = 0; j < this.m_list.length; j++) {
var old_feed = this.m_list[j];
if(old_feed.m_guid === new_feed.m_guid) {
matched = true;
}
}
if(matched === false) {
this.m_list.unshift(new_list[i]);
}
}
};
/**
* Create a MetaFeed object from a JSON-compliant structure
* @param {Object} JSON-compliant source object
* @returns {MetaFeed} The resulting MetaFeed populated with information from the JSON object
*/
MetaFeed.fromJSON = function (object) {
var feed = new MetaFeed(object.title, object.url);
for(var i = 0; i < object.items.length; ++i) {
var entry = MetaEntry.fromJSON(object.items[i]);
feed.m_list.push(entry);
}
return feed;
};
/**
* Create a JSON structure from a MetaFeed
* @returns {Object} a JSON-structure containing the feed's data
*/
MetaFeed.prototype.toJSONObject = function() {
var object = {};
object.title = this.m_title;
object.url = this.m_url;
object.items = [];
for(var i = 0; i < this.m_list.length; i++) {
object.items.push(this.m_list[i].toJSONObject());
}
return object;
};
/**
* Returns a JSON string from a MetaFeed
* @returns {String} A JSON object
*/
MetaFeed.prototype.toJSON = function() {
return Object.toJSON(this.toJSONObject());
};
|
var Input = function(player)
{
this.currentlyPressedKeys = {};
this.player = player
}
Input.prototype.handleKeyDown = function(event)
{
this.currentlyPressedKeys[event.keyCode] = true;
}
Input.prototype.handleKeyUp = function(event)
{
this.currentlyPressedKeys[event.keyCode] = false;
}
Input.prototype.attachKeyDown = function()
{
var self = this;
document.onkeydown = function(event) { self.handleKeyDown(event); }
}
Input.prototype.attachKeyUp = function()
{
var self = this;
document.onkeyup = function(event) { self.handleKeyUp(event); }
}
Input.prototype.handleKeys = function()
{
if (this.currentlyPressedKeys[KeyEvent.DOM_VK_W])
{
this.player.accelerete(0.003);
}
if (this.currentlyPressedKeys[KeyEvent.DOM_VK_S])
{
this.player.accelerete(-0.003);
}
if (this.currentlyPressedKeys[KeyEvent.DOM_VK_PAGE_UP])
{
}
if (this.currentlyPressedKeys[KeyEvent.DOM_VK_PAGE_DOWN])
{
}
if (this.currentlyPressedKeys[KeyEvent.DOM_VK_LEFT])
{
this.player.changeYaw(-3.0);
}
if (this.currentlyPressedKeys[KeyEvent.DOM_VK_RIGHT])
{
this.player.changeYaw(3.0);
}
if (this.currentlyPressedKeys[KeyEvent.DOM_VK_UP])
{
this.player.changePitch(3.0);
}
if (this.currentlyPressedKeys[KeyEvent.DOM_VK_DOWN])
{
this.player.changePitch(-3.0);
}
}
if (typeof KeyEvent == "undefined") {
var KeyEvent = {
DOM_VK_CANCEL: 3,
DOM_VK_HELP: 6,
DOM_VK_BACK_SPACE: 8,
DOM_VK_TAB: 9,
DOM_VK_CLEAR: 12,
DOM_VK_RETURN: 13,
DOM_VK_ENTER: 14,
DOM_VK_SHIFT: 16,
DOM_VK_CONTROL: 17,
DOM_VK_ALT: 18,
DOM_VK_PAUSE: 19,
DOM_VK_CAPS_LOCK: 20,
DOM_VK_ESCAPE: 27,
DOM_VK_SPACE: 32,
DOM_VK_PAGE_UP: 33,
DOM_VK_PAGE_DOWN: 34,
DOM_VK_END: 35,
DOM_VK_HOME: 36,
DOM_VK_LEFT: 37,
DOM_VK_UP: 38,
DOM_VK_RIGHT: 39,
DOM_VK_DOWN: 40,
DOM_VK_PRINTSCREEN: 44,
DOM_VK_INSERT: 45,
DOM_VK_DELETE: 46,
DOM_VK_0: 48,
DOM_VK_1: 49,
DOM_VK_2: 50,
DOM_VK_3: 51,
DOM_VK_4: 52,
DOM_VK_5: 53,
DOM_VK_6: 54,
DOM_VK_7: 55,
DOM_VK_8: 56,
DOM_VK_9: 57,
DOM_VK_SEMICOLON: 59,
DOM_VK_EQUALS: 61,
DOM_VK_A: 65,
DOM_VK_B: 66,
DOM_VK_C: 67,
DOM_VK_D: 68,
DOM_VK_E: 69,
DOM_VK_F: 70,
DOM_VK_G: 71,
DOM_VK_H: 72,
DOM_VK_I: 73,
DOM_VK_J: 74,
DOM_VK_K: 75,
DOM_VK_L: 76,
DOM_VK_M: 77,
DOM_VK_N: 78,
DOM_VK_O: 79,
DOM_VK_P: 80,
DOM_VK_Q: 81,
DOM_VK_R: 82,
DOM_VK_S: 83,
DOM_VK_T: 84,
DOM_VK_U: 85,
DOM_VK_V: 86,
DOM_VK_W: 87,
DOM_VK_X: 88,
DOM_VK_Y: 89,
DOM_VK_Z: 90,
DOM_VK_CONTEXT_MENU: 93,
DOM_VK_NUMPAD0: 96,
DOM_VK_NUMPAD1: 97,
DOM_VK_NUMPAD2: 98,
DOM_VK_NUMPAD3: 99,
DOM_VK_NUMPAD4: 100,
DOM_VK_NUMPAD5: 101,
DOM_VK_NUMPAD6: 102,
DOM_VK_NUMPAD7: 103,
DOM_VK_NUMPAD8: 104,
DOM_VK_NUMPAD9: 105,
DOM_VK_MULTIPLY: 106,
DOM_VK_ADD: 107,
DOM_VK_SEPARATOR: 108,
DOM_VK_SUBTRACT: 109,
DOM_VK_DECIMAL: 110,
DOM_VK_DIVIDE: 111,
DOM_VK_F1: 112,
DOM_VK_F2: 113,
DOM_VK_F3: 114,
DOM_VK_F4: 115,
DOM_VK_F5: 116,
DOM_VK_F6: 117,
DOM_VK_F7: 118,
DOM_VK_F8: 119,
DOM_VK_F9: 120,
DOM_VK_F10: 121,
DOM_VK_F11: 122,
DOM_VK_F12: 123,
DOM_VK_F13: 124,
DOM_VK_F14: 125,
DOM_VK_F15: 126,
DOM_VK_F16: 127,
DOM_VK_F17: 128,
DOM_VK_F18: 129,
DOM_VK_F19: 130,
DOM_VK_F20: 131,
DOM_VK_F21: 132,
DOM_VK_F22: 133,
DOM_VK_F23: 134,
DOM_VK_F24: 135,
DOM_VK_NUM_LOCK: 144,
DOM_VK_SCROLL_LOCK: 145,
DOM_VK_COMMA: 188,
DOM_VK_PERIOD: 190,
DOM_VK_SLASH: 191,
DOM_VK_BACK_QUOTE: 192,
DOM_VK_OPEN_BRACKET: 219,
DOM_VK_BACK_SLASH: 220,
DOM_VK_CLOSE_BRACKET: 221,
DOM_VK_QUOTE: 222,
DOM_VK_META: 224
};
}
|
(function($) {
/**
* Attach this editor to a target element.
*/
Drupal.wysiwyg.editor.attach.nicedit = function(context, params, settings) {
// Intercept and ignore submit handlers or they will revert changes made
// since the instance was removed. The handlers are anonymous and hidden out
// of scope in a closure so we can't unbind them. The same operations are
// performed when the instance is detached anyway.
var oldAddEvent = bkLib.addEvent;
bkLib.addEvent = function(obj, type, fn) {
if (type != 'submit') {
oldAddEvent(obj, type, fn);
}
}
// Attach editor.
var editor = new nicEditor(settings);
editor.panelInstance(params.field);
// The old addEvent() must be restored after creating a new instance, as
// plugins with dialogs use it to bind submit handlers to their forms.
bkLib.addEvent = oldAddEvent;
editor.addEvent('focus', function () {
Drupal.wysiwyg.activeId = params.field;
});
};
/**
* Detach a single editor instance.
*/
Drupal.wysiwyg.editor.detach.nicedit = function (context, params, trigger) {
var instance = nicEditors.findEditor(params.field);
if (!instance) {
return;
}
if (trigger === 'serialize') {
instance.saveContent();
}
else {
instance.ne.removeInstance(params.field);
instance.ne.removePanel();
}
};
/**
* Check if a DOM node is inside another or if they are the same.
*/
function isInside (innerNode, outerNode) {
var found = false;
if (innerNode === outerNode) {
return true;
}
$(innerNode).parents().each(function (index, parent) {
if (parent === outerNode) {
found = true;
return false;
}
});
return found;
}
/**
* Instance methods for nicEdit.
*/
Drupal.wysiwyg.editor.instance.nicedit = {
insert: function (content) {
var instance = nicEditors.findEditor(this.field),
editingArea = instance.getElm(),
sel = instance.getSel(), range;
// IE.
if (document.selection) {
range = sel.createRange();
// If the caret is not in the editing area, just append the content.
if (!isInside(range.parentElement(), editingArea)) {
editingArea.innerHTML += content;
}
else {
// Insert content and set the caret after it.
range.pasteHTML(content);
range.select();
range.collapse(false);
}
}
else {
// The code below doesn't work in IE, but it never gets here.
// Convert selection to a range.
// W3C compatible.
if (sel.getRangeAt) {
if (sel.rangeCount > 0) {
range = sel.getRangeAt(0);
}
}
// Safari.
else {
range = editingArea.ownerDocument.createRange();
range.setStart(sel.anchorNode, sel.anchorOffset);
range.setEnd(sel.focusNode, userSeletion.focusOffset);
}
// If the caret is not in the editing area, just append the content.
if (sel.rangeCount == 0 || !isInside(range.commonAncestorContainer, editingArea)) {
editingArea.innerHTML += content;
return;
}
var fragment = editingArea.ownerDocument.createDocumentFragment();
// Fragments don't support innerHTML.
var wrapper = editingArea.ownerDocument.createElement('div');
wrapper.innerHTML = content;
while (wrapper.firstChild) {
fragment.appendChild(wrapper.firstChild);
}
// Append a temporary node to control caret position.
var tn = editingArea.ownerDocument.createElement('span');
fragment.appendChild(tn);
range.deleteContents();
// Only fragment children are inserted.
range.insertNode(fragment);
// Move caret to temp node and remove it.
range.setStartBefore(tn);
range.setEndBefore(tn);
sel.removeAllRanges();
sel.addRange(range);
tn.parentNode.removeChild(tn);
}
},
setContent: function (content) {
nicEditors.findEditor(this.field).setContent(content);
},
getContent: function () {
return nicEditors.findEditor(this.field).getContent();
}
};
})(jQuery);
|
'use strict';
var hp = require('../modules/hyperpin');
var error = require('../modules/error');
var logger = require('winston');
exports.actions = function(req, res, ss) {
req.use('session');
require('../modules/announce').registerSocketStream(ss);
return {
/**
* Inserts a coin into the pinball machine.
* @param slot Which slot, 1 or 2
*/
insertCoin: function(slot) {
// access control
if (!req.session.userId) return res(error.unauthorized());
logger.log('info', '[rpc] [control] Inserting coin into slot %s by %s', slot, req.session.user.user);
hp.insertCoin(req.session.user, slot, function(err, result) {
if (err) {
logger.log('error', '[rpc] [hyperpin] [sync] %s', err);
res(error.api(err));
} else {
res(result);
}
});
}
};
};
|
z=fac(y)
|
function ShowHelp_Toggle(id)
{
$("#button1, #button2").css("background-color", "");
$("#" + id).css("background-color", "#92e4ff");
$("#usage, #about").hide();
if (id == "button1")
$("#usage").show();
else if (id == "button2")
$("#about").show();
CommonLib_RefreshTableStyle();
}
function ShowHelp_PageReady()
{
$("#button2").css("background-color", "");
$("#button1").css("background-color", "#92e4ff");
$("#about").hide();
CommonLib_RefreshTableStyle();
}
|
/* ===================================================
* popover-extra-placements.js v0.1
* http://twitter.github.com/bootstrap-popover-extra-placements
* ===================================================
* Copyright 2012 Daniel Kleehammer
*
* 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.
* ========================================================== */
(function($) {
"use strict"; // jshint;_;
// save the original plugin function object
var _super = $.fn.popover;
// create a new constructor
var Popover = function(element, options) {
_super.Constructor.apply(this, arguments);
};
// extend prototypes and create a super function
Popover.prototype = $.extend({}, _super.Constructor.prototype, {
constructor: Popover,
_super: function() {
var args = $.makeArray(arguments);
_super.Constructor.prototype[args.shift()].apply(this, args);
},
show: function() {
var $tip, inside, pos, actualWidth, actualHeight, placement, tp, e = $.Event('show');
if (this.hasContent && this.enabled) {
this.$element.trigger(e);
$tip = this.tip();
this.setContent();
if (this.options.animation) {
$tip.addClass('fade');
}
placement = typeof this.options.placement == 'function' ?
this.options.placement.call(this, $tip[0], this.$element[0]) :
this.options.placement;
inside = /in/.test(placement);
$tip
.remove()
.css({ top: 0, left: 0, display: 'block' })
.appendTo(inside ? this.$element : document.body);
pos = this.getPosition(inside);
actualWidth = $tip[0].offsetWidth;
actualHeight = $tip[0].offsetHeight;
switch (inside ? placement.split(' ')[1] : placement) {
case 'bottom':
tp = {top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2};
break;
case 'top':
tp = {top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2};
break;
case 'left':
tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth};
break;
case 'right':
tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width};
break;
// extend placements (top)
case 'topLeft':
tp = {top: pos.top - actualHeight, left: pos.left + pos.width / 2 - (actualWidth * .20)};
break;
case 'topRight':
tp = {top: pos.top - actualHeight, left: pos.left + pos.width / 2 - (actualWidth * .80)};
break;
// extend placements (right)
case 'rightTop':
tp = {top: pos.top + pos.height / 2 - (actualHeight *.20), left: pos.left + pos.width};
break;
case 'rightBottom':
tp = {top: pos.top + pos.height / 2 - (actualHeight * .80), left: pos.left + pos.width};
break;
// extend placements (bottom)
case 'bottomLeft':
tp = {top: pos.top + pos.height, left: pos.left + pos.width / 2 - (actualWidth * .20)};
break;
case 'bottomRight':
tp = {top: pos.top + pos.height, left: pos.left + pos.width / 2 - (actualWidth * .80)};
break;
// extend placements (left)
case 'leftTop':
tp = {top: pos.top + pos.height / 2 - (actualHeight *.20), left: pos.left - actualWidth};
break;
case 'leftBottom':
tp = {top: pos.top + pos.height / 2 - (actualHeight * .80), left: pos.left - actualWidth};
break;
}
$tip
.css(tp)
.addClass(placement)
.addClass('in');
this.$element.trigger('shown');
}
}
});
$.fn.popover = $.extend(function (option) {
return this.each(function () {
var $this = $(this)
, data = $this.data('bs.popover')
, options = typeof option == 'object' && option;
if (!data) $this.data('bs.popover', (data = new Popover(this, options)));
if (typeof option == 'string') data[option]();
});
}, _super);
})(jQuery);
|
'use strict';
let path = require('path');
let defaultSettings = require('./defaults');
// Additional npm or bower modules to include in builds
// Add all foreign plugins you may need into this array
// @example:
// let npmBase = path.join(__dirname, '../node_modules');
// let additionalPaths = [ path.join(npmBase, 'react-bootstrap') ];
let additionalPaths = [];
module.exports = {
additionalPaths: additionalPaths,
port: defaultSettings.port,
debug: true,
devtool: 'eval',
output: {
path: path.join(__dirname, '/../dist/assets'),
filename: 'app.js',
publicPath: defaultSettings.publicPath
},
devServer: {
contentBase: './src/',
historyApiFallback: true,
hot: true,
port: defaultSettings.port,
publicPath: defaultSettings.publicPath,
noInfo: false
},
resolve: {
extensions: ['', '.js', '.jsx', '.json'],
alias: {
api: `${defaultSettings.srcPath}/api/`,
components: `${defaultSettings.srcPath}/components/`,
containers: `${defaultSettings.srcPath}/containers/`,
constants: `${defaultSettings.srcPath}/constants/`,
stores: `${defaultSettings.srcPath}/stores/`,
styles: `${defaultSettings.srcPath}/styles/`,
config: `${defaultSettings.srcPath}/config/` + process.env.REACT_WEBPACK_ENV
}
},
module: {}
};
|
/*----------------------------------------------------------------------------*\
DIVIDER SHORTCODE
\*----------------------------------------------------------------------------*/
( function( $ ) {
"use strict";
function init_shortcode( $divider ) {
$divider.trigger( 'mpc.inited' );
}
if ( typeof window.InlineShortcodeView != 'undefined' ) {
window.InlineShortcodeView_mpc_divider = window.InlineShortcodeView.extend( {
rendered: function() {
var $divider = this.$el.find( '.mpc-divider' );
$divider.addClass( 'mpc-waypoint--init' );
_mpc_vars.$body.trigger( 'mpc.icon-loaded', [ $divider ] );
_mpc_vars.$body.trigger( 'mpc.font-loaded', [ $divider ] );
_mpc_vars.$body.trigger( 'mpc.inited', [ $divider ] );
init_shortcode( $divider );
window.InlineShortcodeView_mpc_divider.__super__.rendered.call( this );
},
} );
}
var $dividers = $( '.mpc-divider' );
$dividers.each( function() {
var $divider = $( this );
$divider.one( 'mpc.init', function () {
init_shortcode( $divider );
} );
} );
} )( jQuery );
|
/*
* Copyright (C) 2014 rafa
*
* 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
* of the License, 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 this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
var productoControl = function (strClase) {
this.clase = strClase;
};
productoControl.prototype = new control('producto');
productoControl.prototype.getClassNameProducto = function () {
return this.getClassName() + "Control";
};
var oProductoControl = new productoControl('producto');
productoControl.prototype.upload = function (place, id, oModel, oView) {
var thisObject = this;
$(place).empty();
$(place).append(oView.getPanel("Subir una imagen" , oView.getEmptyView("imagen","unwrappered")));
var oDocumentoModel = oModel;
oDocumentoModel.loadAggregateViewOne(id);
oView.loadFormValues(oDocumentoModel.getCachedOne(), oDocumentoModel.getCachedFieldNames());
};
productoControl.prototype.new = function (place, objParams, oModel, oView) {
var thisObject = this;
$(place).empty();
$(place).append(oView.getPanel("Alta de " + this.clase, oView.getEmptyForm()));
//id must not be enabled
$('#id').val('0').attr("disabled", true);
if (objParams) {
//soporte de claves ajenas
var selector = objParams["systemfilter"].replace('id_', 'obj_');
$('#' + selector + "_id").val(objParams["systemfiltervalue"]).attr("disabled", true);
$('#' + selector + "_button").attr("disabled", true).hide();
var oModelo = "o" + objParams["systemfilter"].replace('id_', '').charAt(0).toUpperCase() + objParams["systemfilter"].replace('id_', '').slice(1) + "Model";
$('#' + selector + '_desc').text(decodeURIComponent(window[oModelo].getMeAsAForeignKey(objParams["systemfiltervalue"])));
//--
}
oView.doEventsLoading();
//$('#submitForm').unbind('click');
//$('#submitForm').click(function () {
oView.okValidation(function (e) {
resultado = oModel.setOne({json: JSON.stringify(oView.getFormValues())});
oView.doResultOperationNotifyToUser(place, resultado["status"], "Se ha creado el registro con id=" + resultado["message"], resultado["message"], true);
e.preventDefault();
return false;
});
//});
};
productoControl.prototype.carrito = function (place, id, oModel, oView) {
var thisObject = this;
$(place).empty();
$(place).append(oView.getPanel("Edición de " + this.clase, oView.getEmptyView("carrito","unwrappered")));
//$('#id').attr("disabled", true);
//oView.doEventsLoading();
//$('#submitForm').unbind('click');
//$('#submitForm').click(function () {
// oView.okValidation(function (e) {
// resultado = oModel.setOne({json: JSON.stringify(oView.getFormValuesImagen())});
// oView.doResultOperationNotifyToUser(place, resultado["status"], "Se ha actualizado el registro con id=" + resultado["message"], resultado["message"], true);
// e.preventDefault();
// return false;
// });
//});
};
|
// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults
// Purpose - Required for updating UI daemon configuration page.
// Version - unexported version
// Date - 12 Jun 2008
function refreshNow()
{
// Delay before refreshing to ensure
// the shutdown sequence done.
setTimeout( "refresh()", 1000 );
}
function refreshDelay()
{
// Delay a little longer before refreshing
// to ensure bootup sequence is done.
setTimeout( "refresh()", 4000 )
}
function refresh()
{
window.location.reload( true );
}
|
(function ($) {
jQuery(document).on('click', '.bf_add_files a', function (event) {
var $el = $(this);
// BuddyForms gallery file uploads
var buddyforms_gallery_frame;
var $image_gallery_ids = $('#' + $el.data('slug'));
var bf_files = $('#bf_files_container_' + $el.data('slug') + ' ul.bf_files');
var attachment_ids = $image_gallery_ids.val();
event.preventDefault();
// If the media frame already exists, reopen it.
if (buddyforms_gallery_frame) {
buddyforms_gallery_frame.open();
return;
}
// Create the media frame.
buddyforms_gallery_frame = wp.media.frames.buddyfoms_gallery = wp.media({
// Set the title of the modal.
title: $el.data('choose'),
button: {
text: $el.data('update'),
},
library: {
type: $el.data('library_type'),
},
multiple: $el.data('multiple'),
});
if ($el.data('type'))
buddyforms_gallery_frame.uploader.options.uploader['params']['allowed_type'] = $el.data('allowed_type');
// When an image is selected, run a callback.
buddyforms_gallery_frame.on('select', function () {
var selection = buddyforms_gallery_frame.state().get('selection');
selection.map(function (attachment) {
attachment = attachment.toJSON();
if (attachment.id) {
if ($el.data('multiple')) {
attachment_ids = attachment_ids ? attachment_ids + "," + attachment.id : attachment.id;
} else {
attachment_ids = attachment.id;
}
attachment_url = attachment.url;
if (attachment.type == 'image') {
attachment_image = attachment.sizes.thumbnail ? attachment.sizes.thumbnail.url : attachment.url;
} else {
attachment_image = attachment.icon;
}
if (!$el.data('multiple'))
bf_files.html('');
bf_files.append('\
<li class="image" data-attachment_id="' + attachment.id + '">\
<div class="bf_attachment_li">\
<div class="bf_attachment_img">\
<img style="height:64px" src="' + attachment_image + '" />\
</div><div class="bf_attachment_meta">\
<p>Name:' + attachment.name + '</p>\
<p><a href="#" class="delete tips" data-slug="' + $el.data('slug') + '" data-tip="' + $el.data('tip') + '">' + $el.data('text') + '</a>\
<a href="' + attachment_url + '" target="_blank" class="view" data-tip="' + +'">' + +'</a></p>\
</div></div>\
</li>');
}
});
$image_gallery_ids.val(attachment_ids);
});
// Finally, open the modal.
buddyforms_gallery_frame.open();
});
// Remove images
jQuery(document).on('click', '.bf_files a.delete', function (event) {
if (confirm('Delete Permanently')) {
var $el = $(this);
var $image_gallery_ids = $('#' + $el.data('slug'));
var bf_files = $('#bf_files_container_' + $el.data('slug') + ' ul.bf_files');
var attachment_ids = $image_gallery_ids.val();
$(this).closest('li.image').remove();
var attachment_ids = '';
$('#bf_files_container_' + $el.data('slug') + ' ul li.image').css('cursor', 'default').each(function () {
var attachment_id = jQuery(this).attr('data-attachment_id');
attachment_ids = attachment_ids + attachment_id + ',';
});
$image_gallery_ids.val(attachment_ids);
// remove any lingering tooltips
$('#tiptip_holder').removeAttr('style');
$('#tiptip_arrow').removeAttr('style');
}
return false;
});
})(jQuery);
|
(function($, BUE) {
'use strict';
/**
* @file
* Defines bueditor button object.
*/
/**
* Button constructor
*/
BUE.Button = function(def) {
this.construct(def);
};
/**
* Extend the prototype with state manager.
*/
var Button = BUE.extendProto(BUE.Button.prototype, 'state');
/**
* Constructs the button.
*/
Button.construct = function(def) {
if (def) {
BUE.extend(this, def);
this.createEl();
}
};
/**
* Destroy the button.
*/
Button.destroy = function() {
this.remove();
$(this.el).remove();
delete this.el;
};
/**
* Creates the button element.
*/
Button.createEl = function() {
var el = this.el;
if (!el) {
el = this.el = BUE.createEl(BUE.buttonHtml(this));
el.onclick = BUE.eButtonClick;
el.onmousedown = BUE.eButtonMousedown;
el.bueBid = this.id;
}
return el;
};
/**
* Toggles disabed state.
*/
Button.toggleDisabled = function(state) {
this.toggleState('disabled', state);
};
/**
* Toggles pressed state.
*/
Button.togglePressed = function(state) {
this.toggleState('pressed', state);
};
/**
* Removes button from its editor.
*/
Button.remove = function() {
var E = this.Editor;
if (E) E.removeButton(this);
};
/**
* Fires the button action.
*/
Button.fire = function() {
var E = this.Editor;
if (E) E.fireButton(this);
};
/**
* Click event of a button
*/
BUE.eButtonClick = function(event) {
var Button = BUE.buttonOf(this);
if (!Button.disabled) {
Button.fire();
}
return false;
};
/**
* Mousedown event of a button.
*/
BUE.eButtonMousedown = function() {
var Button = BUE.buttonOf(this);
// Set active state.
Button.setState('active');
// Unset active state on the next mouseup event.
$(document).one('mouseup', function() {
Button.unsetState('active');
Button = null;
});
// Prevent default to keep the focus on editor textarea
return false;
};
/**
* Returns html of a button definition.
*/
BUE.buttonHtml = function(def) {
var html, cache = BUE.buttonHtmlCache;
if (!cache) cache = BUE.buttonHtmlCache = {};
html = cache[def.id];
return html != null ? html : (cache[def.id] = BUE.html(BUE.buttonHtmlObj(def)));
};
/**
* Returns html object of a button definition.
*/
BUE.buttonHtmlObj = function(def) {
var label = def.label || '', text = def.text || '', cname = def.cname, shortcut = def.shortcut,
attr = {
type: 'button',
tabindex: '-1',
'class': 'bue-button bue-button--' + def.id,
title: def.tooltip || label,
'aria-label': label
};
if (cname) {
if (cname.indexOf('ficon-') != -1) {
attr['class'] += ' has-ficon';
}
attr['class'] += ' ' + cname;
}
if (text) {
attr['class'] += ' has-text';
}
if (shortcut) {
attr.title += ' (' + shortcut + ')';
}
return {tag: 'button', attributes: attr, html: text};
};
/**
* Retrieves the button object from a button element.
*/
BUE.buttonOf = function(el) {
var E = BUE.editorOf(el);
return E ? E.buttons[el.bueBid] : false;
};
})(jQuery, BUE);
|
/**
* External dependencies
*/
const { BundleAnalyzerPlugin } = require( 'webpack-bundle-analyzer' );
const LiveReloadPlugin = require( 'webpack-livereload-plugin' );
const path = require( 'path' );
/**
* WordPress dependencies
*/
const DependencyExtractionWebpackPlugin = require( '@wordpress/dependency-extraction-webpack-plugin' );
/**
* Internal dependencies
*/
const { hasBabelConfig } = require( './node_modules/@wordpress/scripts/utils' );
const isProduction = process.env.NODE_ENV === 'production';
const mode = isProduction ? 'production' : 'development';
const config = {
mode,
entry: {
'aioseop-link-attributes-gutenberg-editor': path.resolve( process.cwd(), 'src', 'aioseop-link-attributes-gutenberg-editor.js' ),
},
output: {
filename: '[name].js',
path: path.resolve( process.cwd(), 'build' ),
},
resolve: {
alias: {
'lodash-es': 'lodash',
},
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: [
require.resolve( 'thread-loader' ),
{
loader: require.resolve( 'babel-loader' ),
options: {
// Babel uses a directory within local node_modules
// by default. Use the environment variable option
// to enable more persistent caching.
cacheDirectory:
process.env.BABEL_CACHE_DIRECTORY || true,
// Provide a fallback configuration if there's not
// one explicitly available in the project.
...( ! hasBabelConfig() && {
babelrc: false,
configFile: false,
presets: [
require.resolve(
'@wordpress/babel-preset-default'
),
],
} ),
},
},
],
},
{
test: /\.svg$/,
use: [ '@svgr/webpack', 'url-loader' ],
},
],
},
plugins: [
// WP_BUNDLE_ANALYZER global variable enables utility that represents bundle content
// as convenient interactive zoomable treemap.
process.env.WP_BUNDLE_ANALYZER && new BundleAnalyzerPlugin(),
// WP_LIVE_RELOAD_PORT global variable changes port on which live reload works
// when running watch mode.
! isProduction &&
new LiveReloadPlugin( {
port: process.env.WP_LIVE_RELOAD_PORT || 35729,
} ),
new DependencyExtractionWebpackPlugin( { injectPolyfill: true } ),
].filter( Boolean ),
stats: {
children: false,
},
};
if ( ! isProduction ) {
// WP_DEVTOOL global variable controls how source maps are generated.
// See: https://webpack.js.org/configuration/devtool/#devtool.
config.devtool = process.env.WP_DEVTOOL || 'source-map';
config.module.rules.unshift( {
test: /\.js$/,
use: require.resolve( 'source-map-loader' ),
enforce: 'pre',
} );
}
module.exports = config;
|
define([
'dojo/_base/declare',
'dojo/_base/lang',
'dojo/topic',
'dojo/on',
'dojo/_base/array',
'dijit/_WidgetBase',
'dijit/_TemplatedMixin',
'ngw-compulink-libs/dgrid-0.4.0/dstore/Rest',
'ngw-compulink-libs/dgrid-0.4.0/dgrid/OnDemandGrid',
'ngw-compulink-libs/dgrid-0.4.0/dgrid/Keyboard',
'ngw-compulink-libs/dgrid-0.4.0/dgrid/Selection',
'ngw-compulink-admin/reference_books/EditorRelation'
], function (declare, lang, topic, on, array, _WidgetBase, _TemplatedMixin,
Rest, OnDemandGrid, Keyboard, Selection, EditorRelation) {
return declare([_WidgetBase, _TemplatedMixin], {
templateString: '<div></div>',
postCreate: function () {
var districtsStore = new Rest({
target: ngwConfig.applicationUrl + '/compulink/services/reference_books/district/',
useRangeHeaders: true
});
new (declare([OnDemandGrid, Keyboard, Selection, EditorRelation]))({
collection: districtsStore,
columns: this.config
}, this.domNode);
}
});
});
|
/*
* Kendo UI v2015.2.624 (http://www.telerik.com/kendo-ui)
* Copyright 2015 Telerik AD. All rights reserved.
*
* Kendo UI commercial licenses may be obtained at
* http://www.telerik.com/purchase/license-agreement/kendo-ui-complete
* If you do not own a commercial license, this file shall be governed by the trial license terms.
*/
(function(f, define){
define([], f);
})(function(){
(function( window, undefined ) {
var kendo = window.kendo || (window.kendo = { cultures: {} });
kendo.cultures["fr"] = {
name: "fr",
numberFormat: {
pattern: ["-n"],
decimals: 2,
",": " ",
".": ",",
groupSize: [3],
percent: {
pattern: ["-n %","n %"],
decimals: 2,
",": " ",
".": ",",
groupSize: [3],
symbol: "%"
},
currency: {
pattern: ["-n $","n $"],
decimals: 2,
",": " ",
".": ",",
groupSize: [3],
symbol: "€"
}
},
calendars: {
standard: {
days: {
names: ["dimanche","lundi","mardi","mercredi","jeudi","vendredi","samedi"],
namesAbbr: ["dim.","lun.","mar.","mer.","jeu.","ven.","sam."],
namesShort: ["di","lu","ma","me","je","ve","sa"]
},
months: {
names: ["janvier","février","mars","avril","mai","juin","juillet","août","septembre","octobre","novembre","décembre"],
namesAbbr: ["janv.","févr.","mars","avr.","mai","juin","juil.","août","sept.","oct.","nov.","déc."]
},
AM: [""],
PM: [""],
patterns: {
d: "dd/MM/yyyy",
D: "dddd d MMMM yyyy",
F: "dddd d MMMM yyyy HH:mm:ss",
g: "dd/MM/yyyy HH:mm",
G: "dd/MM/yyyy HH:mm:ss",
m: "d MMMM",
M: "d MMMM",
s: "yyyy'-'MM'-'dd'T'HH':'mm':'ss",
t: "HH:mm",
T: "HH:mm:ss",
u: "yyyy'-'MM'-'dd HH':'mm':'ss'Z'",
y: "MMMM yyyy",
Y: "MMMM yyyy"
},
"/": "/",
":": ":",
firstDay: 1
}
}
}
})(this);
return window.kendo;
}, typeof define == 'function' && define.amd ? define : function(_, f){ f(); });
|
module.exports = function(grunt) {
var log = require('../node_modules/qunit/lib/log.js');
var qunit = require("qunit");
grunt.registerMultiTask("node-qunit", "Runs node-qunit ", function() {
var done = this.async(),
started = new Date(),
callback = this.data.callback;
// Setup Qunit
qunit.setup(this.data.setup || {
log: {
summary: true,
errors: true
}
});
// Run tests
var files = {};
if(this.data.code) files.code = this.data.code;
if(this.data.deps) files.deps = this.data.deps;
if(this.data.tests) files.tests = this.data.tests;
qunit.run(files, function(err, result) {
if(!result) {
throw "Could not get results for Qunit test. Check previous exceptions";
}
result.started = started;
result.completed = new Date();
var waitForAsync = false;
this.async = function() {
waitForAsync = true;
return function(status) {
done(typeof status === "undefined" ? (result.failed === 0) : status);
log.reset();
};
};
var res;
if(typeof callback === "function") {
res = callback(err, result);
}
if(!waitForAsync) {
done(typeof res === "undefined" ? (result.failed === 0) : res);
log.reset();
}
});
});
};
|
/* eslint jest/expect-expect: ["error", { "assertFunctionNames": ["expectHostedOnPhoton", "expectHostedOnPhotonInsecurely", "expectPathname", "expectQuery", "expect"] }] */
import photon from '../src';
function expectHostedOnPhoton( url ) {
expect( url ).toEqual( expect.stringMatching( /^https:\/\/i0\.wp\.com/ ) );
}
function expectHostedOnPhotonInsecurely( url ) {
expect( url ).toEqual( expect.stringMatching( /^http:\/\/i[0-2]\.wp\.com/ ) );
}
function expectPathname( url, expected ) {
const parsedUrl = new URL( url );
expect( parsedUrl.pathname ).toBe( expected );
}
function expectQuery( url, expected ) {
const searchParams = new URL( url ).searchParams;
for ( const key of Object.keys( expected ) ) {
expect( searchParams.get( key ) ).toBe( expected[ key ] );
}
}
describe( 'photon()', function () {
test( 'should be a "function"', function () {
expect( photon ).toBeInstanceOf( Function );
} );
test( 'should Photon-ify a basic image URL', function () {
const url = 'http://example.com/image.png';
expect( photon( url ) ).toEqual(
expect.stringMatching( /^https:\/\/i[0-2].wp.com\/example.com\/image.png$/ )
);
} );
test( 'should Photon-ify a secure image URL', function () {
const url = 'https://example.com/image.png';
expect( photon( url ) ).toEqual(
expect.stringMatching( /^https:\/\/i[0-2].wp.com\/example.com\/image.png\?ssl=1$/ )
);
} );
test( 'should not Photon-ify an existing insecure Photon URL, even if the host is wrong', function () {
const photonedUrl = photon( 'http://www.gravatar.com/avatar/693307b4e0cb9366f34862c9dfacd7fc' );
const alternateUrl =
'http://i1.wp.com/www.gravatar.com/avatar/693307b4e0cb9366f34862c9dfacd7fc';
expectHostedOnPhoton( photonedUrl );
expect( photonedUrl ).not.toBe( alternateUrl );
expect( photon( alternateUrl, { secure: false } ) ).toBe( alternateUrl );
} );
test( 'should move an existing Photon URL to i0 if it was on another host', function () {
const photonedUrl = photon( 'http://www.gravatar.com/avatar/693307b4e0cb9366f34862c9dfacd7fc' );
const alternateUrl =
'https://i1.wp.com/www.gravatar.com/avatar/693307b4e0cb9366f34862c9dfacd7fc';
const alternateUrloni0 =
'https://i0.wp.com/www.gravatar.com/avatar/693307b4e0cb9366f34862c9dfacd7fc';
expectHostedOnPhoton( photonedUrl );
expect( photonedUrl ).not.toBe( alternateUrl );
expect( photon( alternateUrl ) ).toBe( alternateUrloni0 );
} );
test( 'should handle photoning a photoned url', function () {
const url = photon( 'http://example.com/image.png' );
expect( photon( url ) ).toBe( url );
} );
test( 'should add width parameters if specified', function () {
const photonedUrl = photon( 'http://example.com/image.png', { width: 50 } );
expectQuery( photonedUrl, { w: '50' } );
} );
test( 'should return null for URLs with querystrings from non-photon hosts', function () {
const url = 'http://example.com/image.png?foo=bar';
expect( photon( url ) ).toBeNull();
} );
test( 'should handle protocolless URLs', function () {
const url = '//example.com/image.png';
const photonedUrl = photon( url );
expectHostedOnPhoton( photonedUrl );
expectPathname( photonedUrl, '/example.com/image.png' );
} );
test( 'should handle blob: URLs', function () {
const url = 'blob:http://example.com/ddd1d6b0-f31b-4937-ae9e-97f1d660cf71';
const photonedUrl = photon( url );
expectHostedOnPhoton( photonedUrl );
expectPathname( photonedUrl, '/http//example.com/ddd1d6b0-f31b-4937-ae9e-97f1d660cf71' );
} );
test( 'should strip existing size params from photoned URLs', function () {
const url =
'https://i0.wp.com/www.gravatar.com/avatar/693307b4e0cb9366f34862c9dfacd7fc?resize=120';
const photonedUrl = photon( url, { width: 150, height: 300 } );
expectHostedOnPhoton( photonedUrl );
expectPathname( photonedUrl, '/www.gravatar.com/avatar/693307b4e0cb9366f34862c9dfacd7fc' );
expectQuery( photonedUrl, { w: '150', h: '300' } );
} );
test( 'should allow you to do everything at once', function () {
const url = 'https://i0.wp.com/example.com/foo.png?w=50&lb=10&unknown=true';
const photonedUrl = photon( url, {
width: 10,
height: 20,
letterboxing: '120,120',
removeLetterboxing: true,
} );
expectHostedOnPhoton( photonedUrl );
expectPathname( photonedUrl, '/example.com/foo.png' );
expectQuery( photonedUrl, { w: '10', h: '20', lb: '120,120', ulb: 'true' } );
} );
test( 'should allow you to turn off https', function () {
let photonedUrl = photon( 'http://example.com/foo.png', { secure: false } );
expectHostedOnPhotonInsecurely( photonedUrl );
photonedUrl = photon( 'https://i0.wp.com/example.com/foo.png', { secure: false } );
expectHostedOnPhotonInsecurely( photonedUrl );
} );
test( 'should allow you to turn off ssl for fetching', function () {
let photonedUrl = photon( 'https://example.com/foo.png', { secure: false, ssl: '0' } );
expectHostedOnPhotonInsecurely( photonedUrl );
expectQuery( photonedUrl, { ssl: '0' } );
photonedUrl = photon( 'https://i0.wp.com/example.com/foo.png', { secure: false, ssl: '0' } );
expectHostedOnPhotonInsecurely( photonedUrl );
expectQuery( photonedUrl, { ssl: '0' } );
} );
} );
|
var searchData=
[
['vmax',['VMAX',['../ex3_8c.html#aff4b1376965cfdb32a775db8565d2540',1,'ex3.c']]]
];
|
var _ = typeof Frame5 === 'object'
if (!_) {
/***
* Node modules
*/
var EventEmitter = require('events').EventEmitter;
var Stream = require('stream');
var inherits = require('util').inherits;
//
exports = module.exports = {}
} else {
var EventEmitter = Frame5.EventEmitter;
var Stream = Frame5.Stream;
var inherits = Frame5.inherits;
var exports = {}
}
/**
*
*/
var Read = exports.Read = function() {
Stream.call(this);
this.buffer = []
this.readable = this.writable = true;
}
/***
* Make it an event
*/
inherits(Read, Stream);
/**
*
*/
Read.prototype.write = function(str) {
////console.log('split.Read', str)
if (str.indexOf('\n') > -1) {
var message = this.buffer.join('');
var data = str.split('\n');
message += data.shift();
this.buffer = [];
this.emit('data', message);
data = data.join('\n');
if (data.length) {
this.write(data);
}
} else {
this.buffer.push(str);
}
}
/**
*
*/
Read.prototype.end = function(str) {
if (str) {
this.write(str)
}
this.emit('end')
};
/**
*
*/
var Write = exports.Write = function() {
Stream.call(this);
this.buffer = []
this.readable = this.writable = true;
}
/***
* Make it an event
*/
inherits(Write, Stream);
/**
*
*/
Write.prototype.write = function(str) {
////console.log('split.Write', str)
this.emit('data', str + '\n')
}
/**
*
*/
Write.prototype.end = function(str) {
if (str) {
this.write(str)
}
this.emit('end')
};
if (_) {
Frame5.pipes = Frame5.pipes || {}
Frame5.extend(Frame5.pipes.split = {}, exports)
}
|
showWord(["np.","premye moun ki te rete sou latè, dapre istwa labib. Adan ak Ev te rete nan Jaden Edenn."
])
|
module.exports = {
free: {
src: [
'**',
'!bin/**',
'!build/**',
'!grunt-tasks-config/**',
'!node_modules/**',
'!tests/**',
'!wpcs/**',
'!.git/**',
'!gruntfile.js',
'!package.json',
'!.gitignore',
'!.ftpauth',
'!.travis.yml',
'!travis-examples/**',
'!phpunit.xml',
'!readme.md',
'!**/*.db',
'!patches/**',
'!inc/init-pro.php'
],
dest: 'build/free/<%= pkg.name %>/'
},
pro: {
src: [
'**',
'!bin/**',
'!build/**',
'!grunt-tasks-config/**',
'!node_modules/**',
'!tests/**',
'!wpcs/**',
'!.git/**',
'!.travis.yml',
'!travis-examples/**',
'!phpunit.xml',
'!**/*.db',
'!patches/**',
'!.ftpauth',
'!.gitignore',
'!gruntfile.js',
'!package.json',
'!readme.md',
'!readme.txt',
'!screenshot.png',
'!style.css'
],
dest: '../customizr-pro/'
}
};
|
/** The minplayer namespace. */
var minplayer = minplayer || {};
/**
* @constructor
* @class A wrapper class used to provide all the data necessary to control an
* individual file within this media player.
*
* @param {object} file A media file object with minimal required information.
*/
minplayer.file = function(file) {
this.duration = file.duration || 0;
this.bytesTotal = file.bytesTotal || 0;
this.quality = file.quality || 0;
this.stream = file.stream || '';
this.path = file.path || '';
this.codecs = file.codecs || '';
// These should be provided, but just in case...
this.extension = file.extension || this.getFileExtension();
this.mimetype = file.mimetype || file.filemime || this.getMimeType();
this.type = file.type || this.getType();
// Fail safe to try and guess the mimetype and media type.
if (!this.type) {
this.mimetype = this.getMimeType();
this.type = this.getType();
}
// Get the player.
this.player = file.player || this.getBestPlayer();
this.priority = file.priority || this.getPriority();
this.id = file.id || this.getId();
};
/**
* Returns the best player for the job.
*
* @return {string} The best player to play the media file.
*/
minplayer.file.prototype.getBestPlayer = function() {
var bestplayer = null, bestpriority = 0, _this = this;
jQuery.each(minplayer.players, function(name, player) {
var priority = player.getPriority();
if (player.canPlay(_this) && (priority > bestpriority)) {
bestplayer = name;
bestpriority = priority;
}
});
return bestplayer;
};
/**
* The priority of this file is determined by the priority of the best
* player multiplied by the priority of the mimetype.
*
* @return {integer} The priority of the media file.
*/
minplayer.file.prototype.getPriority = function() {
var priority = 1;
if (this.player) {
priority = minplayer.players[this.player].getPriority();
}
switch (this.mimetype) {
case 'video/x-webm':
case 'video/webm':
case 'application/octet-stream':
return priority * 10;
case 'video/mp4':
case 'audio/mp4':
case 'audio/mpeg':
return priority * 9;
case 'video/ogg':
case 'audio/ogg':
case 'video/quicktime':
return priority * 8;
default:
return priority * 5;
}
};
/**
* Returns the file extension of the file path.
*
* @return {string} The file extension.
*/
minplayer.file.prototype.getFileExtension = function() {
return this.path.substring(this.path.lastIndexOf('.') + 1).toLowerCase();
};
/**
* Returns the proper mimetype based off of the extension.
*
* @return {string} The mimetype of the file based off of extension.
*/
minplayer.file.prototype.getMimeType = function() {
switch (this.extension) {
case 'mp4': case 'm4v': case 'flv': case 'f4v':
return 'video/mp4';
case'webm':
return 'video/webm';
case 'ogg': case 'ogv':
return 'video/ogg';
case '3g2':
return 'video/3gpp2';
case '3gpp':
case '3gp':
return 'video/3gpp';
case 'mov':
return 'video/quicktime';
case'swf':
return 'application/x-shockwave-flash';
case 'oga':
return 'audio/ogg';
case 'mp3':
return 'audio/mpeg';
case 'm4a': case 'f4a':
return 'audio/mp4';
case 'aac':
return 'audio/aac';
case 'wav':
return 'audio/vnd.wave';
case 'wma':
return 'audio/x-ms-wma';
default:
return 'unknown';
}
};
/**
* The type of media this is: video or audio.
*
* @return {string} "video" or "audio" based on what the type of media this
* is.
*/
minplayer.file.prototype.getType = function() {
switch (this.mimetype) {
case 'video/mp4':
case 'video/webm':
case 'application/octet-stream':
case 'video/x-webm':
case 'video/ogg':
case 'video/3gpp2':
case 'video/3gpp':
case 'video/quicktime':
return 'video';
case 'audio/mp3':
case 'audio/mp4':
case 'audio/ogg':
case 'audio/mpeg':
return 'audio';
default:
return '';
}
};
/**
* Returns the ID for this media file.
*
* @return {string} The id for this media file which is provided by the player.
*/
minplayer.file.prototype.getId = function() {
var player = minplayer.players[this.player];
return (player && player.getMediaId) ? player.getMediaId(this) : '';
};
|
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require jquery
//= require jquery_ujs
//= require bootstrap
//= require turbolinks
//= require_tree .
//= require jquery.atwho
|
var iat = 0;
function atclick() {
if (iat === 2) {location.href = "/wp-login.php"; } else {iat = iat + 1; }
}
$(function(){
var scrollTo = function(top, duration, callback) {
var w = $(window);
var FPS = 50;
var currentTop = w.scrollTop();
var offset = (currentTop - top) / (duration * FPS / 1000);
var n = 0;
var prevTop = currentTop;
var t = setInterval(function() {
if ((prevTop - top) * (currentTop - top) <= 0) {
clearInterval(t);
currentTop = prevTop = top;
w.scrollTop(top);
if (callback) callback();
} else {
prevTop = currentTop;
w.scrollTop(currentTop -= offset);
}
}, 1000 / FPS);
}
$('body').dblclick(function(){
scrollTo(0, 200, function(){
});
$(".textField,#commentForm textarea").focus();
});
$('#colophon,input,textarea').dblclick(function(e){e.stopPropagation();});
});
|
// ==UserScript==
// @name Brazil New Year 2009 Official Orkut Theme By OrkutPlus.Net
// @namespace OrkutPlus.Net
// @description Let's English Orkut users to enjoy and feel New Year 2009 Official 'Brazilian' Orkut Theme.
// @include http://www.orkut.co*/*
// @author OrkutPlus.Net
// ==/UserScript==
function enfiaCss(linkCss){
void(CSS = document.createElement('link'));
void(CSS.rel = 'stylesheet');
void(CSS.href = linkCss);
void(CSS.type = 'text/css');
void(document.body.appendChild(CSS));
}
csslinkes = new Array
("http://img3.orkut.com/skins/gen/new_year_oi011.css");
enfiaCss(csslinkes[0]);
|
function AddSection(NumSection,GrosEntry){
var TabLink = ($('<li/>',{class: "subSection","data-toggle":"tab"})).append($('<a/>',{class:"LinktoAnchor", "href":"#Sect"+NumSection,"data-toggle":"tab",text:GrosEntry}))
// var SectionBody = $('<div/>',{id: 'One',class:'tab-pane',html:"<h2>@</h2>"})
$("#tabs").append(TabLink)
// $("#my-tab-content").append(SectionBody)
}
var Vitr= [];
function Vitrine (jsonKid,SectionNum){
Vitr.push(jsonKid)
IDEnt=Vitr.length-1
var IT = {"Name":jsonKid[0],'Price':jsonKid[1],"Link":jsonKid[2],"About":jsonKid[3],"Weigth":jsonKid[4] }
Image = $('<img>',{src:IT.Link, class:"img-thumbnail"})
lot =$("<div/>",{id:IDEnt, class:"product col-6 col-sm-6 col-lg-4"}).prepend(Image).append("<h4>"+IT.Name+" <small>"+IT.Price+"руб</small></h4><p>"+IT.About+" <i>"+IT.Weigth+"гр</i></p>")
$("#"+SectionNum).append(lot)
}
var ShopName = "DH"
if ($.cookie('ShopName')){ShopName=$.cookie('ShopName')}
$.cookie('ShopName',ShopName)
$('#PartnerShopHiden').val(ShopName)
function GetCatalog() {
var Section = "Sect"
var NumSection=0
$.getJSON("./catalog"+ShopName+".json", function(json){
Object.keys(json).forEach(function(GrosEntry) {
NumSection+=1
AddSection(NumSection,GrosEntry)
var SectionNum = Section+NumSection
$("#vitrina").append($("<div/>",{id:SectionNum,class:Section}))
json[GrosEntry].forEach(function(entry) {
var jsonKid=entry
Vitrine(jsonKid,SectionNum)
});
});
// $(".Sect:even div").css("font-family","serif");
// $('.product').height(222)
// MarketReady()
});
MarketReady()
}
$(document).ready(function () {
GetCatalog()
})
|
showWord(["v. ","repwodui dapre metòd polikopi, ki se repwodiksyon ki sèvi ak estansil pou fè plizyè kopi."
])
|
var GroupView = function(json) {
"use strict";
var template;
if (!json.$t) {
var albums = [];
var a, album_id, i;
for (album_id in json.all_songs_for_sid) {
a = json.all_songs_for_sid[album_id][0].albums[0];
// cut off a circular memory reference quick-like
json.all_songs_for_sid[album_id][0].albums = null;
a.songs = json.all_songs_for_sid[album_id].sort(SongsTableSorting);
for (i = 0; i < a.songs.length; i++) {
a.songs[i].artists = JSON.parse(a.songs[i].artist_parseable);
}
albums.push(a);
}
albums.sort(SongsTableAlbumSort);
template = RWTemplates.detail.group({ "group": json, "albums": albums }, MOBILE ? null : document.createElement("div"));
var j;
for (i = 0; i < albums.length; i++) {
for (j = 0; j < albums[i].songs.length; j++) {
Fave.register(albums[i].songs[j]);
Rating.register(albums[i].songs[j]);
if (albums[i].songs[j].requestable) {
Requests.make_clickable(albums[i].songs[j].$t.title, albums[i].songs[j].id);
}
SongsTableDetail(albums[i].songs[j], ((i == albums.length - 1) && (j > albums[i].songs.length - 4)));
}
}
template._header_text = json.name;
MultiAlbumKeyNav(template, albums);
}
return template;
};
|
var websrv__help__functions_8c =
[
[ "mk_net_str", "websrv__help__functions_8c.html#aa16e3221d8abe2b08c51832976606df3", null ],
[ "parse_ip", "websrv__help__functions_8c.html#a58fb5d4e8cdd22df05e2b5c455f90c28", null ]
];
|
/** Pagination functions for the store */
(function (fn) {
fn.page = fn.page || {};
fn.page.first = function () { this.page = 0; this.update(); };
fn.page.next = function () { this.page += 1; this.update(); };
fn.page.prev = function () { this.page -= 1; this.update(); };
fn.page.last = function () {
this.page = Math.ceil(this.filtered.length / this.pagesize) - 1;
this.page -= 1; this.update();
};
}(store.fn = store.fn || {}));
this.page = 0;
this.pagesize = 10;
|
var searchData=
[
['validate_5farchitecture',['VALIDATE_ARCHITECTURE',['../seccomp-bpf_8h.html#a6487ed6835a31f9962e8b865a25028f2',1,'seccomp-bpf.h']]]
];
|
function FindProxyForURL(url,host){
if (isPlainHostName(host))
return "DIRECT";
var r = /(^|\.)(local(\.)?|mydomain\.com|mydomain\.net|apple\.com|icloud\.com|mzstatic\.com|googlevideo\.com)$/i;
if (r.test(host))
return "DIRECT";
var ip = dnsResolve(host);
if (isInNet(ip,"10.0.0.0","255.0.0.0")||isInNet(ip,"127.0.0.0","255.0.0.0")||isInNet(ip,"172.16.0.0","255.240.0.0")||isInNet(ip,"192.168.0.0","255.255.0.0")) {
return "DIRECT";
}
return "PROXY proxy.mydomain.net:{PORT}";
}
|
/**
* © 2013-2015 GreekTurtle
*
* LICENSE:
*
* This file is part of Inscribe (http://inscribe.io).
*
* The contents of this file cannot be copied, distributed or modified without prior
* consent from the author.
*
* Project : Inscribe
* File : assets/js/validation.js
* Description : Validate Form fields
*
* @author Naman Agrawal <naman[at]weblength[dot]co[dot]in>
* @author Pranjal Goswami <pranjal[at]weblength[dot]co[dot]in>
*
* BADesigns | GreekTurtle | Weblength Infonet Pvt. Ltd.
*
* Created : Wed Feb 05 2014 14:51:56 GMT+0530 (IST)
*/
function showFormError(e){
e.parent().parent().removeClass("has-success");
e.parent().parent().addClass("has-error");
item = e.parent().find(".form-error");
item.animate({height:'22px'}, {duration :800 , easing : 'easeOutBack'}, function(){});
return !1;
}
function hideFormError(e){
e.parent().parent().removeClass("has-error");
e.parent().parent().addClass("has-success");
item = e.parent().find(".form-error");
item.animate({height:'0px'}, {duration :800 , easing : 'easeOutBack'}, function(){});
return !0;
}
function isEmpty(e){
return e.val().length<=0 ? !0 : !1
}
/* Form Validation */
function validateSignUpForm(f){
var ret = !0;
f.find('input').each(function() {
if(!$(this).hasClass('pass')){
var v = $(this).attr('data-validate');
ret = ret && window[v]($(this));
}
});
return ret;
}
function validateName(e){
return isEmpty(e) ? showFormError(e) : hideFormError(e)
}
function validateEmail(e) {
var pattern = new RegExp(/^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/);
return isEmpty(e) || !pattern.test(e.val()) ? showFormError(e) : hideFormError(e);
}
function validatePwd(e){
return e.val().length<5 ? showFormError(e) : hideFormError(e);
}
|
var gulp = require('gulp');
var server = require('gulp-server-livereload');
gulp.task('webserver', function() {
gulp.src('app')
.pipe(server({
livereload: true,
directoryListing: true,
open: true
}));
});
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* @author Municipio de Itajaí - Secretaria de Educação - DITEC *
* @updated 30/06/2016 *
* Pacote: Erudio *
* *
* Copyright (C) 2016 Prefeitura de Itajaí - Secretaria de Educação *
* DITEC - Diretoria de Tecnologias educacionais *
* ditec@itajai.sc.gov.br *
* *
* Este programa é software livre, você pode redistribuí-lo e/ou *
* modificá-lo sob os termos da Licença Pública Geral GNU, conforme *
* publicada pela Free Software Foundation, tanto a versão 2 da *
* Licença como (a seu critério) qualquer versão mais nova. *
* *
* Este programa é distribuído na expectativa de ser útil, mas SEM *
* QUALQUER GARANTIA. Sem mesmo a garantia implícita de COMERCIALI- *
* ZAÇÃO ou de ADEQUAÇÃO A QUALQUER PROPÓSITO EM PARTICULAR. Con- *
* sulte a Licença Pública Geral GNU para obter mais detalhes. *
* *
* Você deve ter recebido uma cópia da Licença Pública Geral GNU *
* junto com este programa. Se não, escreva para a Free Software *
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA *
* 02111-1307, USA. *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
(function (){
/*
* @ErudioDoc Alunos ANEE Service
* @Module alunosANEE
* @Service AlunoANEEService
*/
'use strict';
class AlunoANEEService {
constructor(rest,erudioConfig){
this.rest = rest;
this.erudioConfig = erudioConfig;
this.url = this.erudioConfig.urlRelatorios+'/alunos/anee-nominal-unidade';
this.urlPorInstituicao = this.erudioConfig.urlRelatorios+'/alunos/anee-nominal-instituicao';
}
/*
* @method getURL
* @methodReturn String
* @methodParams unidade|Int
* @methodDescription Busca a url para gerar o relatório de ANEE por unidade.
*/
getURL(unidade){ return this.url+'?unidade='+unidade; }
/*
* @method getURLPorInstituicao
* @methodReturn String
* @methodParams instituicao|Int
* @methodDescription Busca a url para gerar o relatório de ANEE por instituição.
*/
getURLPorInstituicao(instituicao){ return this.urlPorInstituicao+'?instituicao='+instituicao; }
};
angular.module('AlunoANEEService',['erudioConfig']).service('AlunoANEEService',AlunoANEEService);
AlunoANEEService.$inject = ["BaseService","ErudioConfig"];
})();
|
// https://gist.github.com/1670507
// underscore addon with sum, mean, median and nrange function
// see details below
_.mixin({
// Return sum of the elements
sum : function(obj, iterator, context) {
if (!iterator && _.isEmpty(obj)) return 0;
var result = 0;
if (!iterator && _.isArray(obj)){
for(var i=obj.length-1;i>-1;i-=1){
result += obj[i];
};
return result;
};
each(obj, function(value, index, list) {
var computed = iterator ? iterator.call(context, value, index, list) : value;
result += computed;
});
return result;
},
// Return aritmethic mean of the elements
// if an iterator function is given, it is applied before
mean : function(obj, iterator, context) {
if (!iterator && _.isEmpty(obj)) return Infinity;
if (!iterator && _.isArray(obj)) return _.sum(obj)/obj.length;
if (_.isArray(obj) && !_.isEmpty(obj)) return _.sum(obj, iterator, context)/obj.length;
},
// Return median of the elements
// if the object element number is odd the median is the
// object in the "middle" of a sorted array
// in case of an even number, the arithmetic mean of the two elements
// in the middle (in case of characters or strings: obj[n/2-1] ) is returned.
// if an iterator function is provided, it is applied before
median : function(obj, iterator, context) {
if (_.isEmpty(obj)) return Infinity;
var tmpObj = [];
if (!iterator && _.isArray(obj)){
tmpObj = _.clone(obj);
tmpObj.sort(function(f,s){return f-s;});
}else{
_.isArray(obj) && each(obj, function(value, index, list) {
tmpObj.push(iterator ? iterator.call(context, value, index, list) : value);
tmpObj.sort();
});
};
return tmpObj.length%2 ? tmpObj[Math.floor(tmpObj.length/2)] : (_.isNumber(tmpObj[tmpObj.length/2-1]) && _.isNumber(tmpObj[tmpObj.length/2])) ? (tmpObj[tmpObj.length/2-1]+tmpObj[tmpObj.length/2]) /2 : tmpObj[tmpObj.length/2-1];
},
// Generate an integer Array containing an arithmetic progression. A port of
// the native Python `range()` function. See
// [the Python documentation](http://docs.python.org/library/functions.html#range).
// replacement of old _.range() faster + incl. convenience operations:
// _.nrange(start, stop) will automatically set step to +1/-1
// _.nrange(+/- stop) will automatically start = 0 and set step to +1/-1
nrange : function(start, stop, step) {
if (arguments.length <= 1) {
if (start === 0)
return [];
stop = start || 0;
start = 0;
}
step = arguments[2] || 1*(start < stop) || -1;
var len = Math.max(Math.ceil((stop - start) / step), 0);
var idx = 0;
var range = new Array(len);
do {
range[idx] = start;
start += step;
} while((idx += 1) < len);
return range;
}
})
|
import Param from './param'
// 字段结构 模型
class Schema {
constructor (index = 1) {
this.status = 200
this.statusText = `status${index}`
this.example = null
this.params = [new Param()]
}
}
export default Schema
|
$(function () {
var linearPeriodDefaults = {
step: 1,
start: 0,
increasing: true
};
interference.LinearPeriod = function (options) {
var settings = $.extend({}, linearPeriodDefaults, options);
this._floor = settings.floor;
this._ceiling = settings.ceiling;
this._step = settings.step;
this._current = settings.start;
this.next = settings.increasing ? this._increase : this._decrease;
};
interference.LinearPeriod.prototype._increase = function () {
if (this._current <= this._ceiling - this._step) {
this._current += this._step;
} else {
this._current = this._ceiling;
this.next = this._decrease;
}
return this._current;
};
interference.LinearPeriod.prototype._decrease = function () {
if (this._current >= this._floor + this._step) {
this._current -= this._step;
} else {
this._current = this._floor;
this.next = this._increase;
}
return this._current;
};
var sineDefaults = {
start: 0,
step: 0.5
};
interference.Sine = function (options) {
var settings = $.extend({}, sineDefaults, options);
this._currentX = settings.start;
this._step = settings.step;
};
interference.Sine.prototype.next = function () {
this._currentX += this._step;
return Math.sin(this._currentX);
};
interference.toGrey = function (value) {
value = Math.min(255, Math.max(0, Math.round(value)));
return 'rgb(' + value + ',' + value + ',' + value + ')';
};
var greySequenceDefaults = {
invert: false
};
interference.GreySequence = function (options) {
var settings = $.extend({}, greySequenceDefaults, options);
this._normalize = settings.invert ? this._subtractGrey : this._addGrey;
this._valueSequence = new interference.Sine(settings);
};
interference.GreySequence.prototype._addGrey = function (value) {
return 128 + (value * 64);
};
interference.GreySequence.prototype._subtractGrey = function (value) {
return 128 - (value * 64);
};
interference.GreySequence.prototype.next = function () {
return interference.toGrey(this._normalize(this._valueSequence.next()));
};
});
|
var searchData=
[
['write',['write',['../classSha256Class.html#a0f0fc4bd4d8c53d232df0d41d7ea25e0',1,'Sha256Class']]]
];
|
"use strict";
parserFactory.register("comrademao.com", function() { return new ComrademaoParser() });
class ComrademaoParser extends Parser{
constructor() {
super();
}
disabled() {
return chrome.i18n.getMessage("warningParserDisabledComradeMao");
}
// This site can't handle more than 1 page at a time
clampSimultanousFetchSize() {
return 1;
}
populateUI(dom) {
super.populateUI(dom);
document.getElementById("removeOriginalRow").hidden = false;
}
getChapterUrls(dom, chapterUrlsUI) {
return this.getChapterUrlsFromMultipleTocPages(dom,
ComrademaoParser.extractPartialChapterList,
ComrademaoParser.getUrlsOfTocPages,
chapterUrlsUI
).then(urls => urls.reverse());
};
static getUrlsOfTocPages(dom) {
let pagination = dom.querySelector("nav.pagination");
let tocUrls = [];
if (pagination != null ) {
let tocLinks = [...dom.querySelectorAll("a.page-numbers:not(.next)")]
.map(a => a.href);
if (0 < tocLinks.length) {
let maxPageUrl = tocLinks[tocLinks.length - 1];
let index = maxPageUrl.lastIndexOf("/", maxPageUrl.length - 2);
let base = maxPageUrl.substring(0, index + 1);
let maxPage = parseInt(maxPageUrl.substring(index + 1));
if (1 < maxPage) {
for(let i = 2; i <= maxPage; ++i) {
tocUrls.push(`${base}${i}/`);
}
}
}
}
return tocUrls;
}
static extractPartialChapterList(dom) {
let menu = dom.querySelector("table.table");
return util.hyperlinksToChapterList(menu);
}
findContent(dom) {
return dom.querySelector(".site-main article");
};
extractTitleImpl(dom) {
return dom.querySelector(".entry-title");
};
removeUnwantedElementsFromContentElement(element) {
util.removeChildElementsMatchingCss(element, "button, nav, div#comments");
super.removeUnwantedElementsFromContentElement(element);
}
findCoverImageUrl(dom) {
return util.getFirstImgSrc(dom, "#thumbnail");
}
getInformationEpubItemChildNodes(dom) {
return [...dom.querySelectorAll("#Description")];
}
}
|
/*
LifeStream - Instant Photo Sharing
Copyright (C) 2014-2016 Kayateia
Please see LICENSE for more info
*/
'use strict';
// Stream permissions
//
// PUBLIC: anyone can search for, view images in, and subscribe to stream
// APPROVAL: anyone can search for and request invite to stream
// HIDDEN: stream hidden from search results; owner may invite others
const PERM_PUBLIC = 1;
const PERM_APPROVAL = 2;
const PERM_HIDDEN = 3;
// Subscription states
//
// ACTIVE: user is subscribed to stream
// INVITED: user has been invited to stream
// REQUESTED: user has requested invite to stream
const SUB_ACTIVE = 1;
const SUB_INVITED = 2;
const SUB_REQUESTED = 3;
const perms = {
public: PERM_PUBLIC,
approval: PERM_APPROVAL,
hidden: PERM_HIDDEN
};
const sub = {
active: SUB_ACTIVE,
invited: SUB_INVITED,
requested: SUB_REQUESTED
};
module.exports = {
perms: perms,
sub: sub
};
|
define([
"underscore",
"backbone",
"common/websockets/connection"
], function (_, Backbone, WSConnection) {
var currentTopic = null;
var callbackStack = [];
var callbackHandler = function (topic, msg) {
_.each(callbackStack, function(cb) {
cb(topic, msg);
});
};
var reset = function () {
callbackStack = [];
currentTopic = null;
};
return {
'register': function (topic) {
this.unregister();
WSConnection.subscribe(topic, callbackHandler);
currentTopic = topic;
},
'unregister': function () {
if (currentTopic !== null) {
WSConnection.unsubscribe(currentTopic);
reset();
}
},
'pushCallback': function (callback) {
callbackStack.push(callback);
},
'hasCallbacks' : function() {
return callbackStack.length > 0;
}
}
});
|
var oQuery = require('../index.js');
var obj = {
a: 'str',
b: {
num: 123
},
e: {
f: {
num: 'string num'
}
},
arr: [1,2,4, {num: 321}, {num: 'str num in arr'}]
};
console.log('Main object');
console.log(obj);
console.log();
console.log('Find all objects will contains "num" property');
console.log(oQuery.wildcard('/**', ['num'], obj));
console.log();
console.log('Get object property ["b"]["num"]', '----', oQuery.get('/b/num', obj) === obj['b']['num'], '\n');
console.log('Get object property ["arr"][1]', '----', oQuery.get('/arr/1', obj) === obj['arr'][1], '\n');
console.log('Get object property is undefined property', '----', oQuery.get('/b/num/nonProp/isUndef', obj) === undefined, '\n');
oQuery.set('/b/newProp', 'string', obj);
console.log('Set object property: /b/newProp -> value: "string"', '----', oQuery.get('/b/newProp', obj) === 'string', '\n');
oQuery.set('/arr/3', 123, obj);
console.log('Set object property in array: /arr/3 -> value: 123', '----', oQuery.get('/arr/3', obj) === 123, '\n');
oQuery.remove('/arr/3', obj);
console.log('Remove object property in array: /arr/3', '----', oQuery.get('/arr/3', obj) === undefined, '\n');
oQuery.remove('/a', obj);
console.log('Remove object property: /a', '----', oQuery.get('/a', obj) === undefined, '\n');
|
beforeEach(function () {
jasmine.addMatchers({
toEqualData: function () {
return {
compare: function (actual, expected) {
var pass = angular.equals(actual, expected);
var toEqual = pass ? "not to equal" : "to equal";
return {
pass: pass,
message: "Expected " + angular.mock.dump(actual) + " data " + toEqual + " " + expected
};
}
};
},
toHaveText: function () {
return {
compare: function (actual, expected) {
var pass = actual.text().trim() === expected;
var toHave = pass ? "not to have" : "to have";
return {
pass: pass,
message: "Expected '" + angular.mock.dump(actual) + "' " + toHave + " the exact text '" + expected + "'"
};
}
};
},
toContainText: function () {
return {
compare: function (actual, expected) {
var text = actual.text();
var pass = text != null && (text.indexOf(expected) > -1 );
var toHave = pass ? "not to have" : "to have";
return {
pass: pass,
message: "Expected '" + angular.mock.dump(actual) + "' " + toHave + " the text '" + expected + "'"
};
}
};
},
toHaveClass: function () {
return {
compare: function (actual, expected) {
var pass = actual.hasClass(expected);
var toHave = pass ? "not to have" : "to have";
return {
pass: pass,
message: "Expected '" + angular.mock.dump(actual) + "' " + toHave + " a class '" + expected + "'."
};
}
};
},
toHaveAttr: function () {
return {
compare: function (actual, attributeName, expectedAttributeValue) {
var pass = expectedAttributeValue === undefined ? attributeName !== undefined : actual.attr(attributeName) === expectedAttributeValue;
var toHave = pass ? "not to have" : "to have";
return {
pass: pass,
message: "Expected '" + angular.mock.dump(actual) + "' " + toHave + " attribute '" + attributeName + "' with value " + expectedAttributeValue + "."
}
}
};
},
toBeHidden: function () {
return {
compare: function (actual) {
var expected = 'ng-hide';
var pass = actual.hasClass(expected);
var toHave = pass ? "not to have" : "to have";
return {
pass: pass,
message: "Expected '" + angular.mock.dump(actual) + "' " + toHave + " a class '" + expected + "'."
};
}
};
}
});
});
|
require('./styles.css');
const html = require('./template.html');
function init(element) {
element.innerHTML += html;
}
module.exports = {
init
};
|
$.fn.extend({
// NOTE: this function does not always return a jQuery object!
amarkalUIComponent: function( method ) {
// Store arguments for use with methods
var args = arguments.length > 1 ? Array.apply(null, arguments).slice(1) : null,
selection, methodReturnVal;
selection = this.each(function() {
if(!$(this).hasClass('amarkal-ui-component')) {
throw "This element is not an Amarkal UI component";
}
// If this is the initial call for this component, instantiate a new
// component object
if( typeof $(this).data('amarkal-ui-component') === 'undefined' ) {
$(this).data('amarkal-ui-component', Amarkal.UI.createComponent($(this)));
}
// If this is a method call, run the method (if it exists)
var comp = $(this).data('amarkal-ui-component');
if( typeof method !== 'undefined' && comp.hasOwnProperty(method)) {
// Override the return value when calling a method
methodReturnVal = comp[method].apply(comp, args);
// If a method returns a value, only call it for the first
// element in the set
if(typeof methodReturnVal !== 'undefined') {
return false;
}
}
});
return typeof methodReturnVal !== 'undefined' ? methodReturnVal : selection;
}
});
|
function padDigits(number, digits) {
return Array(Math.max(digits - String(number).length + 1, 0)).join(0) + number;
}
|
import ShipLanePage from './ship_lane.vue';
export default ShipLanePage;
|
var blockedModule = {
find: function (UserBlocked, user, blocked) {
return UserBlocked.findOne({
or: [{
user: user.id,
blocked: blocked.id
}, {
blocked: user.id,
user: blocked.id
}]
});
},
isUserBlocked: function (UserBlocked, user, blocked) {
return blockedModule.find(UserBlocked, user, blocked).then(function (found) {
return found;
});
},
create: function (UserBlocked, user, blocked) {
return blockedModule.find(UserBlocked, user, blocked).then(function (found) {
if (found) {
return found;
}
return UserBlocked.create({
user: user.id,
blocked: blocked.id
}).then(function (created) {
return created;
});
});
},
remove: function (UserBlocked, user, blocked) {
return UserBlocked.destroy({
user: user.id,
blocked: blocked.id
});
}
};
module.exports = blockedModule;
|
/*
* This file is part of the cb50_ctrl distribution (https://github.com/johnerlandsson/cb50_ctrl).
* Copyright (c) 2017 John Erlandsson
*
* 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, version 3.
*
* 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 this program. If not, see <http://www.gnu.org/licenses/>.
*/
//Function for making deep copies of objects
function clone(obj) {
var copy;
// Handle the 3 simple types, and null or undefined
if (null == obj || "object" != typeof obj) return obj;
// Handle Date
if (obj instanceof Date) {
copy = new Date();
copy.setTime(obj.getTime());
return copy;
}
// Handle Array
if (obj instanceof Array) {
copy = [];
for (var i = 0, len = obj.length; i < len; i++) {
copy[i] = clone(obj[i]);
}
return copy;
}
// Handle Object
if (obj instanceof Object) {
copy = {};
for (var attr in obj) {
if (obj.hasOwnProperty(attr)) copy[attr] = clone(obj[attr]);
}
return copy;
}
throw new Error("Unable to copy obj! Its type isn't supported.");
}
//The module
angular.module("ParameterApp", ['ui-notification']).controller("ParameterCtrl", function($scope, $http, Notification) {
$scope.parametersLoaded = false;
$scope.runMsgVisible = false;
$scope.spinnerVisible = true;
$scope.parametersVisible = false;
$scope.parameters = {
regulator: {
Kp: 0.0,
Ki: 0.0,
min_istate: 0.0,
max_istate: 0.0
}
};
$scope.parameters_bck = {};
//Callback for send button
$scope.sendParameters = function() {
$http.post('put_parameters', {
message: $scope.parameters
}).then(function successCallback(response) {
Notification.success({
message: "Parameters written to server"
});
}, function errorCallback(response) {
Notification.error({
message: "Failed to write parameters"
});
});
};
//Callback for reset button
$scope.resetParameters = function() {
$scope.parameters = clone($scope.parameters_bck);
};
//Fetch parameters and process data from server on load
window.onload = function() {
//Fetch parameters
$http.get("get_parameters").then(function successCallback(response) {
$scope.parameters = response.data;
$scope.parameters_bck = clone($scope.parameters);
$scope.parametersLoaded = true;
}, function errorCallback(response) {
Notification.error({
message: "Failed to receive parameters from server."
});
});
// Fetch process data and check if recipe is running
$http.get("get_pd").then(function successCallback(response) {
if (response.data["run_recipe"]) {
$scope.runMsgVisible = true;
$scope.spinnerVisible = false;
} else {
if ($scope.parametersLoaded) {
$scope.spinnerVisible = false;
$scope.parametersVisible = true;
}
}
},
function errorCallback(response) {
Notification.error({
message: "Failed to receive process data from server."
});
});
}
}).config(function(NotificationProvider) { //Configure notifications
NotificationProvider.setOptions({
delay: 10000,
startTop: 20,
startRight: 10,
verticalSpacing: 20,
horizontalSpacing: 20,
positionX: 'left',
positionY: 'bottom'
});
});
|
module.exports = function () {
var mongoose = require('mongoose');
var UserSchema = mongoose.Schema({
username: String,
password: String,
firstName: String,
lastName: String,
email: String,
phone: String,
websites: [{type: mongoose.Schema.ObjectId, ref: 'WebsiteModel'}],
dateCreated: {type: Date, default: Date.now()}
}, {collection: 'user'});
return UserSchema;
};
|
var a00498 =
[
[ "L2CAP API", "a00499.html", null ]
];
|
import { combineReducers } from 'redux'
import repos from './RepoReducer'
const rootReducer = combineReducers({
repos
})
export default rootReducer
|
/*
* Dicziunari-Web -- Webserver backend for a multi-idiom Rhaeto-Romance
* online dictionary.
*
* Copyright (C) 2012-2013 Uli Franke (cls) et al.
*
* 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 3 of the License, 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 this program. If not, see <http://www.gnu.org/licenses/>.
*
* IMPORTANT NOTICE: All software, content, intellectual property coming
* with this program (usually contained in files) can not be used in any
* way by the Lia Rumantscha (www.liarumantscha.ch/) without explicit
* permission, as they actively block software innovation targeting the
* Rhaeto-Romance language.
*
*/
function qualifyURL(url) {
var a = document.createElement('a');
a.href = url;
return a.href;
}
function installSearchEngine(engine) {
if (window.external && ("AddSearchProvider" in window.external)) {
// Firefox 2 and IE 7, OpenSearch
window.external.AddSearchProvider(qualifyURL(engine));
} else {
// No search engine support (IE 6, Opera, etc).
alert("Ingün sustegn per maschinas da tscherchar.");
}
}
function installSearchEnginePuter() {
/* Had to use non-template style relative address. Hope we don't change the
* static file path.
*/
installSearchEngine("/static/search-plugin-puter.xml");
}
function installSearchEngineVallader() {
/* Had to use non-template style relative address. Hope we don't change the
* static file path.
*/
installSearchEngine("/static/search-plugin-vallader.xml");
}
function installSearchEngines() {
installSearchEngineVallader();
installSearchEnginePuter();
}
function clipb (text) {
window.prompt ("Copchar alla memoria d'immez: Ctrl+C, Enter/Esc", text);
}
|
/* Custom syntax highlighter for SpaceWorld setting for brace
* (which is used by react-ace editor).
* Expects global ace variable to be present.
* Usage:
* ```
* import AceEditor from 'react-ace';
* import '../core/spaceWorldHighlighter';
* ...
* <AceEditor mode="spaceworld" />
* ```
*/
/* global ace:false */
/* eslint-disable no-param-reassign */
ace.define('ace/mode/spaceworld_highlight_rules',
['require', 'exports', 'ace/lib/oop', 'ace/mode/text_highlight_rules'],
(acequire, exports) => {
const oop = acequire('../lib/oop');
const TextHighlightRules = acequire('./text_highlight_rules').TextHighlightRules;
const colorTokens = {
black: 'text',
gray: 'comment',
red: 'constant.character',
green: 'keyword',
blue: 'variable',
cyan: 'string',
magenta: 'constant.numeric',
yellow: 'constant.language.boolean',
};
function SpaceWorldHighlightRules() {
this.$rules = {
start: [
{
token: colorTokens.black,
regex: 'k',
}, {
token: colorTokens.red,
regex: 'r',
}, {
token: colorTokens.green,
regex: 'g',
}, {
token: colorTokens.blue,
regex: 'b',
}, {
token: colorTokens.cyan,
regex: 'c',
}, {
token: colorTokens.magenta,
regex: 'm',
}, {
token: colorTokens.yellow,
regex: 'y',
}, {
token: colorTokens.black,
regex: '(S|D|A|M|W)',
}, {
}, {
token: colorTokens.gray,
regex: '\\|',
}, {
token: colorTokens.gray,
regex: '.',
},
],
};
}
oop.inherits(SpaceWorldHighlightRules, TextHighlightRules);
exports.SpaceWorldHighlightRules = SpaceWorldHighlightRules;
}
);
ace.define('ace/mode/spaceworld',
['require', 'exports', 'ace/lib/oop', 'ace/mode/text', 'ace/mode/spaceworld_highlight_rules'],
(acequire, exports) => {
const oop = acequire('../lib/oop');
const TextMode = acequire('./text').Mode;
const HighlightRules = acequire('./spaceworld_highlight_rules').SpaceWorldHighlightRules;
function Mode() {
this.HighlightRules = HighlightRules;
this.$behaviour = this.$defaultBehaviour;
}
oop.inherits(Mode, TextMode);
(function setId() {
this.$id = 'ace/mode/spaceworld';
}).call(Mode.prototype);
exports.Mode = Mode;
}
);
|
var structure=require('../structures/./assay')
var controller=require('../controllers/./getSpecifiedTables')
module.exports={
index
}
function index(study_id){
var sourceTable='Assay'
let where={study:study_id}
let tableConnections={
Assay_Modality:{
Modality:{
Factor:{}
}
}
,where
}
return controller(sourceTable,tableConnections,structure)
}
|
var alarmCtrl = function ($scope) {
$scope.currentListName = getCurrentListFromLocalStorage();
$scope.currentTodo = getCurrentTodoFromLocalStorage();
$scope.isAlarmSet = $scope.currentTodo.isAlarmSet;
$scope.alarmTime = null;
function getAlarmDate(time) {
alert(time);
var hours = Number(time.substr(0, 2));
var minutes = Number(time.substr(3, 2));
var alarmDate = new Date();
alert(alarmDate.getHours());
var isAlarmNextDay = alarmDate.getHours() < hours || alarmDate.getHours() == hours && alarmDate.getMinutes() <= minutes;
if (isAlarmNextDay) {
alarmDate.setDate(alarmDate.getDate() + 1);
}
alert(hours);
alarmDate.setHours(hours);
alarmDate.setMinutes(minutes);
return alarmDate;
}
var addAlarm = function (date) {
var data = {
"text": $scope.currentTodo.text,
"currentListName": $scope.currentListName
};
window.navigator.mozAlarms.add(date, "ignoreTimezone", data);
};
var setAlarm = function (time) {
var date = getAlarmDate(time);
addAlarm(date);
};
function updateCurrentTodo() {
$scope.currentTodo.isAlarmSet = !$scope.currentTodo.isAlarmSet;
saveCurrentTodoToLocalStorage($scope.currentTodo);
}
function goToMainPage() {
window.location.replace('/html/index.html');
}
$scope.setAlarm = function () {
if ($scope.alarmTime != null) {
setAlarm($scope.alarmTime);
updateCurrentTodo();
goToMainPage();
}
};
function removeAlarm() {
this.result.forEach(function (alarm) {
var isAlarmEqualToCurrentAlarm = (alarm.data.text == $scope.currentTodo.text && alarm.date.currentListName == $scope.currentListName);
if (isAlarmEqualToCurrentAlarm) {
window.navigator.mozAlarms.remove(alarm.id);
}
});
}
$scope.deleteAlarm = function () {
var request = window.navigator.mozAlarms.getAll();
request.onsuccess = function () {
removeAlarm.call(this);
updateCurrentTodo();
goToMainPage();
}
};
$scope.isAlarmSet = function () {
return $scope.currentTodo.isAlarmSet;
}
};
|
( function () {
'use strict';
var events = new Observers(
// Общение между choice.query и list
'queryChanged', // Доступна новая строка запроса
'resetQuery', // Запрос очистки строки запроса
// Общение между choice.list и counter
'editRecord', // Запрос редкатирования записи в counter'е
'appendRecord', // Запрос добавления записи в counter
// Общение между choice.pager и choice.list
'listReady', // list сообщает о том, что построен список продуктов
'drawPage' // pager требует отрисовать очередную страницу
);
angular
.module( 'counter.choice.events', [] )
.value( 'choiceEvents', events );
} () );
|
define(["exports", "../../../lit/index.js", "../../editable-table/editable-table.js"], function (_exports, _index, _editableTable) {
"use strict";
Object.defineProperty(_exports, "__esModule", {
value: true
});
_exports.GradeBookTable = void 0;
var _templateObject_6f5f68709bf111ec9d3703fd9549253d, _templateObject2_6f5f68709bf111ec9d3703fd9549253d, _templateObject3_6f5f68709bf111ec9d3703fd9549253d;
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = babelHelpers.getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = babelHelpers.getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return babelHelpers.possibleConstructorReturn(this, result); }; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
var GradeBookTable = /*#__PURE__*/function (_LitElement) {
babelHelpers.inherits(GradeBookTable, _LitElement);
var _super = _createSuper(GradeBookTable);
function GradeBookTable() {
var _this;
babelHelpers.classCallCheck(this, GradeBookTable);
_this = _super.call(this);
_this.editMode = false;
return _this;
}
babelHelpers.createClass(GradeBookTable, [{
key: "render",
value: function render() {
return (0, _index.html)(_templateObject_6f5f68709bf111ec9d3703fd9549253d || (_templateObject_6f5f68709bf111ec9d3703fd9549253d = babelHelpers.taggedTemplateLiteral(["\n <editable-table\n ?edit-mode=\"", "\"\n bordered\n column-header\n condensed\n disable-responsive\n scroll\n striped\n >\n <table>\n <tbody>\n <tr>\n <td>", "</td>\n <td>", "</td>\n <td>", "</td>\n </tr>\n ", "\n </tbody>\n </table>\n </editable-table>\n "])), this.editMode, this.t.letterGrade, this.t.highRange, this.t.lowRange, this.database.gradeScale.map(function (scale) {
return (0, _index.html)(_templateObject2_6f5f68709bf111ec9d3703fd9549253d || (_templateObject2_6f5f68709bf111ec9d3703fd9549253d = babelHelpers.taggedTemplateLiteral(["\n <tr>\n <td>", "</td>\n <td>", "</td>\n <td>", "</td>\n </tr>\n "])), scale.letter, scale.highRange, scale.lowRange);
}));
}
}], [{
key: "tag",
get: function get() {
return "grade-book-table";
}
}, {
key: "properties",
get: function get() {
return {
editMode: {
type: Boolean,
attribute: "edit-mode",
reflect: true
}
};
}
}, {
key: "styles",
get: function get() {
return [(0, _index.css)(_templateObject3_6f5f68709bf111ec9d3703fd9549253d || (_templateObject3_6f5f68709bf111ec9d3703fd9549253d = babelHelpers.taggedTemplateLiteral(["\n :host {\n display: block;\n }\n "])))];
}
}]);
return GradeBookTable;
}(_index.LitElement);
_exports.GradeBookTable = GradeBookTable;
customElements.define(GradeBookTable.tag, GradeBookTable);
});
|
function addShape(name, shape, color, x, y, z, rx, ry, rz, s) {
var ROOT = this;
ROOT.group = new THREE.Group();
var geometry = new THREE.ShapeGeometry(shape);
var material = new THREE.MeshBasicMaterial({
color: color,
overdraw: 0.5
});
ROOT.mesh = new THREE.Mesh(geometry, material);
ROOT.mesh.position.set(x, y, z);
ROOT.mesh.rotation.set(rx, ry, rz);
ROOT.mesh.scale.set(s, s, s);
ROOT.group.add(ROOT.mesh);
// line
var geometry = shape.createPointsGeometry();
var material = new THREE.LineBasicMaterial({
linewidth: 10,
color: 0x333333,
transparent: true
});
var line = new THREE.Line(geometry, material);
line.position.set(x, y, z);
line.rotation.set(rx, ry, rz);
line.scale.set(s, s, s);
ROOT.group.add(line);
scene.add(ROOT.group);
window[name] = ROOT.group;
ROOT.name = name;
ROOT.DESTROY = function () {
scene.remove(ROOT.group);
delete window[ROOT.name];
};
}
|
turingApp.controller('TurMLDataGroupDataCtrl', [
"$scope",
"$stateParams",
"$state",
"$rootScope",
"$translate",
"vigLocale",
"turMLDataGroupDataResource",
"$uibModal",
function($scope, $stateParams, $state, $rootScope, $translate,
vigLocale, turMLDataGroupDataResource, $uibModal) {
$scope.vigLanguage = vigLocale.getLocale().substring(0, 2);
$translate.use($scope.vigLanguage);
$rootScope.$state = $state;
$scope.mlDataGroupDatas = turMLDataGroupDataResource.query({
dataGroupId : $stateParams.mlDataGroupId
});
$scope.uploadDocument = function() {
var $ctrl = this;
$scope.data = {};
$scope.data.datagroupId = $stateParams.mlDataGroupId;
var modalInstance = $uibModal.open({
animation : true,
ariaLabelledBy : 'modal-title',
ariaDescribedBy : 'modal-body',
templateUrl : 'templates/ml/data/ml-document-upload.html',
controller : 'TurMLDataNewCtrl',
controllerAs : '$ctrl',
size : null,
appendTo : undefined,
resolve : {
data : function() {
return $scope.data;
}
}
});
modalInstance.result.then(function(response) {
//
}, function() {
// Selected NO
});
}
} ]);
|
/*
Copyright 2008 (C) Nicira, Inc.
This file is part of NOX.
NOX 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.
NOX 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 NOX. If not, see <http://www.gnu.org/licenses/>.
*/
dojo.provide("nox.apps.directory.directorymanagerws.UserGroup");
dojo.require("nox.apps.directory.directorymanagerws._PrincipalGroup");
dojo.require("nox.apps.directory.directorymanagerws.UserStore");
dojo.require("nox.apps.directory.directorymanagerws.UserGroupStore");
dojo.declare("nox.apps.directory.directorymanagerws.UserGroup", [ nox.apps.directory.directorymanagerws._PrincipalGroup ], {
wsv1Path: function () {
if (this.isNull()) {
return null;
}
return "/ws.v1/group/user/"
+ encodeURIComponent(this.directoryName()) + "/"
+ encodeURIComponent(this.groupName());
},
uiMonitorPath: function () {
if (this.isNull()) {
return null;
}
return "/Monitors/Groups/UserGroupInfo?name=" + encodeURIComponent(this._data.name);
},
parentGroupStore: function (kwarg) {
return new nox.apps.directory.directorymanagerws.UserGroupStore(dojo.mixin(kwarg, {
url: this.wsv1Path() + "/parent"
}));
},
principalMemberStore: function (kwarg) {
return new nox.apps.directory.directorymanagerws.UserStore(dojo.mixin(kwarg, {
url: this.wsv1Path() + "/principal"
}));
},
subgroupMemberStore: function (kwarg) {
return new nox.apps.directory.directorymanagerws.UserGroupStore(dojo.mixin(kwarg, {
url: this.wsv1Path() + "/subgroup"
}));
}
});
|
// @flow
import type { MatchConfig } from '../MatchConfig';
import type { MatchState } from '../MatchState';
import type { TransitionType } from '../TransitionType';
/**
* Player has earned a card from capturing territories and is one or more card
* that can be drawn.
*/
export default function HasEarnedCard(
config: MatchConfig,
{ cardOwner, captured }: MatchState
): TransitionType {
return {
guard: () => captured > 0 && cardOwner.some(owner => owner !== undefined),
reduce: () => {},
};
}
|
var searchData=
[
['score',['Score',['../class_score.html',1,'']]],
['shape',['Shape',['../class_shape.html',1,'']]],
['shapefactory',['ShapeFactory',['../class_shape_factory.html',1,'']]]
];
|
var App = angular.module("App", ["ionic"]);
App.service("ChileBitBook", ["$http","$log", ChileBitBook]);
App.controller("AppCtrl", ["$scope", "ChileBitBook", "$log", AppCtrl]);
function AppCtrl($scope, ChileBitBook, $log){
$scope.Bids = [];
$scope.Asks = [];
$scope.updateBook = function(){
ChileBitBook.getBook($scope);
};
}
function ChileBitBook($http, $log){
this.getBook = function($scope) {
$http.jsonp("https://api.blinktrade.com/api/v1/CLP/orderbook?callback=JSON_CALLBACK")
.success(function(result){
var Bid;
$.each(result.bids, function(index, stringBid){
Bid = {
Price: stringBid[0],
Volume: stringBid[1],
Id: stringBid[2],
};
$scope.Bids.push(Bid);
});
var Ask;
$.each(result.asks, function(index, stringAsk){
Ask = {
Price: stringAsk[0],
Volume: stringAsk[1],
Id: stringAsk[2],
};
$scope.Asks.push(Ask);
});
});
};
}
|
/**
* Adds a .btn-confirm class that will prompt for confirmation before completing an action
* Attributes:
* data-confirm-text: the message displayed in the confirmation dialog
* data-after-confirm: the js that will be evaled after successful confirmation
*
* Example
* <a href="/profile"
* class="btn btn-confirm"
* data-confirm-text="Are you sure you want to delete your account?"
* data-after-confirm="document.getElementById('destroy-account-form').submit();">
* Destroy my Account
* </a>
* <a href="">Destroy my Account</a>
*/
$('.btn-confirm').on('click', function (e) {
e.preventDefault();
var $btn = $(this);
var text = $btn.data('confirm-text');
if (text===undefined || text.length==0) {
text = "Are you sure?";
}
var callback = $btn.data('after-confirm')
if (callback==undefined && $btn.has('href')) {
callback = 'window.location = "' + $btn.attr('href') + '";';
}
window.bootbox.confirm(text, function (result) {
if (result==true) {
eval(callback);
}
});
});
|
function localStoragePolyFill() {
function createCookie(name, value, days) {
var expires;
if (days) {
var date = new Date();
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
expires = "; expires=" + date.toGMTString();
} else {
expires = "";
}
document.cookie = encodeURIComponent(name) + "=" + encodeURIComponent(value) + expires + "; path=/";
}
function readCookie(name) {
var results = document.cookie.match('(^|;) ?'+encodeURIComponent(name)+'=([^;]*)(;|$)');
return results ? decodeURIComponent(results[2]) : null;
}
function Storage(type) {
function setData(data) {
data = JSON.stringify(data);
if (type === 'session') {
createCookie(getSessionName(), data);
} else {
createCookie('localStorage', data, 365);
}
}
function clearData() {
if (type === 'session') {
createCookie(getSessionName(), '');
} else {
createCookie('localStorage', '', 365);
}
}
function getData() {
var data = readCookie(type === 'session' ? getSessionName() : 'localStorage');
return data ? JSON.parse(data) : {};
}
function getSessionName() {
if (!window.name) {
window.name = Math.random()+'-'+(new Date().getTime());
}
return 'sessionStorage-' + window.name;
}
// Initialize if there's already data.
var data = getData();
var obj = {
POLYFILLED: true,
length: 0,
clear: function() {
data = {};
this.length = 0;
clearData();
},
getItem: function(key) {
return Object.prototype.hasOwnProperty.call(data, key) ? data[key] : null;
},
key: function(i) {
var ctr = 0;
for (var k in data) {
if (ctr++ == i)
return k;
}
return null;
},
removeItem: function(key) {
if (Object.prototype.hasOwnProperty.call(data, key)) {
delete data[key];
this.length--;
setData(data);
}
},
setItem: function(key, value) {
if (!Object.prototype.hasOwnProperty.call(data, key)) {
this.length++;
}
data[key] = ''+value;
setData(data);
}
};
return obj;
}
var localStorage = new Storage('local');
var sessionStorage = new Storage('session');
try {
window.localStorage = localStorage;
window.sessionStorage = sessionStorage;
} catch(e) {}
try {
// For Safari private browsing need to also set the proto value.
window.localStorage.__proto__ = localStorage;
window.sessionStorage.__proto__ = sessionStorage;
} catch(e) {}
};
|
/*
* Participants Database Aux Plugin settings page support
*
* sets up the tab functionality on the plugin settings page
*
* @version 1.1
*
*/
PDbAuxSettings = (function ($) {
var tabsetup;
var wrapped;
var wrapclass;
var effect = {
effect : 'fadeToggle',
duration : 200
};
const lastTab = 'pdb-settings-page-tab';
const tabvar = 'settingstab';
var getCurrentTab = function () {
var currentTab = isNaN(Cookies.get(lastTab)) ? 0 : Cookies.get(lastTab);
if ( typeof URLSearchParams !== 'function' ) {
return currentTab; // if the browser doesn't support this function, return now
}
var urlTab = new URLSearchParams(window.location.search).get(tabvar);
if (urlTab) {
currentTab = urlTab;
}
return parseInt(currentTab);
}
var setupTabConfig = function () {
if ($.versioncompare("1.9", $.ui.version) == 1) {
tabsetup = {
fx : {
opacity : "show",
duration : "fast"
},
cookie : {
expires : 1
}
}
} else {
tabsetup = {
hide : effect,
show : effect,
active : getCurrentTab(),
activate : function (event, ui) {
Cookies.set(lastTab, ui.newTab.index(), {
expires : 365, path : ''
});
}
}
}
}
var wrapTabs = function () {
if (wrapped.length) {
wrapped.each(function () {
$(this).parent().append($(this).parent().nextUntil("div.ui-tabs-panel"));
});
$(".ui-tabs-panel").each(function (index) {
var str = $(this).find('a').attr('name').replace(/\s/g, "_");
$(this).attr("id", str.toLowerCase());
});
$(".pdb-aux-settings-tabs").removeClass().addClass(wrapclass + " main");
$('.pdb-aux-settings-tabs .ui-tabs').tabs(tabsetup).bind('tabsselect', function (event, ui) {
var activeclass = $(ui.tab).attr('href').replace(/^#/, '');
$(".pdb-aux-settings-tabs").removeClass().addClass(wrapclass + " " + activeclass);
});
$("form").attr("autocomplete", "off");
}
}
return {
init : function () {
wrapped = $(".pdb-aux-settings-tabs .ui-tabs>h2, .pdb-aux-settings-tabs .ui-tabs>h3").wrap("<div class=\"ui-tabs-panel\">");
wrapclass = $('.pdb-aux-settings-tabs').attr('class');
setupTabConfig();
wrapTabs();
}
}
}(jQuery));
jQuery(function () {
PDbAuxSettings.init();
});
|
var Serial = require('serialport');
function scan (pattern, cb) {
if (!cb) { cb = pattern; pattern = 'DexCom_Gen4_USB'; }
var opt = {baudRate: 9600};
Serial.list(scanned);
function scanned (err, list) {
var candidates = list.map(function (el) {
if (el && el.pnpId) {
if (el.pnpId.match(pattern)) {
return new Serial.SerialPort(el.comName, opt);
}
}
});
cb(null, candidates);
}
}
module.exports = scan;
|
import {findNode, processNode} from 'utils/common';
import {setFileInputData, initSearch, sendReceipt} from 'utils/engines';
const engine = 'tmview';
async function search({session, search, image, storageIds}) {
// previous search may be cached
processNode(
'.image-remove button',
function (node) {
if (node && !document.querySelector('.area-selection')) {
node.click();
}
},
{throwError: false}
);
const inputSelector = 'input[type=file]';
const input = await findNode(inputSelector);
await setFileInputData(inputSelector, input, image);
input.dispatchEvent(new Event('change', {bubbles: true}));
await findNode('.image-tools');
await sendReceipt(storageIds);
(await findNode('button[data-test-id=search-button]')).click();
}
function init() {
initSearch(search, engine, taskId);
}
init();
|
/*!
* jquery.counterup.js 1.0
*
* Copyright 2013, Benjamin Intal http://gambit.ph @bfintal
* Released under the GPL v2 License
*
* Date: Nov 26, 2013
*
* Modified: dependency to inview js instead of Waypoint
*/
(function(e){"use strict";e.fn.counterUp=function(t){var n=e.extend({time:400,delay:10},t);return this.each(function(){var t=e(this),r=n,i=function(){var e=[],n=r.time/r.delay,i=t.text(),s=/[0-9]+,[0-9]+/.test(i);i=i.replace(/,/g,"");var o=/^[0-9]+$/.test(i),u=/^[0-9]+\.[0-9]+$/.test(i),a=u?(i.split(".")[1]||[]).length:0;for(var f=n;f>=1;f--){var l=parseInt(i/n*f);u&&(l=parseFloat(i/n*f).toFixed(a));if(s)while(/(\d+)(\d{3})/.test(l.toString()))l=l.toString().replace(/(\d+)(\d{3})/,"$1,$2");e.unshift(l)}t.data("counterup-nums",e);t.text("0");var c=function(){t.text(t.data("counterup-nums").shift());if(t.data("counterup-nums").length)setTimeout(t.data("counterup-func"),r.delay);else{delete t.data("counterup-nums");t.data("counterup-nums",null);t.data("counterup-func",null)}};t.data("counterup-func",c);setTimeout(t.data("counterup-func"),r.delay)};t.one("inview",i)})}})(jQuery);
|
var __v=[
{
"Id": 1556,
"Panel": 853,
"Name": "TP",
"Sort": 0,
"Str": ""
},
{
"Id": 1557,
"Panel": 853,
"Name": "anti-anti",
"Sort": 0,
"Str": ""
}
]
|
/*
Copyright 2008 (C) Nicira, Inc.
This file is part of NOX.
NOX 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.
NOX 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 NOX. If not, see <http://www.gnu.org/licenses/>.
*/
/* Mix-in class to implement sorting for updating lists. */
dojo.provide("nox.apps.coreui.coreui._ItemSort");
dojo.declare("nox.apps.coreui.coreui._ItemSort", [ ], {
_get_item_dom_node: function (item) {
throw Error("Method must be implemented by subclass");
},
_get_dom_node_item: function (node) {
throw Error("Method must be implemented by subclass");
},
_get_num_item_dom_nodes: function () {
throw Error("Method must be implemented by subclass");
},
_get_item_dom_node_idx: function (idx) {
throw Error("Method must be implemented by subclass");
},
_get_store: function () {
throw Error("Method must be implemented by subclass");
},
_cmp_attr: function (item1, item2) {
if(item2 == null)
return -1;
if(item1 == null)
throw "first item in _cmp_attr should not be null";
var store = this._get_store();
for (i = 0; i < this.sort.attr.length; i++) {
var v1 = store.getValue(item1, this.sort.attr[i]);
var v2 = store.getValue(item2, this.sort.attr[i]);
if (v1 < v2)
return -1;
else if (v1 > v2)
return 1;
}
return 0
},
_insert_helper: function (item) {
var n = null;
var m = (this.sort.decreasing == true) ? -1 : 1;
var lower = 0;
var upper = this._get_num_item_dom_nodes();
while (lower != upper) {
var i = Math.floor((upper - lower)/2);
n = this._get_item_dom_node_idx(lower + i);
var z = this._get_dom_node_item(n);
var r = m * this.sort.cmp.call(this, item, z);
if (r < 0) {
// Item should be inserted earlier
upper = lower + i;
} else if (r > 0) {
// Item should be inserted later
n = this._get_item_dom_node_idx([lower + i + 1]);
lower = lower + i + 1;
} else {
// Found equivalent item
break;
}
}
// Append at end of list of equivalent items
while (n != null && this.sort.cmp.call(this, item, this._get_dom_node_item(n)) == 0)
n = n.nextSibling;
return n;
},
_node_to_insert_before: function (item) {
if (this.sort == null || this.sort == "") {
// If not sorting, append to end of list
return null;
} else {
// Identify insertion point by binary search
return this._insert_helper(item);
}
},
postMixInProperties: function () {
if (this.sort != null) {
if (this.sort.cmp == null)
this.sort.cmp = this._cmp_attr;
if (typeof(this.sort.attr) == "string")
this.sort.attr = [ this.sort.attr ];
}
}
});
|
"use strict";jQuery.noConflict();function gs_search_topics_site_homepage(){var b="#gs-search-topic-site-home-search",a=null;
a=GSSearch(b,"/s/search.ajax",0,10,{mg:"1"},null);jQuery("#gs-site-home-activity-tabs li:first-child a").click();
a.load()}jQuery(document).ready(function(){gsJsLoader.with_module("/++resource++gs-search-base-js-min-20140313.js",gs_search_topics_site_homepage)
});
|
'use strict';
var execSync = require('child_process').execSync;
function releaseTime(packageName) {
var cmd = 'yarn info ' + packageName + ' time --json';
var stdout = null;
try {
stdout = execSync(cmd);
} catch(e) {
process.stderr.write('Failed to run: ' + cmd + '\n');
process.stderr.write(error.message);
process.exit(1);
}
if (stdout === '') {
process.stderr.write('yarn info produced no output, no idea why');
process.exit(1);
}
var parsed = JSON.parse(stdout);
return parsed.data;
}
module.exports = releaseTime;
|
var path=require('path');
var configuration=require("config-tea");
var serviceFactory=require("../lib/server/serviceFactory");
describe("service section handler", function(){
beforeAll(function(){
var manager=configuration.ConfigurationManager;
manager.initFromFile(path.resolve(__dirname, "./app.config"));
});
it("can load service class",function(){
expect(serviceFactory.contains("sample")).toBeTruthy();
});
});
|
module.exports = require('./webpack.common');
|
$(document).ready(init);
function init() {
block();
$('form select').select2({
width: "100%"
});
// Only numeric fields
$('.deliveryYear').integerInput();
// event to filter the deliverables subtypes
$(".capdevDeliverableType").on("change", changeDeliverableType);
}
var $supportDocsList = $('table.supportDocsList');
var table = $supportDocsList.DataTable({
"bPaginate": true, // This option enable the table pagination
"bLengthChange": true, // This option disables the select table size option
"bFilter": true, // This option enable the search
"bSort": true, // this option enable the sort of contents by columns
"bAutoWidth": false, // This option enables the auto adjust columns width
"iDisplayLength": 15, // Number of rows to show on the table,
aoColumnDefs: [
{
bSortable: false,
aTargets: [
-1,
]
}, {
sType: "natural",
aTargets: [
0
]
}
]
});
// event add link supporting document
$(".addCapdevsupportDocument").click(function() {
var $list = $(".documentList");
var $item = $("#document-template").clone(true).removeAttr("id");
$list.append($item);
$item.show('slow');
checkDocsItems($list);
updateDocument();
});
function block() {
var type = $(".capdevDeliverableType").val();
if(type == -1) {
$(".capdevDeliverableSubtype").attr('disabled', 'disabled');
}
}
// event remove link supporting document
$(".removeCapdevsupportDocument").click(function() {
var $list = $('.documentList');
var $item = $(this).parents('.documents');
$item.hide(1000, function() {
$item.remove();
checkDocsItems($list);
updateDocument();
});
})
function updateDocument() {
$(".documentList").find('.documents').each(function(i,e) {
// Set indexes
$(e).setNameIndexes(1, i);
});
}
function checkDocsItems(block) {
var items = $(block).find('.documents').length;
if(items == 0) {
$(block).parent().find('p.inf').fadeIn();
} else {
$(block).parent().find('p.inf').fadeOut();
}
}
// action remove link supporting document
$(".removeCapdevsupportDocument-action").click(function() {
console.log("removeCapdevsupportDocument");
var documentID = $(".documentID").val();
$.ajax({
'url': baseURL + '/delete_document_link.do',
'data': {
q: documentID
},
beforeSend: function() {
},
success: function(data) {
},
error: function() {
},
complete: function() {
}
});
})
// event to remove supporting document
$('#confirm-delete').on('show.bs.modal', function(e) {
$(this).find('.btn-ok').attr('href', $(e.relatedTarget).data('href'));
});
function changeDeliverableType() {
var deliverableID = $(".capdevDeliverableType").val();
if(deliverableID > 0) {
$.ajax({
'url': baseURL + '/filterDeliverablesSubtypes.do',
'data': {
q: deliverableID
},
'dataType': "json",
beforeSend: function() {
},
success: function(data) {
$(".capdevDeliverableSubtype").removeAttr('disabled');
var length = data.length;
$('.capdevDeliverableSubtype').empty();
$('.capdevDeliverableSubtype').append('<option value= -1>select option... </option>');
for(var i = 0; i < length; i++) {
$('.capdevDeliverableSubtype').append(
'<option value=' + data[i]['deliberableID'] + '>' + data[i]['deliberableName'] + '</option>');
}
},
error: function() {
},
complete: function() {
}
})
} else {
$(".capdevDeliverableSubtype").attr('disabled', 'disabled');
$('.capdevDeliverableSubtype').empty();
$('.capdevDeliverableSubtype').append('<option value= -1>select option... </option>');
}
}
|
'use strict';
/**
* @ngdoc function
* @name smartCityFrontEndApp.controller:IndAddressCtrl
* @description
* # SearchCtrl
* Controller of the smartCityFrontEndApp
*/
angular.module('smartCityFrontEndApp')
.controller('IndAddressCtrl', function ($scope, $rootScope) {
$scope.displayedView = 0;
$scope.animateSwitchClass = 'animate-switchLeft';
$scope.prev = function() {
if ($scope.displayedView > 0) {
$scope.animateSwitchClass = 'animate-switchRight';
$scope.displayedView--;
}
};
$scope.next = function() {
if ($scope.displayedView < 2) {
$scope.animateSwitchClass = 'animate-switchLeft';
if ($scope.displayedView !== 1){
$scope.displayedView++;
}
else{
$rootScope.$broadcast('getLatLon', function(){$scope.displayedView++;});
}
}
};
});
|
function $_(selector)
{
return document.querySelector(selector);
}
function $_a(selector)
{
return document.querySelectorAll(selector);
}
function str_to_element(text)
{
var div = document.createElement("div");
div.innerHTML = text;
return div.firstChild;
}
|
export { default as Bullet } from './bullet.js';
export { default as Player } from './player.js';
export { default as Weapon } from './weapon.js';
|
function APIError({ok, error, needed, provided}) {
this.name = error
this.message = ''
switch(error) {
case 'missing_scope':
this.message = `Add scopes: ${needed}`
break
case 'invalid_auth':
this.message = 'This token is invalid'
break
case 'token_revoked':
this.message = 'This token is revoked'
break
case 'not_authed':
this.message = 'Please input your token'
break
}
}
APIError.prototype = Error.prototype
APIError.prototype.constructor = APIError
module.exports = APIError
|
/*
Parameters:
index: n’th occurrence of the specified day
1 - first
2 - second
3 - third
4 - fourth
5 - fifth
6 - last
day: daynumber – javascript way where sunday is 0 and is saturday is 6
month: which is 1-12 [optional – defaults to current]
year: Full year – four digits [optional – defaults to current]
var myDay = getNthDayOfMonth(1, 0, 9, '');
console.log("first sunday in September "+myDay);
var myDay = getNthDayOfMonth(2, 0, 9, '');
console.log("second sunday in September "+myDay);
var myDay = getNthDayOfMonth(3, 0, 10, '');
console.log("third sunday in October "+myDay);
var myDay = getNthDayOfMonth(6, 0, 11, '');
console.log("last sunday in November "+myDay);
var myDay = getNthDayOfMonth(6, 0, 12, '');
console.log("last sunday in December "+myDay);
var myDay = getNthDayOfMonth(4, 0, 1, '');
console.log("4th sunday in January?? "+myDay);
var myDay = getNthDayOfMonth(6, 0, 1, '');
console.log("last sunday in January 17 "+myDay);
var myDay = getNthDayOfMonth(6, 0, 1, '2018');
console.log("last sunday in January "+myDay);
*/
function getNthDayOfMonth(index, day, month, year) {
// Create date object
var date = new Date();
// Set to first day of month
date.setDate(1);
// If supplied – set the month
if (month !== '' && month !== undefined) {
// Set month
month -=1;
date.setMonth(month);
} else {
month = date.getMonth();
}
// If supplied – set the year
if (year !== '' && year !== undefined) {
// Set year
date.setFullYear(year);
} else {
year = date.getFullYear();
}
// Find daynumber
firstDay = date.getDay();
// Find first friday.
while (date.getDay() != day) {
date.setDate(date.getDate() + 1);
}
switch (index) {
case 2:
date.setDate(date.getDate() + 7);
break;
case 3:
date.setDate(date.getDate() + 14);
break;
case 4:
date.setDate(date.getDate() + 21);
break;
case 5:
date.setDate(date.getDate() + 28);
if (date.getMonth() !== month) {
date = null;
}
break;
case 6:
// 6 denotes the last {day} of the month (last sunday)
month += 1;
var firstDayOfNextMonth = new Date((month == 12 ? 1 : month + 1) + '/01/' + '/' + (month == 12 ? year + 1 : year));
//Getting the Last Day of the given month and year
var lastDayofThemonth = new Date(firstDayOfNextMonth-1);
var lastSundayOfTheMonth= new Date();
for(i=0; i<=7; i++)
{
var tempDate = new Date(month + '/' + (lastDayofThemonth.getDate() - i) + '/' + year);
if(tempDate.getDay() ==0)
{
date = tempDate;
break;
}
}
break;
}
return date;
}
|
/**
* GaiaEHR (Electronic Health Records)
* Copyright (C) 2013 Certun, LLC.
*
* 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 3 of the License, 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 this program. If not, see <http://www.gnu.org/licenses/>.
*/
Ext.define('App.model.areas.PoolArea', {
extend: 'Ext.data.Model',
table: {
name:'pool_areas'
},
fields: [
{
name: 'id',
type: 'int'
},
{
name: 'title',
type: 'string',
len: 80
},
{
name: 'floor_plan_id',
type: 'int'
},
{
name: 'facility_id',
type: 'int'
},
{
name: 'sequence',
type: 'int'
},
{
name: 'active',
type: 'bool'
}
]
});
|
var dir_5cd59005dcaf1c2fb34106390b8ffe09 =
[
[ "bmp085.c", "bmp085_8c.html", "bmp085_8c" ]
];
|
/**
* Created by jcchoiling on 2/1/2017.
*/
b = function(){
$.extend({
'func2': function(arg){
console.log('func: '+arg);
}
});
function f1(){
}
};
b();
|
/**
* Created by xiyuan on 17-6-5.
*/
vOn(function ($app) {
$app.directive('v-on', {
priority:100,
//属性作用域
props: function (expStr,expInfo) {
var vnode=this.vnode,
oldEventFn;
return [
{
exp:expStr,
key:'eventFn',
watch:function (newEventFn) {
vnode.removeListener(expInfo.type||'click',oldEventFn,false);
vnode.addEventListener(expInfo.type||'click',oldEventFn=newEventFn,false);
}
}
]
}
});
})
|
let MenuService = ($resource, API_URL) => {
'ngInject';
return $resource(API_URL+'/api/menu/:menuId', {menuId: '@_id'})
};
export default MenuService
|
var teamOperations = {
getSavedTeams: function () {
var savedTeams = [];
for (var key in localStorage) {
if (localStorage.hasOwnProperty(key)) {
var teamName = key.match(/^team::(.+)$/);
if (teamName !== null) {
savedTeams.push(teamName[1]);
}
}
}
if (!savedTeams.length) {
return [];
}
var collator = new Intl.Collator(undefined, {numeric: true, sensitivity: 'base'});
savedTeams.sort(collator.compare);
savedTeams = savedTeams.map(function (name) {
return {text: name, value: name};
});
return savedTeams;
},
import: function () {
bootbox
.prompt({
title: "Paste previous exported string with your team configuration.",
inputType: 'textarea',
callback: function (config) {
if (config === null) {
return;
}
var importedTeam = LZString.decompressFromEncodedURIComponent(config);
if (!teamHeroes.loadFromString(importedTeam)) {
bootbox.alert({
message: 'Invalid input string :('
});
} else {
teamHeroes.save();
}
}
})
.init(function () {
var $textarea = $('.modal').find('textarea.bootbox-input-textarea');
$textarea.css('height', '300px');
});
},
export: function () {
bootbox
.alert({
title: "Copy this string to a text file, to save your team configuration.",
message: "<textarea class='bootbox-input bootbox-input-textarea form-control'></textarea>"
})
.init(function () {
var $textarea = $('.modal').find('textarea.bootbox-input-textarea');
$textarea.css('height', '300px');
$textarea.val(LZString.compressToEncodedURIComponent(localStorage.getItem('heroes::user')));
setTimeout(function () {
$textarea.select();
}, 1000);
});
},
save: function () {
bootbox.prompt({
title: "Save your current team under specified name.",
callback: function (name) {
if (name === null) {
return;
}
localStorage.setItem('team::' + name, teamHeroes.serialize());
}
});
},
load: function () {
var savedTeams = this.getSavedTeams();
if (!savedTeams.length) {
bootbox.alert({
message: "You don't have any saved teams."
});
} else {
bootbox
.prompt({
title: "Select team to load.<br />" +
"<small class='text-danger'><strong>Warning!</strong> Current team will be replaced by loaded team!</small>",
inputType: 'select',
inputOptions: savedTeams,
callback: function (name) {
if (name === null) {
return;
}
localStorage.setItem('heroes::user', localStorage.getItem('team::' + name));
teamHeroes.load();
}
})
.init(function () {
$('.modal').find('select.bootbox-input-select').selectpicker();
});
}
},
delete: function () {
var savedTeams = this.getSavedTeams();
if (!savedTeams.length) {
bootbox.alert({
message: "You don't have any saved teams."
});
} else {
bootbox
.prompt({
title: "Selected teams will be removed from your browser.<br />" +
"<small class='text-danger'><strong>Warning!</strong> This action cannot be undone!</small>",
inputType: 'checkbox',
inputOptions: savedTeams,
callback: function (names) {
if (names === null) {
return;
}
names.forEach(function (name) {
localStorage.removeItem('team::' + name);
});
}
});
}
}
};
|
import $ from 'jquery'
import React from 'react';
import gql from 'graphql-tag';
import {graphql} from 'react-apollo';
import moment from 'moment';
import {Link} from 'react-router';
import scrollToElement from 'scroll-to-element';
let Home = React.createClass({
componentDidMount(){
require('../assets/css/main.css')
},
handleScrolly(e){
scrollToElement("#two", {
duration: 1500,
offset: 0,
ease: 'in-sine'
})
},
render(){
let {
postData,
theConfig,
data,
thePagination,
loadDone,
isHome
} = this.props
// debugger
return (
<div>
<header id="header">
<div className="content">
<Link to="/">
<img src={ require('images/logo-128.png') } alt="" />
</Link>
<p>{theConfig?theConfig.tagline:"Hello"}<br />
Just a simple, single page responsive</p>
<div className="actions">
<a href="#two" className="button icon fa-chevron-down scrolly" onClick={this.handleScrolly}>Learn More</a>
</div>
</div>
<div className="inner">
<nav id="menu">
{this.props.theMenu()}
</nav>
</div>
</header>
<section id="two" className="wrapper">
<div className="inner alt">
{postData &&
<section className="spotlight">
<div className="image">
<img src={postData.imageFeatured ? postData.imageFeatured.blobUrl: require('images/logo-128.png') } alt="" />
</div>
<div className="content">
<h3>{postData.title && postData.title}</h3>
<p dangerouslySetInnerHTML={{__html: postData.content ? postData.content :""}} />
</div>
</section>
}
</div>
</section>
<section id="three" className="wrapper style2 special" style={{ padding: 50 }}>
<div className="row">
{this.props.footerWidgets &&
this.props.footerWidgets.map((fw, idx) => <div className="4u">{fw}</div>)}
</div>
</section>
<footer id="footer">
<ul className="icons">
<li><a href="#" className="icon fa-facebook"><span className="label">Facebook</span></a></li>
<li><a href="#" className="icon fa-twitter"><span className="label">Twitter</span></a></li>
<li><a href="#" className="icon fa-instagram"><span className="label">Instagram</span></a></li>
</ul>
<p className="copyright">© Rendact Team. Credits: <a href="http://html5up.net">HTML5 UP</a></p>
</footer>
</div>
)
}
});
export default Home;
|
import $ from "jquery";
$(function(){
$("#mobile-trigger").on("click", function(event){
event.preventDefault();
$("body").toggleClass("sidebar-visible");
});
});
|
//
// hotkey handling and remapping.
//
//
//
import {createMask, runAction} from './wings3d.js';
const keyMap = new Map;
function runHotkeyAction(mode, event) {
// extract alt, ctrl, shift key
const meta = createMask(event.altKey, event.ctrlKey, event.shiftKey);
// extract key
const hotkey = event.key.toLowerCase();
// run the binding function
let metaSet = keyMap.get(hotkey);
if (metaSet) {
// check mode specific first
for (let value of metaSet) {
if ( (meta === value.meta) && (value.mode === mode)) { // has all the meta
runAction(0, value.id, event);
return;
}
}
// check for non-mode, if no mode specific found
for (let value of metaSet) {
if ( (meta === value.meta) && (value.mode === null)) { // has all the meta
runAction(0, value.id, event);
return;
}
}
}
};
function setHotkey(mode, id, hotkey, meta='') {
hotkey = hotkey.toLowerCase();
meta = meta.toLowerCase();
const metaMask = createMask(meta.indexOf('alt') > -1, meta.indexOf('ctrl') > -1, meta.indexOf('shift') > -1);
if (!keyMap.has(hotkey)) {
keyMap.set(hotkey, []);
}
keyMap.get(hotkey).unshift({mode: mode, meta: metaMask, id: id});
};
export {
runHotkeyAction,
setHotkey
}
|
Joomla 3.3.3 = a1fb7849ead53b3133513fbad848b4ba
Joomla 3.6.4 = aaecc3182b565dd36a0ec82519d63a62
Joomla 3.2.1 = b2e77f60ce752902efc1d40a4ff702ba
Joomla 3.2.7 = bd0b0f68e47701c5f6fc85caefab458a
Joomla 3.4.8 = 25917fb0c34e22440af7f5814b8744af
Joomla 3.5.1 = f8f778255e55dd60d752f86dde857e97
Joomla 3.7.0 = 815d90d0b7389f3014238facc039cfe2
|
/*jshint esversion: 6*/
export default class BaseTask {
constructor(obj) {
for (let prop in obj) {
this[prop] = obj[prop];
}
if (!this.name) this.name = 'default';
if (!this.deps) this.deps = '';
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.