text
stringlengths 2
6.14k
|
|---|
function displayThumbs(scrollId) {
$("#thumbs img:first").addClass("selected");
$(".jTscroller").removeAttr("style");
$(".jTscrollerContainer").removeAttr("style");
$(".jThumbnailScroller").removeAttr("style");
$(".jThumbnailScroller").attr("id", scrollId);
$("#" + scrollId).thumbnailScroller({
scrollerType:"hoverPrecise",
scrollerOrientation:"horizontal",
scrollSpeed:2,
scrollEasing:"easeOutCirc",
scrollEasingAmount:600,
acceleration:4,
scrollSpeed:800,
noScrollCenterSpace:10,
autoScrolling:0,
autoScrollingSpeed:2000,
autoScrollingEasing:"easeInOutQuad",
autoScrollingDelay:500
});
}
|
$(function()
{
$(".btn-primary").on('click',function() {
$(this).removeClass("btn-primary").addClass("btn-default");
});
});
|
import AppBar from './app-bar';
import AutoComplete from './text-fields/auto-complete';
import Avatar from './avatar';
import BottomSheet from './bottom-sheet';
import Chip from './chip';
import DialogAlert from './dialog/alert';
import DialogFullScreen from './dialog/full-screen';
import FontIcon from './font-icon';
import IconButton from './buttons/icon-button';
import FlatButton from './buttons/flat-button';
import FloatingActionButton from './buttons/floating-action-button';
import MenuItem from './menu/item';
import MenuDropDown from './menu/drop-down';
import RaisedButton from './buttons/raised-button';
import Card from './card';
import CardHeader from './card/card-header';
import Header from './header';
import List from './list/index';
import ListItem from './list/item';
import Tabs from './tabs/index';
import Tab from './tabs/tab';
import Paper from './paper';
import PickerDate from './picker/date';
import RichMedia from './rich-media';
import SearchFilter from './text-fields/search-filter';
import Snackbar from './snackbar';
import Stepper from './stepper';
import StepperStep from './stepper/step';
import ProgressLinear from './progress/linear';
import InputText from './form/input-text';
import InputSelect from './form/input-select';
import InputArea from './form/input-area';
import InputControl from './form/input-control';
import SelectionControl from './form/selection-control';
import getClasses, { getClassesStatic } from './addons/get-classes';
import hasTouchEvents from './addons/has-touch-events';
import touchPoint from './addons/touch-point';
export {
AppBar,
AutoComplete,
Avatar,
BottomSheet,
DialogAlert,
DialogFullScreen,
FontIcon,
getClasses,
getClassesStatic,
hasTouchEvents,
IconButton,
FlatButton,
FloatingActionButton,
MenuItem,
MenuDropDown,
RaisedButton,
Card,
CardHeader,
Chip,
Header,
List,
ListItem,
Tab,
Tabs,
InputControl,
InputText,
InputSelect,
InputArea,
SelectionControl,
Paper,
PickerDate,
RichMedia,
SearchFilter,
Snackbar,
Stepper,
StepperStep,
ProgressLinear,
touchPoint
};
|
const root = 'https://support.wordpress.com';
export default {
ADDING_GOOGLE_APPS_TO_YOUR_SITE: `${root}/add-email/adding-google-apps-to-your-site`,
ADDING_USERS: `${root}/adding-users`,
ALL_ABOUT_DOMAINS: `${root}/all-about-domains`,
AUTO_RENEWAL: `${root}/auto-renewal`,
BANDPAGE_WIDGET: `${root}/widgets/bandpage-widget`,
CATEGORIES_VS_TAGS: `${root}/posts/categories-vs-tags`,
CHANGE_NAME_SERVERS: `${root}/domains/change-name-servers`,
CHANGE_NAME_SERVERS_FINDING_OUT_NEW_NS: `${root}/domains/change-name-servers/#finding-out-your-new-name-server`,
COMMENTS: `${root}/category/comments`,
COMMUNITY_TRANSLATOR: `${root}/community-translator`,
CONTACT: `https://wordpress.com/help/contact`,
CUSTOM_DNS: `${root}/domains/custom-dns`,
DOMAINS: `${root}/domains`,
EMAIL_FORWARDING: `${root}/email-forwarding`,
ENABLE_DISABLE_COMMENTS: `${root}/enable-disable-comments`,
EVENTBRITE: `${root}/eventbrite`,
EVENTBRITE_EVENT_CALENDARLISTING_WIDGET: `${root}/widgets/eventbrite-event-calendarlisting-widget`,
EXPORT: `${root}/export`,
FACEBOOK_EMBEDS: `${root}/facebook-integration/facebook-embeds`,
FACEBOOK_LIKE_BOX: `${root}/facebook-integration/#facebook-like-box`,
FOLLOWERS: `${root}/followers`,
GETTING_MORE_VIEWS_AND_TRAFFIC: `${root}/getting-more-views-and-traffic`,
GOOGLE_ANALYTICS: `${root}/google-analytics`,
GOOGLE_PLUS_EMBEDS: `${root}/google-plus-embeds`,
GRAVATAR_HOVERCARDS: `${root}/gravatar-hovercards`,
IMPORT: `${root}/import`,
INSTAGRAM_WIDGET: `${root}/instagram/instagram-widget`,
LIVE_CHAT: `${root}/live-chat`,
MANAGE_PURCHASES: `${root}/manage-purchases`,
MAP_EXISTING_DOMAIN: `${root}/domains/map-existing-domain`,
MAP_SUBDOMAIN: `${root}/domains/map-subdomain`,
MEDIA: `${root}/media`,
PUBLICIZE: `${root}/publicize`,
PUBLIC_VS_PRIVATE: `${root}/domains/register-domain/#public-versus-private`,
REFUNDS: `${root}/refunds`,
SEO_TAGS: `${root}/getting-more-views-and-traffic/#use-appropriate-tags`,
SETTING_PRIMARY_DOMAIN: `${root}/domains/#setting-the-primary-domain`,
SETTING_UP_PREMIUM_SERVICES: `${root}/setting-up-premium-services`,
SHARING: `${root}/sharing`,
START: `${root}/start`,
STATS_CLICKS: `${root}/stats/#clicks`,
STATS_REFERRERS: `${root}/stats/#referrers`,
STATS_SEO_TERMS: `${root}/stats/#search-engine-terms`,
STATS_SPAM_REFERRER: `${root}/stats/#marking-spam-referrers`,
STATS_TOP_POSTS_PAGES: `${root}/stats/#top-posts-pages`,
STATS_VIEWS_BY_COUNTRY: `${root}/stats/#views-by-country`,
SUPPORT_ROOT: `${root}/`,
TRANSFER_DOMAIN_REGISTRATION: `${root}/transfer-domain-registration`,
TWITTER_TIMELINE_WIDGET: `${root}/widgets/twitter-timeline-widget`,
USERS: `${root}/category/users`,
USER_ROLES: `${root}/user-roles`,
VIDEOS: `${root}/videos`
};
|
var Rect = require("utils/rect");
/** Resize a window
*
* @param options Options for resize
* @param callback
*/
function resize(options,callback) {
var winId = options.window.id,
info = options.updateInfo,
os = options.os,
updateInfo = {}; // The target rect
// $.extend(updateInfo,viewport.size().toData());
/*
if (rect.__proto__.constructor.name == "Rect"){
$.extend(updateInfo,rect.toData());
} else {
$.extend(updateInfo,rect);
} */
$.extend(updateInfo,info);
updateInfo.state = "normal";
/* Remarks:
*
* Sometimes Chrome on Ubuntu/Unity may not report the current state correctly.
* So set to "normal" by default. Otherwise, it may not be able to resize maximized window
*
*/
if (os == "MacOS") {
delete updateInfo.state; // Don't set normal in MacOS. The animation will be mad
}
if (os == "Linux") {
_resizeOnLinux(winId,updateInfo,callback);
} else {
chrome.windows.update(winId, updateInfo , callback);
}
}
/** A special resize function for Linux due to the #72369 bug for Chrome on Linux
*
*/
function _resizeOnLinux(winId,updateInfo,callback){
var lastSize = new Rect();
var newSize = new Rect();
var targetSize = new Rect(updateInfo);
function checker() { // Check is the resize frozen?
chrome.windows.get(winId,function(result) {
newSize = new Rect(result);
// console.log("checker",winId,lastSize,newSize,targetSize);
if (lastSize.equal(newSize) || newSize.equal(targetSize)) {
// Done!
if (callback)
callback(result);
} else {
lastSize = newSize;
setTimeout(checker,100);
}
});
}
lastSize = new Rect();
chrome.windows.update(winId, updateInfo , checker);
};
module.exports = resize;
|
/**
* Select2 Spanish translation
*/
(function ($) {
"use strict";
$.extend($.fn.select2.defaults, {
formatNoMatches: function () { return "No se encontraron resultados"; },
formatInputTooShort: function (input, min) { var n = min - input.length; return "Por favor, introduzca " + n + " car" + (n == 1? "ácter" : "acteres"); },
formatInputTooLong: function (input, max) { var n = input.length - max; return "Por favor, elimine " + n + " car" + (n == 1? "ácter" : "acteres"); },
formatSelectionTooBig: function (limit) { return "Sólo puede seleccionar " + limit + " elemento" + (limit == 1 ? "" : "s"); },
formatLoadMore: function (pageNumber) { return "Cargando más resultados…"; },
formatSearching: function () { return "Buscando…"; }
});
})(jQuery);
|
mui.init();
var postInfo = { 'page': 1 };
var activityUl = document.getElementById("activityUl");
var addActivityList = function(data) {
var li = document.createElement('li');
li.className = "mui-table-view-cell";
data.explain = imgTools.getDtlContent(data.explain);
li.innerHTML = template('activity_item_script', data);
mui(li.getElementsByClassName('activity-li-middle'))[0].innerHTML = data.explain;
return li;
}
mui.plusReady(function() {
mui('.mui-scroll').pullToRefresh({
up: {
auto: true,
callback: function() {
var pullObj = this;
activity.getActivityList(postInfo, function(res) {
if(res.data) {
for(i in res.data) {
var li = addActivityList(res.data[i]);
activityUl.appendChild(li);
}
res.data.length < 10 ? pullObj.endPullUpToRefresh(true) : pullObj.endPullUpToRefresh(false);
} else {
pullObj.endPullUpToRefresh(true);
}
})
postInfo.page++;
}
},
down: {
callback: function() {
var pullObj = this;
postInfo.page = 1;
activityUl.innerHTML = "";
activity.getActivityList(postInfo, function(res) {
if(res.data) {
for(i in res.data) {
var li = addActivityList(res.data[i]);
activityUl.appendChild(li);
}
pullObj.endPullDownToRefresh();
res.data.length < 10 ? pullObj.endPullUpToRefresh(true) : pullObj.endPullUpToRefresh(false);
} else {
pullObj.endPullDownToRefresh();
pullObj.endPullUpToRefresh(true);
}
})
}
}
})
mui('.mui-table-view').on('tap', '.activity-buttom', function() {
var type = this.id;
switch(type) {
case 'endBtn':
mui.toast('活动已经结束!');
break;
case 'joinBtn':
break;
case 'cancelBtn':
break;
}
})
})
|
'use strict';
angular.module('tpjpaApp')
.config(function ($stateProvider) {
$stateProvider
.state('metrics', {
parent: 'admin',
url: '/metrics',
data: {
roles: ['ROLE_ADMIN'],
pageTitle: 'metrics.title'
},
views: {
'content@': {
templateUrl: 'scripts/app/admin/metrics/metrics.html',
controller: 'MetricsController'
}
},
resolve: {
translatePartialLoader: ['$translate', '$translatePartialLoader', function ($translate, $translatePartialLoader) {
$translatePartialLoader.addPart('metrics');
return $translate.refresh();
}]
}
});
});
|
showWord(["n.","pwèl. Cheve tou kout ki sou po , anbabra epi sou pibis moun. Gason gen pwal sou lestomak yo men fi pa genyen."
])
|
var std = std || {};
std.vm = function () {
var studies = ko.observableArray([]),
defaultStudyId = 0,
studyitem = ko.observable(),
getstudies = function () {
$.ajax({
url: "/Json/GetStudies",
dataType: 'json',
cache: false,
success: function (d) {
studies([]);
$.each(d, function (i, data) {
studies.push(ko.mapping.fromJS(data));
});
}
});
},
sortBy = function (field) {
if (field) {
studies.sort(function (a, b) {
try {
return eval('a.' + field)() < eval('b.' + field)() ? -1 : 1;
} catch (e) {
return eval('a.' + field) < eval('b.' + field) ? -1 : 1;
}
});
}
},
gridViewModel = new ko.simpleGrid.viewModel({
data: studies,
columns: [
{
headerText: "Controls",
rowText: function (item) {
return '<button class="btn btn-mini edit" data-id=' + item.Id() + '><i class="icon-pencil"></i> Edit</button>';
},
sortColumnName: ''
},
{ headerText: "Name", rowText: function (item) { return item.Name(); }, sortColumnName: 'Name' },
{ headerText: "Description", rowText: function (item) { return item.Description(); }, sortColumnName: 'Description' },
{ headerText: "Targets", rowText: function (item) { return item.Target(); }, sortColumnName: 'Target' },
{ headerText: "Goals", rowText: function (item) { return item.Goal(); }, sortColumnName: 'Goal' },
{ headerText: "Budget", rowText: function (item) { return item.Budget(); }, sortColumnName: 'Budget' },
{
headerText: "Start Date",
rowText: function (item) {
try {
var dt = eval('new ' + item.StartDate().replace("/", '').replace("/", ''));
item.StartDate(dt.toDateString());
return dt.toDateString();
}catch (e) {
return 'N/A';
}
},
sortColumnName: 'StartDate'
},
{
headerText: "End Date",
rowText: function (item) {
try {
if (item.EndDate()) {
var dt = eval('new ' + item.EndDate().replace("/", '').replace("/", ''));
item.EndDate(dt.toDateString());
var enddate = dt.toDateString();
return enddate;
}
} catch (e) {
return 'N/A';
}
},
sortColumnName: 'EndDate'
},
{
headerText: "State",
rowText: function (item) {
if (item.IsActive()) {
return '<span class=\"span1 userstatus label label-success\" data-id=\"' + item.Id() + '\">Active</span>';
} else {
return '<span class=\"span1 userstatus label label-important\" data-id=\"' + item.Id() + '\">Inactive</span>';
}
return '';
},
sortColumnName: 'IsActive'
}
],
pageSize: 10
}),
newStudy = function () {
return {
Name: ko.observable(),
Description: ko.observable(),
StartDate: ko.observable(),
EndDate: ko.observable(),
Target: ko.observable(),
Goal: ko.observable(),
Budget: ko.observable(),
SortOrder: ko.observable(),
Status: ko.observable(1),
CreatedOn: ko.observable(),
UpdatedOn: ko.observable(),
CreatedBy: ko.observable(),
UpdatedBy: ko.observable(),
IsActive: ko.observable(true),
Arms: ko.observable(),
Drugs: ko.observable(),
Forms: ko.observable(),
Sites: ko.observable(),
Id: ko.observable(0),
};
};
return {
studies: studies,
defaultStudyId: defaultStudyId,
studyitem: studyitem,
newStudy: newStudy,
getstudies: getstudies,
sortBy: sortBy,
gridViewModel: gridViewModel
};
}();
$(document).ready(function () {
window.setTimeout(function () {
init();
std.vm.getstudies();
ko.applyBindings(std.vm);
}, 300);
});
function init() {
$("body").on("click", ".edit", function () {
var sid = $(this).attr('data-id');
var data = ko.utils.arrayFirst(std.vm.studies(), function (item) {
return item.Id() == sid;
});
$("#newstudy-modal").modal('show');
std.vm.studyitem(data);
});
$("#modellink").on("click", function () {
std.vm.studyitem(std.vm.newStudy());
});
$("body").on("click", ".userstatus", function () {
toastr.error($(this).data('id'));
});
$("body").on('click', ".sortableHead", function () {
var field = $(this).attr('sortname');
std.vm.sortBy(field);
});
}
|
/**
* @file
* Menu Link Weight Javascript functionality.
*/
(function ($) {
/**
* Automatically update the current link title in the menu link weight list.
*/
Drupal.behaviors.menuLinkWeightAutomaticTitle = {
attach: function (context) {
$('fieldset.menu-link-form', context).each(function () {
var $checkbox = $('.form-item-menu-enabled input', this);
var $link_title = $('.form-item-menu-link-title input', context);
var $current_selection = $('.menu-link-weight-link-current', context);
var $node_title = $(this).closest('form').find('.form-item-title input');
// If there is no title, take over the title of the link.
if ($current_selection.html() == '') {
$current_selection.html($link_title.val().substring(0, 30));
}
// Take over any link title change.
$link_title.keyup(function () {
$current_selection.html($link_title.val().substring(0, 30));
});
// Also update on node title change, as this may update the link title.
$node_title.keyup(function () {
$current_selection.html($link_title.val().substring(0, 30));
});
});
}
};
})(jQuery);
|
showWord(["n. ","son moun fè lè li ap wonfle.<br>"])
|
/**
* External dependencies
*/
import Dispatcher from 'dispatcher';
const wpcom = require( 'lib/wp' ).undocumented();
/**
* Internal dependencies
*/
import { actionTypes } from './constants';
import { toApi } from './common';
export function cancelImport( importerId ) {
Dispatcher.handleViewAction( {
type: actionTypes.CANCEL_IMPORT,
importerId
} );
}
export function failUpload( importerId, error ) {
Dispatcher.handleViewAction( {
type: actionTypes.FAIL_UPLOAD,
importerId,
error
} );
}
export function finishUpload( importerId, importerStatus ) {
Dispatcher.handleViewAction( {
type: actionTypes.FINISH_UPLOAD,
importerId, importerStatus
} );
}
export function mapAuthor( importerId, sourceAuthor, targetAuthor ) {
Dispatcher.handleViewAction( {
type: actionTypes.MAP_AUTHORS,
importerId,
sourceAuthor,
targetAuthor
} );
}
export function resetImport( importerId ) {
Dispatcher.handleViewAction( {
type: actionTypes.RESET_IMPORT,
importerId
} );
}
// Use when developing to force a new state into the store
export function setState( newState ) {
Dispatcher.handleViewAction( {
type: actionTypes.DEV_SET_STATE,
newState
} );
}
export function startMappingAuthors( importerId ) {
Dispatcher.handleViewAction( {
type: actionTypes.START_MAPPING_AUTHORS,
importerId
} );
}
export function setUploadProgress( importerId, data ) {
Dispatcher.handleViewAction( {
type: actionTypes.SET_UPLOAD_PROGRESS,
uploadLoaded: data.uploadLoaded,
uploadTotal: data.uploadTotal,
importerId
} );
}
export function startImport( importerType ) {
// Dev-only: this will come from an API call
let importerId = `${ Math.round( Math.random() * 10000 ) }`;
Dispatcher.handleViewAction( {
type: actionTypes.START_IMPORT,
importerId,
importerType
} );
}
export function startImporting( importerStatus ) {
const { importerId, site: { ID: siteId } } = importerStatus;
Dispatcher.handleViewAction( {
type: actionTypes.START_IMPORTING,
importerId
} );
wpcom.updateImporter( siteId, toApi( importerStatus ) );
}
export function startUpload( importerStatus, file ) {
let { id: importerId, site: { ID: siteId } } = importerStatus;
Dispatcher.handleViewAction( {
type: actionTypes.START_UPLOAD,
filename: file.name,
importerId
} );
wpcom.uploadExportFile( siteId, {
importStatus: toApi( importerStatus ),
file,
onload: ( error, data ) => {
if ( ! error ) {
return finishUpload( importerId, data );
}
failUpload( importerId, error.message );
},
onprogress: event => {
setUploadProgress( importerId, {
uploadLoaded: event.loaded,
uploadTotal: event.total
} );
},
onabort: () => cancelImport( importerId )
} );
}
|
// your answer would go here
$(function (){
var container = $('#rating-container');
$('#max-value').val('');
var update_circles =function (){
for (var i = 0; i < container.attr('max-value'); i++){
container.append('<div class="rating-circle"></div>');
}
}
$('#save-rating').click(function(){
$.post('http://jquery-edx.azurewebsites.net/api/Rating',
{
value: $('.rating-chosen').length,
maxValue: container.attr('max-value')
},
function(data) {
$('#output').text(data.message);
}
);
})
$('#update-max-value').click(function(){
$('.rating-circle').remove();
input_num = parseInt($('#max-value').val());
if (Number.isInteger(input_num) && input_num > 0 && input_num < 100){
container.attr('max-value', input_num);
}
else{
alert('Please input number from 1 to 99');
}
update_circles();
});
container.delegate('.rating-circle', 'mouseover', function(){
$('.rating-chosen').addClass('rating-chosen-removed');
$('.rating-chosen').removeClass('rating-chosen');
$(this).prevAll().andSelf().addClass('rating-hover');
});
container.delegate('.rating-circle', 'mouseout', function(){
$('.rating-chosen-removed').addClass('rating-chosen');
$('.rating-chosen').removeClass('rating-chosen-removed');
$(this).prevAll().andSelf().removeClass('rating-hover');
});
container.delegate('.rating-circle', 'click', function(){
$(this).prevAll().andSelf().addClass('rating-chosen');
$(this).nextAll().removeClass('rating-chosen-removed rating-chosen');
});
update_circles();
});
|
exports.config = {
seleniumServerJar: '../node_modules/protractor/selenium/selenium-server-standalone-2.45.0.jar',
// seleniumAddress: 'http://127.0.0.1:4444/wd/hub',
chromeDriver: '../node_modules/protractor/selenium/chromedriver',
specs: [
'./spec/*_spec.js',
],
// Patterns to exclude.
exclude: [
'excludeTest_spec.js'
],
capabilities: {
'browserName': 'chrome'
// 'browserName': 'firefox'
// 'browserName': 'safari'
},
//
// multiCapabilities: [
// {
// 'browserName': 'chrome',
// },
// {
// 'browserName': 'firefox',
// },
// ],
};
|
function gp_loadMediaButtonPopup(widget_name, shortcode, widget_title)
{
gp_hide_all_widget_popups();
var tag = jQuery('<div id="gold_plugins_popup"></div>');
var params = {
action: 'gold_plugins_insert_widget_popup',
widget_name: widget_name,
shortcode: shortcode
};
if (typeof(widget_title) == 'undefined') {
widget_title = '';
}
jQuery.ajax({
url: ajaxurl,
data: params,
success: function(data) {
dialog_options = {
modal: true,
width: 450,
title: widget_title
};
tag.html(data).dialog(dialog_options).dialog('open');
}
});
gp_hide_all_media_button_menus();
//gp_close_popup_on_outside_click();
}
function gp_insertWidgetIntoPost()
{
// get the real names of all fields
var frm = jQuery('#gold_plugins_popup form');
var shortcode = frm.data('shortcode');
if (shortcode.length == 0) {
return; // invalid shortcode, abort
}
var output = '[' + shortcode;
frm.find(':input').each(function ()
{
var val = jQuery(this).val();
// skip values that are marked 'shortcode-hidden'
if (jQuery(this).data('shortcode-hidden')) {
return true;
}
// skip checkboxes and radio buttons that are not checked
if (jQuery(this).attr('type') == 'radio' && jQuery(this).attr('checked') != 'checked' ) {
return true;
}
else if (jQuery(this).attr('type') == 'checkbox' && jQuery(this).attr('checked') != 'checked' ) {
if(!jQuery(this).data('shortcode-value-if-unchecked')){
return true;
} else {
// if this is a checkbox and it has the value if unchecked data attribute
// set the value used in the composed string to the value of this attribute
val = jQuery(this).data('shortcode-value-if-unchecked');
}
}
else if (jQuery(this).attr('type') == 'hidden') {
return true;
}
var old_name = jQuery(this).attr('name');
var override_name = jQuery(this).data('shortcode-key');
var real_name = '';
if (override_name) {
real_name = override_name;
} else {
var pos = old_name.indexOf('[__i__]');
if (pos > 0) {
var real_name = old_name.substr(pos + 8);
real_name = real_name.substr(0, real_name.length - 1); // chip off trailing '['
}
}
if (real_name && val.length > 0) {
output += ' ' + real_name + '="' + val + '"';
}
});
output += ']'; // close the shortcode
wp.media.editor.insert(output)
gp_hide_all_widget_popups();
gp_hide_all_media_button_menus();
}
var gp_hide_all_media_button_menus = function (button_group) {
jQuery('.gp_media_button_group_dropdown').css('display', 'none');
};
var gp_hide_all_widget_popups = function (button_group) {
jQuery('#gold_plugins_popup').each(function () {
jQuery(this).dialog('destroy');
});
};
var gp_toggle_media_button_menu = function (button_group) {
button_group = jQuery(button_group);
if (!button_group.is('.gp_media_button_group')) {
button_group = button_group.parents('.gp_media_button_group:first');
}
var dd = button_group.find('.gp_media_button_group_dropdown');
if (dd.is(':visible')) {
dd.css('display', 'none');
} else {
dd.css('display', 'block');
}
};
jQuery(function () {
var groups = jQuery('.gp_media_button_group');
groups.on('click', '.gp_media_button_group_toggle', function () {
gp_toggle_media_button_menu(this);
});
});
|
/*global angular*/
(function(angular, undefined) {
"use strict";
function CardsDeckCtrl() {
var ctrl = this;
}
CardsDeckCtrl.$inject = [];
angular
.module("cards.controllers.components")
.controller("CardsDeckCtrl", CardsDeckCtrl);
})(angular);
|
var utils = require('./utils'),
path = require('path'),
semver = require('semver'),
async = require('async');
exports.load = async.memoize(function (dir, callback) {
var settings_file = path.resolve(dir, 'package.json');
utils.readJSON(settings_file, function (err, settings) {
if (err) {
callback(err);
}
try {
exports.validate(settings, settings_file);
}
catch (e) {
return callback(e);
}
callback(null, settings);
});
});
exports.validate = function (settings, filename) {
if (!settings.name) {
throw new Error('Missing name property in ' + filename);
}
if (!/^[a-zA-Z][a-zA-Z0-9_\-\.]*$/.test(settings.name)) {
throw new Error(
'Invalid name property in ' + filename + ', ' +
'package names can only contain numbers, upper or lowercase ' +
'letters and "_", "-" or ".", and must start with a letter'
);
}
if (!settings.version) {
throw new Error('Missing version property in ' + filename);
}
if (!settings.description) {
throw new Error('Missing description property in ' + filename);
}
if (!semver.valid(settings.version)) {
throw new Error(
'Invalid version number in ' + filename + '\n' +
'Version numbers should follow the format described at ' +
'http://semver.org (eg, 1.2.3 or 4.5.6-jam.1)'
);
}
};
|
Ext.namespace("GEOR.Addons");
GEOR.Addons.Annotation = function(map, options) {
this.map = map;
this.options = options;
this.control = null;
this.item = null;
this.window = null;
};
// If required, may extend or compose with Ext.util.Observable
//Ext.extend(GEOR.Addons.Annotation, Ext.util.Observable, {
GEOR.Addons.Annotation.prototype = {
/**
* Method: init
*
* Parameters:
* record - {Ext.data.record} a record with the addon parameters
*/
init: function(record) {
var annotation = new GEOR.Annotation({
map: this.map,
popupOptions: {unpinnable: false, draggable: true}
});
this.window = new Ext.Window({
title: OpenLayers.i18n('annotation.drawing_tools'),
width: 440,
closable: false,
resizable: false,
border: false,
cls: 'annotation',
items: [{
xtype: 'toolbar',
border: false,
items: annotation.actions
}]
});
var lang = OpenLayers.Lang.getCode(),
item = new Ext.menu.CheckItem({
text: record.get("title")[lang] || record.get("title")["en"],
qtip: record.get("description")[lang] || record.get("description")["en"],
//iconCls: "addon-magnifier",
checked: false,
listeners: {
"checkchange": this.onCheckchange,
scope: this
}
});
this.item = item;
return item;
},
/**
* Method: onCheckchange
* Callback on checkbox state changed
*/
onCheckchange: function(item, checked) {
if (checked) {
this.window.show();
this.window.alignTo(
Ext.get(this.map.div),
"t-t",
[0, 5],
true
);
} else {
this.window.hide();
}
},
/**
* Method: destroy
* Called by GEOR_tools when deselecting this addon
*/
destroy: function() {
this.window.hide();
this.control = null;
this.map = null;
}
};
|
opensupports_version = '4.11.0';
root = 'http://localhost:3000';
apiRoot = 'http://localhost:3000/api';
globalIndexPath = '';
showLogs = true;
|
var express = require("express");
var router = express.Router();
var ObjectId = require('mongoose').Types.ObjectId;//by seif
var mongoose = require("mongoose");
var crypto = require('crypto'), shasum = crypto.createHash('sha1');
var bodyParser = require("body-parser");
var helpers = require("../util/helpers");
var validator = require("validator");
var jwt = require('jsonwebtoken');
router.get("/members/add", function (request, response) {
console.log("add member");
console.log("query :", request.query);
mongoose.model("groups").find({name: request.query.name}, function (err, group) {
console.log(group);
if (!err) {
if (helpers.isInArray(request.query.uid, group[0].members)) {
response.json({error: "user already in your followings"});
}
else {
group[0].members.push(request.query.uid);
group[0].save(function (error) {
if (error)
response.json({error: "error in handeling your request"});
response.json(group);
console.log(group);
});
}
}
})
});
router.post("/add", bodyParser.urlencoded({extended: false}), function (request, response) {
console.log("body", request.body);
var groupModel = mongoose.model("groups");
var group = new groupModel({
name: request.body.name,
owner: request.body.owner
});
group.save(function (err) {
if (!err) {
response.json(group);
console.log("add group sucess");
} else {
response.send(err);
response.status(400).json({error: "adding Failed"});
}
});
});
router.get("/search", function (request, response) {
switch (request.query.field) {
case "name":
mongoose.model("groups").find({
owner: request.query.user_id,
$text: {$search: request.query.q}
}).populate('members').exec(function (err, groups) {
if (err) {
response.status(400).json({error: err});
} else {
response.json(groups);
}
});
break;
}
});
router.get("/:id/list", function (request, response) {
console.log("list groups by user");
console.log("prams", request.params);
mongoose.model("groups").find({owner: new ObjectId(request.params.id)}, function (err, groups) {
console.log("result groups :", groups);
if (!err) {
response.json(groups);
}
else {
response.status(400).json({error: err});
}
});
});
router.get("/:id/members", function (request, response) {
console.log("list members");
console.log("params:",request.params.id)
mongoose.model("groups").findOne({_id: new ObjectId(request.params.id)}, {
_id: 0,
members: 1
}).populate("members").exec(function (err, members) {
console.log("prams", request.params);
if (err) {
response.json({error: "Not found"});
console.log("error in list members");
} else {
response.json(members);
console.log("members :", members);
}
})
});
router.delete("/:gid/members/:uid", function (request, response) {
console.log("delete member");
mongoose.model("groups").findById(request.params.gid, function (err, group) {
if (!err) {
if (helpers.isInArray(request.params.uid, group.members)) {
var deletedUser = '';
group.members = helpers.removeItem(group.members, request.params.uid);
group.save(function (error) {
if (error)
response.json({error: "error in deleting members"});
response.json(group);
});
}
else {
response.json({error: "member not exists"});
}
}
})
});
router.delete("/:gid", function (request, response) {
console.log("delete member");
mongoose.model("groups").remove({"_id":request.params.gid}, function (err, data) {
if (!err) {
response.json("group deleted sucessfuly")
console.log("group deleted sucessfuly")
}
else {
response.json("group not deleted ")
console.log("group not deleted")
}
})
});
module.exports = router;
|
/**
* Created by claudio on 17/01/17.
*/
"use strict";
let bcrypt = require('bcrypt-nodejs');
let bookshelf = require('../bookshelf');
bookshelf.plugin('registry');
let Game = bookshelf.Model.extend({
tableName: 'games',
hasTimestamps: true, //manage in automatic way created_at and updated_at
hidden: ['json_designers'], //hide from json deserialized
plays() {
return this.hasMany('Play', 'game_id');
},
virtuals: {
//serialize/deserialize designers
//mutators should be used, but I haven't found how to use them with bookshelf
designers: {
get () {
try {
var data = this.get('json_designers');
try {
return JSON.parse(data);
}catch(e){
return data;
}
}catch(e2){
throw e2;
}
},
set: function(value) {
try {
this.set('json_designers', JSON.stringify(value));
}catch (e)
{
throw e;
}
}
},
links: function() {
return {
'self': '/games/' + this.get('id'),
};
}
},
});
module.exports = bookshelf.model('Game', Game);
|
var path = require('path');
var fs = require('fs');
module.exports = function(req, res, next){
var translationVars = [
"fillOutYourGuide",
"howIdidIt",
"wasThisYourFirstJobInSweden",
"yes",
"no",
"whatKindOfJobIsIt",
"whatEducationDidYouHave",
"path",
"descriptionPreferablyShort",
"submitButtonText",
"whatOccupationHaveYouHad",
"firstJobLabel",
"educationLabel",
"jobLabel",
"voteUpLabel",
"voteDownLabel",
"flagLabel",
"translateLabel",
"titleLabel",
"prevOccupationLabel",
"logInLabel",
"logOutLabel",
"createAccountLabel",
"usernameLabel",
"passwordLabel",
"emailLabel",
"confirmPasswordLabel",
"yourGuideLabel",
"search",
"guidesLabel"
] ;
var lang = req.cookies.lang;
var filepath = path.join(__dirname, '../lang/' + lang + '.json');
fs.readFile(filepath, function(err , data){
fs.readFile(path.join(__dirname, '../lang/en.json'), function(errEn, dataEn){
var enLang = JSON.parse( dataEn );
//begin
var langObj;
if(err){
console.log("Language file for language " + lang + " not found! Falling back to english.");
filepath = path.join(__dirname, '../lang/en.json');
fs.readFile(filepath, function(err, data ){
langObj = JSON.parse(data);
});
}else{
langObj = JSON.parse(data);
}
var fullyTranslated = true;
console.log("English fallback: " + enLang ) ;
for(var i = 0; i < translationVars.length; i++){
if(!langObj[translationVars[i]]){
fullyTranslated = false;
console.log("enLang: " + enLang[translationVars[i]] + " translationVars[i] " + translationVars[i]);
langObj[translationVars[i]] = enLang[translationVars[i]];
console.log("Field " + translationVars[i] + " is not defined for language " + lang + " ! It was replaced by " + langObj[translationVars[i]]);
}
}
//if(!fullyTranslated){
//console.log("Language file for language " + lang + " is not fully translated! Falling back to English.");
//filepath = path.join(__dirname, '../lang/en.json');
//fs.readFile(filepath, function(err, data ){
//langObj = JSON.parse(data);
//req.langObj = langObj;
//next();
//});
//}
//else{
req.langObj = langObj;
next();
//}
//end
});
});
};
|
(function($) {
"use strict";
function getCatalog() {
return $.ajax("../catalog/catalog.json", {dataType: "json"});
}
function getMetadata(layer_id) {
var layer_params = {
"id": layer_id.split('/')[0],
"var": layer_id.split('/')[1]
};
return $.ajax({
url: "../metadata.json?request=GetMinMaxWithUnits",
data: layer_params
});
}
function getRasterAccordionMenuData(ensembleName) {
var url = '../menu.json?ensemble_name=' + ensembleName;
return $.ajax(url, {dataType: "json"});
}
function getNCWMSLayerCapabilities(ncwms_layer) {
// FIXME: this .ajax logic doesn't really work in all cases
// What we really want is the fail() handler to _resolve_ the status,
// and then have another fail() fallthrough handler .That is impossible, however.
// see: http://domenic.me/2012/10/14/youre-missing-the-point-of-promises/
var deferred = $.Deferred();
var params = {
REQUEST: "GetCapabilities",
SERVICE: "WMS",
VERSION: "1.1.1",
DATASET: ncwms_layer.params.LAYERS.split("/")[0]
};
$.ajax({
url: ncwms_layer.url,
data: params,
})
.fail(handle_ie8_xml)
.always(function (response, status, jqXHR) {
deferred.resolve($(jqXHR.responseXML));
});
return deferred.promise();
}
function getNcwmsLayerDDS(layerUrl) {
return $.ajax({
url: (layerUrl + ".dds?time")
})
}
function getNcwmsLayerDAS(layerUrl) {
return $.ajax({
url: (layerUrl + ".das")
})
}
function getStationCount(data, success) {
return $.ajax({
url: '../count_stations',
data: data,
type: 'GET',
dataType: 'json',
success: success
});
}
function getRecordLength(data, success) {
return $.ajax({
url: '../record_length',
data: data,
type: 'GET',
dataType: 'json',
success: success
});
}
// returns a list of station locations and names from a CSV file.
// there are two such lists, one for the current CMIP5 hydro station
// data, and the other for the archive CMIP3 data
function getRoutedFlowMetadata(isArchivePortal) {
const resource = isArchivePortal ?
"routed_flow_metadatav4" :
"hydro_stn_cmip5_metadata";
return $.ajax(pdp.app_root + "/csv/" + resource + ".csv");
}
function layerDataUrl(ncwmsLayer, catalog) {
// Return OpENDAP data URL given an ncWMS layer and layer catalog.
// TODO: Use this fn wherever the URL is computed in code.
const datasetName = ncwmsLayer.params.LAYERS.split('/')[0];
return catalog[datasetName];
}
function getLatLonValues(ncwmsLayer, catalog) {
// Get the latitude and longitude values associated with an ncWMS layer
// These values are retrieved using the OpENDAP data service that also
// serves the actual data downloads. In order to form the URL for this
// service, we need the layer catalog, passed in as `catalog`.
function convertResponse(data) {
// Convert text response to a JS object.
// Response comes as pairs of lines, each terminated by a newline.
// First line in pair contains name of variable. Second contains
// values, enclosed in brackets and separated by ', ' (i.e., a JSON
// array).
const lines = data.split("\n");
const result = {};
for (let i = 0; i < lines.length - 1; i += 2) {
result[lines[i]] = JSON.parse(lines[i + 1]);
}
return result;
}
return $.ajax({
url: `${layerDataUrl(ncwmsLayer, catalog)}.ascii?lat,lon`,
dataType: 'text',
dataFilter: convertResponse,
});
}
condExport(module, {
getCatalog: getCatalog,
getMetadata: getMetadata,
getRasterAccordionMenuData: getRasterAccordionMenuData,
getNCWMSLayerCapabilities: getNCWMSLayerCapabilities,
getNcwmsLayerDDS: getNcwmsLayerDDS,
getNcwmsLayerDAS: getNcwmsLayerDAS,
getStationCount: getStationCount,
getRecordLength: getRecordLength,
getRoutedFlowMetadata: getRoutedFlowMetadata,
getLatLonValues: getLatLonValues,
layerDataUrl: layerDataUrl,
}, 'dataServices');
})(jQuery);
|
var __v=[
{
"Id": 21,
"Tag": 21,
"Name": "git",
"Sort": 0
},
{
"Id": 22,
"Tag": 21,
"Name": "svn",
"Sort": 0
}
]
|
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity 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.
// Parity 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 Parity. If not, see <http://www.gnu.org/licenses/>.
import { bytesToHex, hex2Ascii } from '~/api/util/format';
import ABI from './abi/certifier.json';
const ZERO = '0x0000000000000000000000000000000000000000000000000000000000000000';
export default class BadgeReg {
constructor (api, registry) {
this._api = api;
this._registry = registry;
registry.getContract('badgereg');
this.certifiers = {}; // by name
this.contracts = {}; // by name
}
fetchCertifier (name) {
if (this.certifiers[name]) {
return Promise.resolve(this.certifiers[name]);
}
return this._registry.getContract('badgereg')
.then((badgeReg) => {
return badgeReg.instance.fromName.call({}, [name])
.then(([ id, address ]) => {
return Promise.all([
badgeReg.instance.meta.call({}, [id, 'TITLE']),
badgeReg.instance.meta.call({}, [id, 'IMG'])
])
.then(([ title, img ]) => {
title = bytesToHex(title);
title = title === ZERO ? null : hex2Ascii(title);
if (bytesToHex(img) === ZERO) img = null;
const data = { address, name, title, icon: img };
this.certifiers[name] = data;
return data;
});
});
});
}
checkIfCertified (certifier, address) {
if (!this.contracts[certifier]) {
this.contracts[certifier] = this._api.newContract(ABI, certifier);
}
const contract = this.contracts[certifier];
return contract.instance.certified.call({}, [address]);
}
}
|
import React from 'react';
import classnames from 'classnames';
const defaultButton = props =>
<button
type="button"
className="-btn"
{ ...props }>
{ props.children }
</button>
const PaginationRender = function() {
const {
// Computed
pages,
// Props
page,
showPageSizeOptions,
pageSizeOptions,
pageSize,
showPageJump,
canPrevious,
canNext,
onPageSizeChange,
className,
PreviousComponent = defaultButton,
NextComponent = defaultButton,
} = this.props;
return (
<div
className={ classnames(className, '-pagination') }
style={ this.props.paginationStyle }>
<div className="-previous">
<PreviousComponent
onClick={
e => {
if (!canPrevious) return;
this.changePage(page - 1);
}
}
disabled={ !canPrevious }>
{ this.props.previousText }
</PreviousComponent>
</div>
<div className="-center">
<span className="-pageInfo">
{ this.props.pageText }{ ' ' }
{ showPageJump
?
<div className="-pageJump">
<input
type={ this.state.page === '' ? 'text' : 'number' }
onChange={
e => {
const val = e.target.value;
this.changePage(val - 1);
}
}
value={ this.state.page === '' ? '' : this.state.page + 1 }
onBlur={ this.applyPage }
onKeyPress={
e => {
if (e.which === 13 ||
e.keyCode === 13) {
this.applyPage();
}
}
} />
</div>
:
<span className="-currentPage">
{ page + 1 }
</span>
}{ ' ' }
{ this.props.ofText }{ ' ' }
<span className="-totalPages">{ pages || 1 }</span>
</span>
{ showPageSizeOptions &&
<span className="select-wrap -pageSizeOptions">
<select
onChange={ e => onPageSizeChange(Number(e.target.value)) }
value={ pageSize }>
{ this.renderPageNav(pageSizeOptions) }
</select>
</span>
}
</div>
<div className="-next">
<NextComponent
onClick={
e => {
if (!canNext) return;
this.changePage(page + 1);
}
}
disabled={ !canNext }>
{ this.props.nextText }
</NextComponent>
</div>
</div>
)
};
export default PaginationRender;
|
define(['./FloatText'], function(FloatText) {
var Hit = function(value) {
FloatText.call(this, value, {
font: 'bold 30px monospace',
fill: 0xff0000
});
};
extend(Hit, FloatText);
return Hit;
});
|
getcontent("functions/get_basicinfo.php", "basicinfo");
autoupdate("functions/get_basicinfo.php", "basicinfo", 10);
getcontent("functions/get_players.php", "players");
autoupdate("functions/get_players.php", "players", 5);
|
// assign assertion library
var assert = chai.assert,
expect = chai.expect;
suite('live page testing', function (e) {
var a, spy;
console.log(e);
setup(function () {
spy = sinon.spy(window._gaq, 'push'),
factorySpy = sinon.spy(GA, 'processFactoryOptions');
});
test('body was found', function () {
var $_body = $('body');
assert.equal($_body.length, 1, 'body element was not found');
});
test ('Test Me Link', function () {
var $_link = $('a[data-analytics-type="testMe"]'),
info = $_link.data('analytics-info');
$_link.trigger('click');
expect(spy.calledWith(['_trackEvent', 'Test', 'current page', info])).to.equal(true);
});
test ('Social Link', function () {
var $_link = $('a[data-analytics-type="social"]'),
info = $_link.data('analytics-info');
$_link.trigger('click');
expect(spy.calledWith(['_trackSocial', info])).to.equal(true);
});
teardown(function () {
spy.restore();
factorySpy.restore();
});
});
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'sourcearea', 'tr', {
toolbar: 'Kaynak'
});
|
/*!
* jquery.scrollto.js 0.0.1 - https://github.com/yckart/jquery.scrollto.js
* Scroll smooth to any element in your DOM.
*
* Copyright (c) 2012 Yannick Albert (http://yckart.com)
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php).
* 2013/02/17
**/
(function($) {
$.scrollTo = $.fn.scrollTo = function(x, y, options){
if (!(this instanceof $)) return $.fn.scrollTo.apply($('html, body'), arguments);
options = $.extend({}, {
gap: {
x: 0,
y: 0
},
animation: {
easing: 'swing',
duration: 600,
complete: $.noop,
step: $.noop
}
}, options);
return this.each(function(){
var elem = $(this);
elem.stop().animate({
scrollLeft: !isNaN(Number(x)) ? x : $(y).offset().left + options.gap.x,
scrollTop: !isNaN(Number(y)) ? y : $(y).offset().top + options.gap.y
}, options.animation);
});
};
})(jQuery);
|
const _ = require('lodash')
const BillingCycle = require('../billingCycle/billingCycle')
// Mais uma função de middleware
function getSummary(req, res){
BillingCycle.aggregate({
$project: {credit: {$sum: "$credits.value"}, debt: {$sum: "$debts.value"}}
}, {
$group: {_id: null, credit: {$sum: "$credit"}, debt: {$sum: "$debt"}}
}, {
$project: {_id: 0, credit: 1, debt: 1}
}, function(error, result){
if (error) {
res.status(500).json({errors: [error]})
} else {
res.json(_.defaults(result[0], {credit: 0, debt: 0}))
}
})
}
module.exports = { getSummary }
|
var searchData=
[
['key',['key',['../d9/dcc/classnlohmann_1_1basic__json.html#aea1c863b719b4ca5b77188c171bbfafea3c6e0b8a9c15224a8228b9a98ca1531d',1,'nlohmann::basic_json']]]
];
|
/*
Copyright (C) 2015 PencilBlue, 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/>.
*/
module.exports = function(pb) {
//pb dependencies
var util = pb.util;
/**
* Edits an article
*/
function EditArticle(){}
util.inherits(EditArticle, pb.BaseController);
EditArticle.prototype.render = function(cb) {
var self = this;
var vars = this.pathVars;
this.getJSONPostParams(function(err, post) {
post.publish_date = new Date(parseInt(post.publish_date));
post.publish_date2 = new Date(parseInt(post.publish_date2));
post.publish_date3 = new Date(parseInt(post.publish_date3));
post.publish_date4 = new Date(parseInt(post.publish_date4));
post.publish_date5 = new Date(parseInt(post.publish_date5));
post.id = vars.id;
delete post[pb.DAO.getIdField()];
var message = self.hasRequiredParams(post, self.getRequiredFields());
if (message) {
cb({
code: 400,
content: pb.BaseController.apiResponse(pb.BaseController.API_FAILURE, message)
});
return;
}
var dao = new pb.DAO();
dao.loadById(post.id, 'article', function(err, article) {
if(util.isError(err) || article === null) {
cb({
code: 400,
content: pb.BaseController.apiResponse(pb.BaseController.API_FAILURE, self.ls.get('INVALID_UID'))
});
return;
}
//TODO should we keep track of contributors (users who edit)?
if(self.session.authentication.user.admin < pb.SecurityService.ACCESS_EDITOR || !post.author) {
post.author = article.author;
}
post = pb.DocumentCreator.formatIntegerItems(post, ['draft']);
pb.DocumentCreator.update(post, article, ['meta_keywords']);
pb.RequestHandler.urlExists(article.url, post.id, function(error, exists) {
var testError = (error !== null && typeof error !== 'undefined');
if( testError || exists || article.url.indexOf('/admin') === 0) {
cb({
code: 400,
content: pb.BaseController.apiResponse(pb.BaseController.API_FAILURE, self.ls.get('EXISTING_URL'))
});
return;
}
dao.save(article, function(err, result) {
if(util.isError(err)) {
return cb({
code: 500,
content: pb.BaseController.apiResponse(pb.BaseController.API_FAILURE, self.ls.get('ERROR_SAVING'), result)
});
}
post.last_modified = new Date();
cb({content: pb.BaseController.apiResponse(pb.BaseController.API_SUCCESS, article.headline + ' ' + self.ls.get('EDITED'), post)});
});
});
});
});
};
EditArticle.prototype.getRequiredFields = function() {
return ['url', 'headline', 'article_layout', 'id'];
};
EditArticle.prototype.getSanitizationRules = function() {
return {
article_layout: pb.BaseController.getContentSanitizationRules()
};
};
//exports
return EditArticle;
};
|
/**
*
*/
define([
'jquery',
'Magento_Ui/js/modal/alert',
'Magento_Ui/js/modal/confirm',
'mage/translate'
], function ($, alert, confirmation, $t) {
'use strict';
var confirmModal = function (title, msg,onOkay,onCancel)
{
var emptyFunc = function (){ };
title = title | 'Confirmation Question Dialog';
onOkay = typeof onOkay === 'function' ? onOkay : emptyFunc;
onCancel = typeof onCancel === 'function' ? onCancel : emptyFunc;
var modal = confirmation({
title: title,
content: msg,
actions: {
confirm: onOkay,
cancel: onCancel,
always: emptyFunc
},
autoOpen : true,
clickableOverlay : false
});
};
return function (config, element) {
var alertModal = function(title, message) {
alert({
title: $.mage.__("!"+title),
content: $.mage.__(message),
autoOpen: true,
clickableOverlay: false,
focus: "",
actions: {
always: function(){
}
}
});
};
$(element).click(function(){
console.log(config);
var url = config.url+'&zip=1';
var reload = config['update-svg-url'];
var returnUri = window.location.href;
reload += '&return-uri=' + encodeURIComponent(returnUri);
if(url != '#') {
$.ajax({
url: url,
type: 'GET',
beforeSend: function() {
$('body').trigger('processStart');
},
success : function(_res) {
$('body').trigger('processStop');
if(typeof _res === 'object') {
var res = _res;
} else {
res = $.parseJSON(_res);
}
var data = res.data;
if(res.status === 'success') {
window.location.href = data.baseUrl + '' + data.file;
} else {
if(res.message)
{
var msg = res.message;
}else{
msg = 'Cant zip design , the source SVG file missing.';
}
if(res.errorCode && res.errorCode === 15)
{
msg += '<br /><strong>We need create it again from Design Editor . Press "<span style="color: #0fa7ff">OK</span>" then just wait , all done automatically !.</strong>';
confirmModal('Error',$t(msg),
function ()
{
window.location.href = reload;
});
}else{
alertModal('Error', $t(msg));
}
}
},
error: function(xhr, ajaxOptions, thrownError){
$('body').trigger('processStop');
// alertModal('error', thrownError);
if(xhr.responseJSON && xhr.responseJSON.message)
{
var msg = xhr.responseJSON.message;
}else{
msg = 'Cant zip design , the source SVG file missing.';
}
if(xhr.responseJSON && xhr.responseJSON.errorCode && xhr.responseJSON.errorCode === 15)
{
msg += '<br /><strong>We need create it again from Design Editor . Press "<span style="color: #0fa7ff">OK</span>" then just wait , all done automatically !.</strong>';
confirmModal('Error',$t(msg),
function ()
{
window.location.href = reload;
});
}else{
alertModal('Error', $t(msg));
}
}
});
} else {
alertModal('error', 'can\'t zip design');
}
});
};
});
|
/**
* Attempts to try a function repeatedly until either success or max number of tries has been reached.
*
* @param {Function} toTry The function to try repeatedly. Thrown errors cause a retry. This function returns a Promise.
* @param {number} max The maximum number of function retries.
* @param {number} delay The base delay in ms. This doubles after every attempt.
* @param {Function} [predicate] A function to filter errors against. It receives error objects
* and must return true if the error is to be retried.
* @return {Promise} Rejects when toTry has failed max times. Resolves if successful once.
*/
function exponentialBackoff(toTry, max, delay, predicate) {
return toTry().catch((err) => {
if (max <= 0) {
return Promise.reject(err);
}
if (predicate == null || predicate(err)) {
// This delays the Promise by delay.
return new Promise((resolve) => setTimeout(resolve, delay))
.then(() => {
return exponentialBackoff(toTry, --max, delay * 2);
});
}
else {
return Promise.reject(err);
}
});
}
module.exports = exponentialBackoff;
|
function PrepareGenrePage() {
/*var json = [
{ "title": "Now Playing", "section": "nowplaying-movie-list-tube" },
{ "title": "Upcoming", "section": "upcoming-movie-list-tube" },
{ "title": "Previous", "section": "previous-movie-list-tube" },
{ "title": "Recently Viewed", "section": "recent-container-tube" }
];
$(".nav-bar-container").append(GetNavBar(json));*/
var name = GetEntityName(document.location.href, "genre");
name = new Util().toPascalCase(name);
$(".movies").append("<div class=\"movie-details\" style=\"margin-left: 0px\"><div class=\"tube-tilte\" style=\"width: 200px\">" + name + " Movies</div></div>");
$(".movies").append("<div class=\"movie-list\"></div>");
$(".movies").append("<div class=\"upcoming-movie-list\"></div>");
$(".movies").append("<div class=\"previous-movie-list\"></div>");
$(".movies").append("<div class=\"recent-container\"><div class=\"tube-tilte\">Recent</div></div>");
/*$(".movies").append(GetTubeControl(name + " Movies", "genre-name"));
$(".movies").append(GetTubeControl("Now Playing", "nowplaying-movie-list", "nowplaying-movies-pager"));
$(".movies").append(GetTubeControl("Upcoming Releases", "upcoming-movie-list", "upcoming-movies-pager"));
$(".movies").append(GetTubeControl("Previous Movies", "previous-movie-list", "previous-movies-pager"));
$(".movies").append(GetTubeControl("Recently Viewed", "recent-container", "recent-pager"));
$(".section-title").each(function () {
new Util().AppendLoadImage($(this));
});*/
var apiPath = "/api/GenreMovies?type=" + name;
CallHandler(apiPath, PopulateMovies);
LoadRecentVisits();
TrackRecentGenreVisit(name);
}
var TrackRecentGenreVisit = function (name) {
var src = $(".review-list").find("img").attr("src");
RecentlyViewedCookies.add({ name: name, type: 'genre', url: "/genre/" + name.replace(' ', '-'), src: src });
}
|
/*global Ext*/
//<debug>
console.log(new Date().toLocaleTimeString() + ": Log: Load: WPAKT.view.core.skeleton.Main");
//</debug>
Ext.define("WPAKT.view.core.skeleton.Main", {
extend: "Ext.container.Container"
, alias: "widget.coreskeletonmain"
, scrollable: "y"
, layout: {
type: "hbox"
, align: "stretchmax"
// Tell the layout to animate the x/width of the child items.
, animate: true
, animatePolicy: {
x: true
, width: true
}
},
// id: "main-view-detail-wrap",
// reference: "mainContainerWrap",
flex: 1,
items: [
{xtype: "coreskeletontreemain"}
, {xtype: "coreskeletoncardmain"}
],
beforeLayout : function() {
// We setup some minHeights dynamically to ensure we stretch to fill the height
// of the viewport minus the top toolbar
var me = this,
height = Ext.Element.getViewportHeight() - 64, // offset by topmost toolbar height
// We use itemId/getComponent instead of "reference" because the initial
// layout occurs too early for the reference to be resolved
navTree = me.query("coreskeletontreemain")[0];
me.minHeight = height;
navTree.setStyle({
"min-height": height + "px"
});
me.callParent(arguments);
}
});
|
// @flow
/* eslint-disable no-magic-numbers */
// For these tests, since they depend on `toLocaleString`, assume that the
// locale used is American English (default in node)
import numberToDisplayText from '.';
describe('numberToDisplayText', () => {
test('no value', () => {
expect(numberToDisplayText()).toBeUndefined();
expect(numberToDisplayText(undefined)).toBeUndefined();
expect(numberToDisplayText(null)).toBeUndefined();
expect(numberToDisplayText('')).toBeUndefined();
});
test('invalid value', () => {
expect(numberToDisplayText('a')).toBe('N/A');
expect(numberToDisplayText('h87gr754hv')).toBe('N/A');
});
test('valid value, no abbr', () => {
expect(numberToDisplayText(0)).toBe('0');
expect(numberToDisplayText('0')).toBe('0');
expect(numberToDisplayText(1)).toBe('1');
expect(numberToDisplayText('1')).toBe('1');
expect(numberToDisplayText(1000)).toBe('1,000');
expect(numberToDisplayText('1000')).toBe('1,000');
expect(numberToDisplayText(1234567)).toBe('1,234,567');
expect(numberToDisplayText('1234567')).toBe('1,234,567');
});
test('valid value, abbr', () => {
expect(numberToDisplayText(0, true)).toBe('0');
expect(numberToDisplayText('0', true)).toBe('0');
expect(numberToDisplayText(1, true)).toBe('1');
expect(numberToDisplayText('1', true)).toBe('1');
expect(numberToDisplayText(1000, true)).toBe('1k');
expect(numberToDisplayText('1000', true)).toBe('1k');
expect(numberToDisplayText(1234567, true)).toBe('1M');
expect(numberToDisplayText('1234567', true)).toBe('1M');
expect(numberToDisplayText(1234567, true, 1000)).toBe('1,235k');
expect(numberToDisplayText('1234567', true, 1000)).toBe('1,235k');
expect(numberToDisplayText(1234499, true, 1000)).toBe('1,234k');
expect(numberToDisplayText('1234499', true, 1000)).toBe('1,234k');
});
});
|
/**
* zepto插件:向左滑动删除动效
* 使用方法:$('.itemWipe').touchWipe({itemDelete: '.item-delete'});
* 参数:itemDelete 删除按钮的样式名
*/
(function($) {
$.fn.touchWipe = function(option) {
var isMove = 0;
var defaults = {
itemDelete: '.item-delete', //删除元素
};
var isMoveAdd = function(){
isMove += 1;
}
var isMoveZero = function(){
isMove = 0;
}
/* var abc = function(){
return isMove
}
console.log(abc());*/
var opts = $.extend({}, defaults, option); //配置选项
var delWidth = $(opts.itemDelete).width();
var initX; //触摸位置
var moveX; //滑动时的位置
var X = 0; //移动距离
var objX = 0; //目标对象位置
$(this).on('touchstart', function(event) {
//event.preventDefault();
var obj = this;
initX = event.targetTouches[0].pageX;
objX = (obj.style.WebkitTransform.replace(/translateX\(/g, "").replace(/px\)/g, "")) * 1;
if (objX == 0) {
$(this).on('touchmove', function(event) {
//event.preventDefault();
var obj = this;
moveX = event.targetTouches[0].pageX;
X = moveX - initX;
if (X >= 0) {
var abc = function(){
isMoveAdd();
}
abc();
obj.style.WebkitTransform = "translateX(" + 0 + "px)";
} else if (X < 0) {
var l = Math.abs(X);
obj.style.WebkitTransform = "translateX(" + -l + "px)";
if (l > delWidth) {
l = delWidth;
obj.style.WebkitTransform = "translateX(" + -l + "px)";
}
}
});
} else if (objX < 0) {
$(this).on('touchmove', function(event) {
var abc = function(){
isMoveAdd();
}
abc();
//event.preventDefault();
var obj = this;
moveX = event.targetTouches[0].pageX;
X = moveX - initX;
if (X >= 0) {
var r = -delWidth + Math.abs(X);
obj.style.WebkitTransform = "translateX(" + r + "px)";
if (r > 0) {
r = 0;
obj.style.WebkitTransform = "translateX(" + r + "px)";
}
} else { //向左滑动
obj.style.WebkitTransform = "translateX(" + -delWidth + "px)";
}
});
}
})
$(this).on('touchend', function(event) {
//event.preventDefault();
var obj = this;
objX = (obj.style.WebkitTransform.replace(/translateX\(/g, "").replace(/px\)/g, "")) * 1;
var abc = function(){
return isMove
}
/* var num = abc();
if(num>0){
var zero = function(){
isMoveZero();
}
zero();
}else{
} */
if (objX > -delWidth / 2) {
obj.style.transition = "all 0.2s";
obj.style.WebkitTransform = "translateX(" + 0 + "px)";
obj.style.transition = "all 0";
objX = 0;
} else {
obj.style.transition = "all 0.2s";
obj.style.WebkitTransform = "translateX(" + -delWidth + "px)";
obj.style.transition = "all 0";
objX = -delWidth;
}
})
//链式返回
return this;
};
})(Zepto);
$(function() {
function deleteMessage(id) {
var rawID = id.replace('del', ''),
$loading = document.getElementById("loading"),
host = "123.56.91.131:8090",
host1 = "localhost:4567";
$loading.style.display = "block";
$.ajax({
type: "DELETE",
url: "http://" + host + "/mobile/v2/message",
data: {id: rawID},
success: function(response, status, xhr) {
$('.'+id).remove();
$loading.style.display = "none";
},
error:function(XMLHttpRequest, textStatus, errorThrown) {
$loading.style.display = "none";
alert(errorThrown);
}
});
}
// $('.list-li').touchWipe({itemDelete: '.btn'});
$('.detail').on('click', function(event) {
//event.preventDefault();
$('.content-detail').hide();
$('.detail').hide();
})
$('.list-li').on('click',function(event) {
var content = $(this).attr('_val');
$('.content-detail').html(content);
$('.content-detail').show();
$('.detail').show();
//alert()
})
$('.item-delete').on('click', function(event) {
event.preventDefault();
var r=confirm("确认删除?")
var id = $(this).attr('_val');
if(r){
deleteMessage(id);
}
return false;
})
});
|
/**
* @package Woodkit
* @author Sébastien Chandonay www.seb-c.com License: GPL2 Text Domain: woodurls
*
* Copyright 2016 Sébastien Chandonay (email : please contact me from my website)
*
* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2, as published by the Free Software Foundation.
*
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
* USA
*/
(function($) {
$.seourlsmanager = function(element, urls) {
var plugin = this;
var settings = null;
var $seourlsmanager = element;
var $seourlsmanager_container = null;
var $seourlsmanager_container_add = null;
/**
* init/update urls
*/
plugin.urls = function(urls) {
settings = $.extend({
label_add_item : "Add sitemap rule",
label_confirm_remove_item : "Do you realy want remove this url ?",
label_url : "url",
label_url_exclude : "exclude",
label_action_add : "add",
label_action_exclude_if_equals : "exclude if equals",
label_action_exclude_if_contains : "exclude if contains",
label_action_exclude_if_regexp : "exclude if matches regexp",
}, urls);
}
/**
* initialization
*/
plugin.init = function() {
plugin.urls(urls);
/**
* Html structure
*/
$seourlsmanager_container = $('<div class="multiple-items-manager seourlsmanager-container"></div>').appendTo($seourlsmanager);
$seourlsmanager_container_add = $('<div class="add-url wk-btn light small"><span>' + settings['label_add_item'] + '</span></div>').appendTo(
$seourlsmanager);
/**
* Listener
*/
$seourlsmanager_container_add.on('click', function(e) {
plugin.add_url(1, "", "add");
});
$seourlsmanager_container.on('click', '.delete-url', function(e) {
plugin.remove_url($(this).data('id'));
});
};
/**
* initialization
*/
plugin.reinit = function(urls) {
plugin.urls(urls);
};
/**
* Set data (urls) - passed parameter must be an object
*/
plugin.set_data = function(data) {
for ( var k in data) {
if (data.hasOwnProperty(k)) {
var obj = data[k];
plugin.add_url(obj.id, obj.url, obj.action);
}
}
}
/**
* Add url html container
*/
plugin.add_url = function(id, url, action) {
var url_id = plugin.get_unique_id("sitemap-url-id-", id);
var html = '';
html += '<div class="url item" id="sitemap-url-id-' + url_id + '" data-id="' + url_id + '">';
html += '<span class="delete delete-url" data-id="sitemap-url-id-' + url_id + '">[DEL]</span>';
html += '<select name="sitemap-url-action-' + url_id + '">';
var action_checked = "";
if (empty(action) || action == 'add')
action_checked = ' selected="selected"';
html += '<option value="add"'+action_checked+'>'+settings['label_action_add']+'</option>';
action_checked = "";
if (!empty(action) && action == 'exclude_if_equals')
action_checked = ' selected="selected"';
html += '<option value="exclude_if_equals"'+action_checked+'>'+settings['label_action_exclude_if_equals']+'</option>';
action_checked = "";
if (!empty(action) && action == 'exclude_if_contains')
action_checked = ' selected="selected"';
html += '<option value="exclude_if_contains"'+action_checked+'>'+settings['label_action_exclude_if_contains']+'</option>';
action_checked = "";
if (!empty(action) && action == 'exclude_if_regexp')
action_checked = ' selected="selected"';
html += '<option value="exclude_if_regexp"'+action_checked+'>'+settings['label_action_exclude_if_regexp']+'</option>';
html += '</select>';
html += '<input type="text" class="large" name="sitemap-url-' + url_id + '" value="'+url+'" placeholder="' + settings['label_url'] + '" />';
html += '<input type="hidden" name="sitemap-url-id-' + url_id + '" value="' + url_id + '" />';
html += '</div>';
var $url_container = $(html).appendTo($seourlsmanager_container);
return $url_container;
}
/**
* Remove url
*/
plugin.remove_url = function($url_id) {
if ($("#" + $url_id).length > 0 && confirm(settings['label_confirm_remove_item'])) {
$("#" + $url_id).remove();
}
}
/**
* get unique url ID
*/
plugin.get_unique_id = function(prefix, id) {
if (id < 1 || $seourlsmanager_container.find("#" + prefix + id).length > 0) {
id++;
return plugin.get_unique_id(prefix, id);
} else {
return id;
}
}
plugin.init();
return plugin;
};
$.fn.seourlsmanager = function(options) {
var seourlsmanager = $(this).data('seourlsmanager');
if (empty(seourlsmanager)) {
seourlsmanager = new $.seourlsmanager($(this), options);
$(this).data('seourlsmanager', seourlsmanager);
} else {
seourlsmanager.reinit(options);
}
return seourlsmanager;
};
})(jQuery);
|
'use strict';
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const os = require("os");
const fs = require("fs");
const path = require("path");
const request = require("request");
const sax = require("sax");
function checkExistence(command) {
let isWin = process.platform === 'win32';
if (!command) {
return true;
}
for (let dir of process.env.PATH.split(isWin ? ';' : ':')) {
for (let extension of [''].concat(isWin ? ['.exe', '.bat', '.cmd'] : [])) {
try {
fs.accessSync(path.join(dir, command + extension), fs.constants.X_OK);
return true;
}
catch (e) { }
}
}
return false;
}
exports.checkExistence = checkExistence;
function getInfo(packageInfo) {
let platformInfo = packageInfo[process.platform];
let info = (typeof platformInfo !== 'string') ? platformInfo || {} : { source: platformInfo };
return Object.assign({}, packageInfo, info);
}
exports.getInfo = getInfo;
function retrieveLatestVersion(version, outputListener) {
return __awaiter(this, void 0, void 0, function* () {
if (outputListener) {
outputListener('Fetching version number...' + os.EOL);
}
try {
const feed = yield new Promise((resolve) => {
request.get(version.feed, (err, message, body) => resolve(body.toString()));
});
let parser = sax.parser(false, null);
return new Promise((resolve) => {
let matches = [];
parser.ontext = (text) => {
let match = text.match(typeof version.regexp !== 'string'
? version.regexp
: new RegExp(version.regexp));
if (match) {
matches.push(match[1]);
}
};
parser.onend = () => {
resolve(matches.reduce((previous, current) => previous > current ? previous : current));
};
parser.write(feed).end();
});
}
catch (err) {
return '';
}
});
}
exports.retrieveLatestVersion = retrieveLatestVersion;
//# sourceMappingURL=util.js.map
|
/**
*
*/
Ext.define('Healthsurvey.view.searchengine.search.DouMeanView', {
extend : 'Ext.form.Label',
xtype : 'DouMeanView',
//margin : '1 1 1 1',
bodyStyle : 'background:#D8D8D8',
border : 1,
requires : [ 'Healthsurvey.view.searchengine.search.DouMeanController' ],
controller : 'DouMeanController',
initComponent : function() {
this.listeners = {
scope : 'controller',
afterrender : 'onAfterrender',
/*render: function(c){
c.getEl().on('click', searchIt);
}*/
},
this.callParent();
},
onRender : function() {
this.callParent(arguments);
this.getEl().on('click', this.onClick, this);
},
onClick : function(e, t) {
debugger;
mainView = this.up().up().up().up().up().up();
mainViewContoller = mainView.controller;
searchTextbox = mainView.down("#searchs");
searchTextbox.setValue(this.newSearchString);
mainViewContoller.onSolrSearchClick();
}
});
|
/**
* Created by root on 9/15/16.
*/
$(function (home) {
$('#home').ready(function (event) {
var url = $(location).attr('pathname');
var tok = $('input[name=csrfmiddlewaretoken]').val();
var delete_route_form = 'delete_route_form';
var submit_delete = 'submit_delete';
var data = {csrfmiddlewaretoken: tok};
$.ajax({
type: "POST",
url: url,
data: data,
success: function (data) {
console.log('sucssesfull');
//$("#from_box input[name='10.0.25.0 255.255.255.0 10.0.10.1:t']").prop("checked", true);
for (var key in data) {
//console.log(data[key],data[key][0]);
var values = data[key];
for (var i = 0; i < values.length; i++) {
//console.log(values[i]+":"+key);
var changer = values[i] + ":" + key;
//console.log(changer);
$("#from_box input[value='" + changer + "']").prop("checked", true);
}
}
}
});
});
});
$(function (menu4) {
$('#menu4').ready(function (event) {
var url = $(location).attr('pathname');
var tok = $('input[name=csrfmiddlewaretoken]').val();
var delete_route_form = 'delete_route_form';
var get_group = 'get_group';
var data = {csrfmiddlewaretoken: tok, get_group: get_group};
$.ajax({
type: "POST",
url: url,
data: data,
success: function (data) {
console.log('sucssesfull group', data);
for (var key in data) {
var values = data[key];
for (var i = 0; i < values.length; i++) {
var changer = values[i] + ":" + key;
$("#group_manage_users input[value='" + changer + "']").prop("checked", true);
}
}
}
});
});
});
$(function (delete_route) {
$('#delete_route input[name="select_all_route"]').click(function (event) {
var get_value = $(this).attr('value');
if ($('#delete_route input[value="' + get_value + '"]').is(':checked')) {
$('#delete_route input[type=checkbox]').prop("checked", true);
}
else {
$('#delete_route input[type=checkbox]').prop("checked", false);
}
});
});
$(function (delete_group) {
$('#delete_group input[name="select_all_group"]').click(function (event) {
var get_value = $(this).attr('value');
if ($('#delete_group input[value="' + get_value + '"]').is(':checked')) {
$('#delete_group input[type=checkbox]').prop("checked", true);
}
else {
$('#delete_group input[type=checkbox]').prop("checked", false);
}
});
});
$(function(id_select_group){
$('#id_select_group').click(function(event) {
event.preventDefault();
var id_select_user = $("#id_select_group").val();
var url = $(location).attr('pathname');
var tok = $('input[name=csrfmiddlewaretoken]').val();
var select_group = 'select_group';
var delete_route_form = 'delete_route_form';
var data = {csrfmiddlewaretoken:tok,select_group:select_group, id_select_user:id_select_user,delete_route_form:delete_route_form};
$('#group_manage input[name="group_vpn"]').prop("checked", false);
$.ajax({
type: "POST",
url: url,
data: data,
success: function (data)
{console.log('sucssesfull group acl',data);
$.each(data, function(val,text){
console.log(text);
for (var key in data) {
console.log(data[key],data[key][0]);
var values = data[key];
for (var i=0; i< values.length; i++){
var changer = values[i];
console.log(changer);
$("#group_manage input[value='" + changer + "']").prop("checked", true);
}
}
});
}
});
});
});
|
var fs = require('fs');
var https = require('https');
var readline = require('readline');
var google = require('googleapis');
var googleAuth = require('google-auth-library');
var SCOPES = ['https://www.googleapis.com/auth/drive.metadata.readonly'];
// TOKEN_DIR is where the access token is stored AFTER you get it
var TOKEN_DIR = (process.env.HOME || process.env.HOMEPATH || process.env.USERPROFILE) + '/.credentials/';
var TOKEN_PATH = TOKEN_DIR + 'drive-nodejs-quickstart.json';
var filelist;
// load client-secret from localfile
fs.readFile('client_secret.json', function processClientSecret (err, content) {
if (err) {
console.log('err... ERR: ' + err);
return;
}
authorize(JSON.parse(content), getHomeDirectory);
});
// the problem with this is that it uses google-auth-library to do something that googleapis can do on its own, which makes things more complicated than necessary
function authorize(credentials, callback) {
var clientSecret = credentials.web.client_secret;
var clientId = credentials.web.client_id;
var redirectUrl = credentials.web.redirect_uris[0];
var auth = new googleAuth();
var oauth2Client = new auth.OAuth2(clientId, clientSecret, redirectUrl);
fs.readFile(TOKEN_PATH, function (err, token) {
if (err) {
getNewToken(oauth2Client, callback);
} else {
oauth2Client.credentials = JSON.parse(token);
callback(oauth2Client);
}
});
}
// this is the code I have to modify
function getNewToken (oauth2Client, callback) {
var authUrl = oauth2Client.generateAuthUrl({
access_type: 'offline',
scopes: SCOPES
})
console.log('Authorize this app by visiting this url: ', authUrl);
var rl = readline.createInterface({
input: process.stdin,
output: process.stdout
})
rl.question('Enter the code from the page here: ', function (code) {
rl.close();
oauth2Client.getToken(code, function () {
if (err) {
console.log('ERR while retrieving access token', err);
}
oauth2Client.credentials = token;
storeToken(token);
callback(oauth2Client);
});
});
}
//////////////////////////////////////////
function storeToken (token) {
try { fs.mkdirSync(TOKEN_DIR); } catch (err) { if (err.code != 'EEXIST') { throw err; }}
fs.writeFile(TOKEN_PATH, JSON.stringify(token));
console.log('Token stored to ' + TOKEN_PATH);
}
// API call:
function getHomeDirectory(auth) {
// this is the beginning of the API request
var service = google.drive('v3');
console.log('got to line 74');
service.files.list({
auth: auth,
fields: "files(id, names)"
}, function (err, response) {
if (err) {
console.log('API did not like your call, so ERRRRRRRR: ' + err);
return;
}
var files = response.files;
filelist = response.files;
// debuggery
console.log(response.files);
if (files.length == 0) {
console.log('Files not found');
} else {
console.log('Files: ');
var app = require('express')();
var options = {
key : fs.readFileSync('server.enc.key'),
cert : fs.readFileSync('server.crt')
};
https.createServer(options, app).listen(443, function () {
console.log('Started!');
});
app.get('/', function (req, res) {
for (var i = 0; i < filelist.length; i++) {
var file = files[i];
console.log('%s (%s)', file.name, file.id);
res.send(filelist[i] + "<br />");
}
})
}
})
}
|
var mysql = require('mysql')
var state = {
pool: null
}
exports.connect = function(done) {
state.pool = mysql.createPool({
host: 'keeporselldbinstance.cuvbt4xyyhf3.us-west-2.rds.amazonaws.com',
user: 'keeporsell',
password: 'keeporsell',
database: 'keeporsell'
})
done()
}
exports.get = function() {
return state.pool
}
|
var selectdb = require('./selectDB'),
accounts,
DBPATIENTS = 0,
DBDOCTORS = 1,
DBPLANNERS = 2,
DBADMINS = 3;
var certAutoLogin = function(dni, db, callback){
'use strict';
accounts = selectdb.selectDataBase(db);
accounts.findOne({dni:dni}, function(e, o) {
if (o){
callback(o);
} else{
callback(null);
}
});
};
/*module*/
exports.certAutoLoginPatient = function(dni, callback){
'use strict';
certAutoLogin(dni,DBPATIENTS,callback);
};
exports.certAutoLoginDoctor = function(dni, callback){
'use strict';
certAutoLogin(dni,DBDOCTORS,callback);
};
exports.certAutoLoginPlanner = function(dni, callback){
'use strict';
certAutoLogin(dni,DBPLANNERS,callback);
};
exports.certAutoLoginAdmin = function(dni, callback){
'use strict';
certAutoLogin(dni,DBADMINS,callback);
};
|
var searchData=
[
['phy_2ed',['phy.d',['../phy_8d.html',1,'']]],
['phy_5fksz8051mll_2ed',['phy_ksz8051mll.d',['../phy__ksz8051mll_8d.html',1,'']]],
['pwr_2ec',['pwr.c',['../pwr_8c.html',1,'']]],
['pwr_2eh',['pwr.h',['../pwr_8h.html',1,'']]],
['pwr_5fcommon_5fall_2ec',['pwr_common_all.c',['../pwr__common__all_8c.html',1,'']]],
['pwr_5fcommon_5fall_2ed',['pwr_common_all.d',['../pwr__common__all_8d.html',1,'']]],
['pwr_5fcommon_5fall_2eh',['pwr_common_all.h',['../pwr__common__all_8h.html',1,'']]]
];
|
//keep track of the total number of meshes
var meshCount = 0;
// refresh view port
function onNewOptionClick () {
if ( confirm( 'Are you sure?' ) ) {
editor.config.clear();
editor.storage.clear( function () {
location.href = location.pathname;
} );
}
}
// event handlers for adding geometry
function addGeo(geo_type,x,y,z,w,h,d){
if(geo_type == "plane"){
onPlaneOptionClick ();
}
if(geo_type == "box"){
onBoxOptionClick (x,y,z,w,h,d);
}
if(geo_type == "circle"){
onCircleOptionClick ();
}
if(geo_type == "cylinder" ){
onCylinderOptionClick ();
}
if(geo_type == "sphere"){
onSphereOptionClick ()
}
if(geo_type == "icosahedron"){
onIcosahedronOptionClick ()
}
if(geo_type == "torus"){
onTorusOptionClick ();
}
if(geo_type == "torusknot"){
onTorusKnotOptionClick();
}
}
function onPlaneOptionClick () {
var width = 200;
var height = 200;
var widthSegments = 1;
var heightSegments = 1;
var geometry = new THREE.PlaneGeometry( width, height, widthSegments, heightSegments );
var material = new THREE.MeshPhongMaterial();
var mesh = new THREE.Mesh( geometry, material );
mesh.name = 'Plane ' + ( ++ meshCount );
editor.addObject( mesh );
editor.select( mesh );
}
function onCircleOptionClick () {
var radius = 20;
var segments = 8;
var geometry = new THREE.CircleGeometry( radius, segments );
var mesh = new THREE.Mesh( geometry, new THREE.MeshPhongMaterial() );
mesh.name = 'Circle ' + ( ++ meshCount );
editor.addObject( mesh );
editor.select( mesh );
}
function onCylinderOptionClick () {
var radiusTop = 20;
var radiusBottom = 20;
var height = 100;
var radiusSegments = 8;
var heightSegments = 1;
var openEnded = false;
var geometry = new THREE.CylinderGeometry( radiusTop, radiusBottom, height, radiusSegments, heightSegments, openEnded );
var mesh = new THREE.Mesh( geometry, new THREE.MeshPhongMaterial() );
mesh.name = 'Cylinder ' + ( ++ meshCount );
editor.addObject( mesh );
editor.select( mesh );
}
function onSphereOptionClick () {
var radius = 75;
var widthSegments = 32;
var heightSegments = 16;
var geometry = new THREE.SphereGeometry( radius, widthSegments, heightSegments );
var mesh = new THREE.Mesh( geometry, new THREE.MeshPhongMaterial() );
mesh.name = 'Sphere ' + ( ++ meshCount );
editor.addObject( mesh );
editor.select( mesh );
}
function onIcosahedronOptionClick () {
var radius = 75;
var detail = 2;
var geometry = new THREE.IcosahedronGeometry ( radius, detail );
var mesh = new THREE.Mesh( geometry, new THREE.MeshPhongMaterial() );
mesh.name = 'Icosahedron ' + ( ++ meshCount );
editor.addObject( mesh );
editor.select( mesh );
}
function onTorusOptionClick () {
var radius = 100;
var tube = 40;
var radialSegments = 8;
var tubularSegments = 6;
var arc = Math.PI * 2;
var geometry = new THREE.TorusGeometry( radius, tube, radialSegments, tubularSegments, arc );
var mesh = new THREE.Mesh( geometry, new THREE.MeshPhongMaterial() );
mesh.name = 'Torus ' + ( ++ meshCount );
editor.addObject( mesh );
editor.select( mesh );
}
function onTorusKnotOptionClick () {
var radius = 100;
var tube = 40;
var radialSegments = 64;
var tubularSegments = 8;
var p = 2;
var q = 3;
var heightScale = 1;
var geometry = new THREE.TorusKnotGeometry( radius, tube, radialSegments, tubularSegments, p, q, heightScale );
var mesh = new THREE.Mesh( geometry, new THREE.MeshPhongMaterial() );
mesh.name = 'TorusKnot ' + ( ++ meshCount );
editor.addObject( mesh );
editor.select( mesh );
}
|
/* Licence: GPL version 3, Wikus Coetser, 2013, http://www.gnu.org/licenses/gpl-3.0.html */
/*
Function from MDN: This makes use requestAnimationFrame is availible.
*/
(function () {
var requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame ||
window.webkitRequestAnimationFrame || window.msRequestAnimationFrame;
window.requestAnimationFrame = requestAnimationFrame;
})();
/*
Function for converting a RGBA encoded byte array to a bitmap image
*/
function RGBAImageToDataUrl(bmpData, width, height) {
if (!(bmpData instanceof Uint8Array)) throw "RGBAImageToDataUrl: Expected a Uint8Array data array as input";
if (bmpData.length != width * height * 4) throw "Invalid image data, length must be " + (width * height * 4);
}
|
const initialState = {
config: {},
isSuccess: false,
isFailure: false,
isFetching: false,
useManual: false,
}
export default function automaticSetup(state = initialState, {type, payload}) {
switch (type) {
case 'AUTOMATIC_SETUP_BEGIN':
return {
...initialState,
isFetching: true,
}
case 'AUTOMATIC_SETUP_SUCCESS':
return {
config: payload,
isSuccess: true,
isFailure: false,
isFetching: false,
}
case 'AUTOMATIC_SETUP_FAILURE':
return {
...initialState,
isFailure: true,
}
case 'MANUAL_SETUP_USE':
return {
...initialState,
useManual: true,
}
default:
return state
}
}
|
(function($) {
$.fn.swipeEvents = function() {
return this.each(function() {
var startX,
startY,
$this = $(this);
$this.on('touchstart', touchstart);
function touchstart(event) {
var touches = event.originalEvent.touches;
if (touches && touches.length) {
startX = touches[0].pageX;
startY = touches[0].pageY;
$this.on('touchmove', touchmove);
$this.on('touchend', touchend);
}
event.preventDefault();
}
function touchmove(event) {
var touches = event.originalEvent.touches;
if (touches && touches.length) {
var deltaX = startX - touches[0].pageX;
var deltaY = startY - touches[0].pageY;
if (deltaX >= 50) {
$this.trigger("swipeLeft");
}
if (deltaX <= -50) {
$this.trigger("swipeRight");
}
if (deltaY >= 50) {
$this.trigger("swipeUp");
}
if (deltaY <= -50) {
$this.trigger("swipeDown");
}
if (Math.abs(deltaX) >= 50 || Math.abs(deltaY) >= 50) {
$this.off('touchmove', touchmove);
$this.off('touchend', touchend);
}
}
event.preventDefault();
}
function touchend(event) {
$this.off('touchmove', touchmove);
event.preventDefault();
}
});
};
})(jQuery);
|
Ext.define('Sky.model.Release', {
extend: 'common.model.Release'
});
|
import express from 'express'
import bodyParser from 'body-parser'
import morgan from 'morgan'
import TelegramBot from 'node-telegram-bot-api'
import log from 'log-to-file-and-console-node'
import botHandler from './routes/botHandler'
import root from './routes/root'
const app = express()
const bot = new TelegramBot(process.env.TELEGRAM_BOT_TOKEN, {polling: true})
app.use(morgan('combined', {'stream': log.stream}))
app.use(bodyParser.json())
app.use('/', root)
bot.on('message', msg => {
botHandler.onMessage(msg, bot)
})
bot.onText(/\/content(f|F)arm(h|H)elp/, msg => {
botHandler.onHelp(msg, bot)
})
module.exports = app
|
/*
* Copyright (c) 2002-2020 "Neo4j,"
* Neo4j Sweden AB [http://neo4j.com]
*
* This file is part of Neo4j.
*
* Neo4j 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/>.
*/
export default class AdjacentAngles {
findRuns(AngleList, minSeparation) {
let p = 0
let start = 0
let end = 0
const runs = []
const minStart = function() {
if (runs.length === 0) {
return 0
} else {
return runs[0].start
}
}
var scanForDensePair = function() {
start = p
end = AngleList.wrapIndex(p + 1)
if (end === minStart()) {
return 'done'
} else {
p = end
if (tooDense(start, end)) {
return extendEnd
} else {
return scanForDensePair
}
}
}
var extendEnd = function() {
if (p === minStart()) {
return 'done'
} else if (tooDense(start, AngleList.wrapIndex(p + 1))) {
end = AngleList.wrapIndex(p + 1)
p = end
return extendEnd
} else {
p = start
return extendStart
}
}
var extendStart = function() {
const candidateStart = AngleList.wrapIndex(p - 1)
if (tooDense(candidateStart, end) && candidateStart !== end) {
start = candidateStart
p = start
return extendStart
} else {
runs.push({
start,
end
})
p = end
return scanForDensePair
}
}
var tooDense = function(start, end) {
const run = {
start,
end
}
return AngleList.angle(run) < AngleList.length(run) * minSeparation
}
let stepCount = 0
let step = scanForDensePair
while (step !== 'done') {
if (stepCount++ > AngleList.totalLength() * 10) {
console.log(
'Warning: failed to layout arrows',
(() => {
const result = []
for (const key of Object.keys(AngleList.list || {})) {
const value = AngleList.list[key]
result.push(`${key}: ${value.angle}`)
}
return result
})().join('\n'),
minSeparation
)
break
}
step = step()
}
return runs
}
}
|
// upload stuff to the keying server...
function putPng(desturl, obj) {
jQuery.ajax({
type: "PUT",
url: desturl,
contentType: "image/png",
data: obj,
error: function(jqxhr, textStatus) {
//alert("Communication error: " + textStatus);
}
});
}
function postJson(desturl, obj) {
jQuery.ajax({
type: "POST",
url: desturl,
contentType: "application/json",
data: JSON.stringify(obj),
error: function(jqxhr, textStatus) {
//alert("Communication error: " + textStatus);
}
});
}
$(document).ready(function() {
$("#pngImage").change(function() {
var file = $("#pngImage")[0].files[0];
var fr = new FileReader();
fr.onload = function(e) {
var data = e.target.result;
putPng('/key_dataurl', data);
};
fr.readAsDataURL(file);
});
$("#titleUp").click(function() {
postJson('/dissolve_in/30', {});
});
$("#titleDown").click(function() {
postJson('/dissolve_out/30', {});
});
$("#d0").click(function() {
postJson('/dirty_level/0', {});
});
$("#d1").click(function() {
postJson('/dirty_level/1', {});
});
});
|
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'quicktable', 'cy', {
more: 'Mwy...'
} );
|
var bfrequire = require('../../node_modules/node-brainfuckex/').require;
process.chdir('../../');
bfrequire('bt.bf')(['samples/hellowhat/hw.tpl', 'World', 'Foo']);
|
Ext.define('Onlineshopping.onlineshopping.shared.shop.model.authentication.UserAccessLevelModel', {
"extend": "Ext.data.Model",
"fields": [{
"name": "primaryKey",
"type": "string",
"defaultValue": ""
}, {
"name": "userAccessLevelId",
"type": "string",
"defaultValue": ""
}, {
"name": "userAccessLevel",
"type": "int",
"defaultValue": ""
}, {
"name": "levelName",
"type": "string",
"defaultValue": ""
}, {
"name": "levelDescription",
"type": "string",
"defaultValue": ""
}, {
"name": "levelHelp",
"type": "string",
"defaultValue": ""
}, {
"name": "levelIcon",
"type": "string",
"defaultValue": ""
}, {
"name": "versionId",
"type": "int",
"defaultValue": ""
}, {
"name": "entityAudit",
"reference": "EntityAudit"
}, {
"name": "primaryDisplay",
"type": "string",
"defaultValue": ""
}]
});
|
// ==UserScript==
// @name GBI Ref App Styling
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://ref.groupbycloud.com/*
// @grant none
// @require http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js
// ==/UserScript==
jQuery(document).ready(function ($) {
'use strict';
$('head').append('<link rel="stylesheet" type="text/css" href="https://rawgit.com/jatkinson10/tampermonkey/master/css/ref.groupbycloud.css">');
$('td[style]').removeAttr('style');
$('table').each(function (){
$(this).replaceWith( $(this).html()
.replace(/<tbody/gi, "<section")
.replace(/<tr/gi, "<div class='row'")
.replace(/<\/tr>/gi, "</div>")
.replace(/<td width="160" valign="top"/gi, "<div class='col _25'")
.replace(/<\/td>/gi, "</div>")
.replace(/<td/gi, "<div class='col'")
.replace(/<\/td>/gi, "</div>")
.replace(/<\/tbody/gi, "<\/section")
);
});
});
|
/* demoquest - An adventure game demo with parallax scrolling
* Copyright (C) 2017 Peter Rogers
*
* 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/>.
*/
var Events = require("./events");
var Utils = require("./utils");
// Object cache for holding a (PIXI) rendered texture, to be used as the dialog
// box background. Generating a texture takes a noticable amount of time to
// do at runtime. So this is nice to cache globally to use across all
// dialog instances.
var CachedTexture = new (class {
makeTexture(colour) {
if (colour !== undefined && this.colour !== colour) {
this.texture = Utils.makeSolidColourTexture(colour, 10, 10);
this.colour = colour;
}
return this.texture;
}
});
/**********/
/* Dialog */
/**********/
function Dialog(width, height, stage, options)
{
this.container = new PIXI.Container();
this.viewWidth = width;
this.viewHeight = height;
this.options = options;
this.messages = [];
this.stage = stage;
var mgr = new Events.EventManager();
this.onOpening = mgr.hook("opening");
this.onClosed = mgr.hook("closed");
this.onClosing = mgr.hook("closing");
this.onRedraw = mgr.hook("redraw");
this.onUpdate = mgr.hook("update");
this.dispatch = mgr.dispatcher();
this.state = "idle";
let texture = CachedTexture.makeTexture(options.background);
this.bg = new PIXI.Sprite(texture);
this.container.addChild(this.bg);
}
Dialog.prototype.isShown = function()
{
return this.state === "shown";
}
Dialog.prototype.showMessage = function(msg)
{
if (this.state !== "idle") {
// Already showing a message. Add it to the queue for later
this.messages.push(msg);
return;
}
var pad = this.viewHeight*0.02;
var fontSize = this.viewHeight*0.05;
var text = new PIXI.Text(msg, {
fontSize: fontSize,
wordWrap: true,
fontStyle: "italic",
fill: this.options.fill,
wordWrapWidth: this.viewWidth-2*pad
});
text.x = pad;
text.y = pad;
this.bg.scale.set(
this.viewWidth/this.bg.texture.width,
(text.height+2*pad)/this.bg.texture.height);
this.container.children = [];
this.container.addChild(this.bg);
this.container.addChild(text);
//this.container.addChild(bg);
//this.container.addChild(text);
// Now position everything, a little offset from the bottom
/*bg.y = this.viewHeight-bg.height-(this.viewHeight*0.03);
text.x = pad;
text.y = bg.y+pad;*/
this.desty = this.viewHeight-this.bg.height-(this.viewHeight*0.03);
this.container.y = this.viewHeight+5;
this.show();
}
Dialog.prototype.show = function()
{
if (this.state !== "idle") return;
this.state = "showing";
this.delay = 0;
this.stage.addChild(this.container);
// Have the dialog box slide into view from below
this.dispatch("update", dt => {
if (this.delay > 0) {
this.delay -= dt;
return true;
}
this.container.y -= 0.9*this.viewHeight*dt;
if (this.container.y < this.desty)
{
this.container.y = this.desty;
this.state = "shown";
this.dispatch("redraw");
return false;
}
return true;
});
this.dispatch("opening");
}
Dialog.prototype.hide = function(delay)
{
if (this.state !== "shown") return;
this.state = "hiding";
// Have the dialog box slide off screen
this.dispatch("closing");
this.dispatch("update", dt => {
if (delay > 0) {
delay -= dt;
return true;
}
this.container.y += (0.75*this.viewHeight)*dt;
if (this.container.y > this.viewHeight)
{
this.container.parent.removeChild(this.container);
this.state = "idle";
if (this.messages.length > 0) {
// Show the next message
this.showMessage(this.messages.shift());
} else {
this.dispatch("closed");
}
this.dispatch("redraw");
return false;
}
return true;
});
}
Dialog.prototype.handleResize = function(width, height)
{
this.viewWidth = width;
this.viewHeight = height;
// TODO - handle resize when a message is displayed currently
}
/* Returns a promise that resolves once the dialog is closed */
Dialog.prototype.closed = function()
{
return new Promise(
(resolve, reject) => {
let closedEvent = this.onClosed(() => {
closedEvent.remove();
resolve();
});
},
err => {
console.log("Error closing dialog: " + err);
}
);
}
module.exports = Dialog;
|
var searchData=
[
['humidity',['Humidity',['../a00004.html#afc87e0fad26178d122954b0a266ce996',1,'HomeGenie::Automation::Scripting::ModulesManager']]]
];
|
import React, { Component, PropTypes } from 'react'
import { connect } from 'react-redux'
import { bindActionCreators } from 'redux'
import { requestGetNotifications, requestDeleteNotification } from './NotificationActions'
import { getNotifications } from './NotificationReducer'
import NotificationList from './components/NotificationList/NotificationList'
// Import Style
import styles from './Notification.css'
class Notification extends Component {
constructor(props) {
super(props)
this.state = {}
}
componentDidMount() {
this.props.getNotifications()
}
render() {
return (
<div className={styles.notification}>
<NotificationList
notifications={this.props.notifications}
deleteNotification={this.props.deleteNotification}
>Replies</NotificationList>
<NotificationList
notifications={[]}
deleteNotification={this.props.deleteNotification}
>Followed Links</NotificationList>
</div>
)
}
}
const mapStateToProps = (state) => {
return {
notifications: getNotifications(state)
}
}
const mapDispatchToProps = (dispatch) => {
return {
getNotifications: bindActionCreators(requestGetNotifications, dispatch),
deleteNotification: bindActionCreators(requestDeleteNotification, dispatch)
}
}
Notification.propTypes = {
notifications: PropTypes.arrayOf(PropTypes.object).isRequired,
getNotifications: PropTypes.func.isRequired,
deleteNotification: PropTypes.func.isRequired
}
export default connect(
mapStateToProps,
mapDispatchToProps
)(Notification)
|
/**
* Created by tmanson on 03/05/2016.
*/
angular.module('redCrossQuestClient').factory('YearlyGoalsResource', function ($resource, $localStorage) {
return $resource('/rest/:roleId/ul/:ulId/yearlyGoals/:id',
{
roleId: function () { return $localStorage.currentUser.roleId},
ulId : function () { return $localStorage.currentUser.ulId },
id : '@id'
}, {
update: {
method: 'PUT' // this method issues a PUT request
},
createYear: {
method: 'POST'
},
getByYear:{
method: 'GET'
}
});
});
|
/*
* Copyright (C) 2016 Alex Yatskov <alex@foosoft.net>
* Author: Alex Yatskov <alex@foosoft.net>
*
* 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/>.
*/
class Popup {
constructor() {
this.popup = null;
this.offset = 10;
}
showAt(pos, content) {
this.inject();
this.popup.style.left = pos.x + 'px';
this.popup.style.top = pos.y + 'px';
this.popup.style.visibility = 'visible';
this.setContent(content);
}
showNextTo(elementRect, content) {
this.inject();
const popupRect = this.popup.getBoundingClientRect();
let posX = elementRect.left;
if (posX + popupRect.width >= window.innerWidth) {
posX = window.innerWidth - popupRect.width;
}
let posY = elementRect.bottom + this.offset;
if (posY + popupRect.height >= window.innerHeight) {
posY = elementRect.top - popupRect.height - this.offset;
}
this.showAt({x: posX, y: posY}, content);
}
hide() {
if (this.popup !== null) {
this.popup.style.visibility = 'hidden';
}
}
setContent(content) {
if (this.popup === null) {
return;
}
this.popup.contentWindow.scrollTo(0, 0);
const doc = this.popup;
doc.srcdoc=content;
}
sendMessage(action, params, callback) {
if (this.popup !== null) {
this.popup.contentWindow.postMessage({action, params}, '*');
}
}
inject() {
if (this.popup !== null) {
return;
}
this.popup = document.createElement('iframe');
this.popup.id = 'yomichan-popup';
this.popup.addEventListener('mousedown', (e) => e.stopPropagation());
this.popup.addEventListener('scroll', (e) => e.stopPropagation());
let simpread = document.querySelector('.simpread-read-root');
let root = simpread ? simpread : document.body;
root.appendChild(this.popup);
}
}
|
// src_hydrology/post_change_longitude_latitude.js
// -----------------------------------------------
function post_change_longitude_latitude( element )
{
var degrees;
var minutes;
var seconds;
var seconds_integer;
var floating_point;
var string_array;
var seconds_array;
var delimiter;
var minus_sign;
var element_name_array;
var local_element_name;
delimiter = timlib_get_non_minus_delimiter( element.value );
if ( delimiter == '' )
{
alert( 'ERROR: invalid value. Resetting...' );
element.value = element.defaultValue;
return true;
}
if ( element.name.substr( 0, 9 ) == 'longitude' )
minus_sign = '-';
else
minus_sign = '';
if ( delimiter == '.' )
{
string_array = element.value.split( delimiter );
if ( string_array.length == 2 )
{
degrees = string_array[ 0 ];
if ( degrees.charAt( 0 ) == '-' )
{
degrees = degrees.substr( 1 );
}
if ( degrees.length == 1 )
{
degrees = "0" + degrees;
}
if ( degrees.length != 2 )
{
alert( 'ERROR: invalid value. Resetting...' );
element.value = element.defaultValue;
return true;
}
floating_point = string_array[ 1 ];
if ( floating_point.length < 0
|| floating_point.length > 5 )
{
alert(
'ERROR: float must be 5 digits. Resetting...' );
element.value = element.defaultValue;
return true;
}
else
if ( floating_point.length == 1 )
floating_point = floating_point + "0000";
else
if ( floating_point.length == 2 )
floating_point = floating_point + "000";
else
if ( floating_point.length == 3 )
floating_point = floating_point + "00";
else
if ( floating_point.length == 4 )
floating_point = floating_point + "0";
element.value = minus_sign +
degrees + '.' +
floating_point;
return true;
}
}
string_array = element.value.split( delimiter );
if ( string_array.length != 3
&& ( string_array.length == 4 && delimiter != '.' ) )
{
alert( 'ERROR: invalid value. Resetting...' );
element.value = element.defaultValue;
return true;
}
degrees = string_array[ 0 ];
if ( degrees.charAt( 0 ) == '-' )
{
degrees = degrees.substr( 1 );
}
if ( degrees.length == 1 )
{
degrees = "0" + degrees;
}
minutes = string_array[ 1 ];
if ( minutes.length == 1 )
{
minutes = "0" + minutes;
}
if ( delimiter != '.' )
{
seconds = string_array[ 2 ];
seconds_array = seconds.split( '.' );
if ( seconds_array.length != 2 )
{
seconds = seconds + '.00';
seconds_array = seconds.split( '.' );
}
seconds_integer = seconds_array[ 0 ];
if ( seconds_integer.length == 1 )
{
seconds_integer = "0" + seconds_integer;
}
floating_point = seconds_array[ 1 ];
}
else
{
seconds_integer = string_array[ 2 ];
if ( seconds_integer.length == 0 )
{
seconds_integer = "00" + seconds_integer;
}
else
if ( seconds_integer.length == 1 )
{
seconds_integer = "0" + seconds_integer;
}
floating_point = string_array[ 3 ];
}
if ( floating_point.length == 0 )
{
floating_point = "00" + floating_point;
}
else
if ( floating_point.length == 1 )
{
floating_point = "0" + floating_point;
}
else
if ( floating_point.length != 2 )
{
alert(
'ERROR: seconds float must be two digits. Resetting...' );
element.value = element.defaultValue;
return true;
}
element.value = minus_sign +
degrees + ':' +
minutes + ':' +
seconds_integer + '.' +
floating_point;
return true;
} // post_change_longitude_latitude()
|
'use strict';
//const Path = require('path');
import test from './test';
test('Babel is working!');
//import _ from 'lodash';
const Hapi = require('hapi');
const Hoek = require('hoek');
// Load Neo4j DB Driver
const neo4j = require('neo4j-driver').v1;
const server = new Hapi.Server();
server.connection({port: 3000, host: 'localhost'});
// Vision controls view templates and handlebars is the templating engine
server.register(require('vision'), (err) => {
Hoek.assert(!err, err);
server.views({
engines: {
html: require('handlebars')
},
relativeTo: __dirname,
// Use templates folder for view templates
path: 'templates'
});
server.route({
method: 'GET',
path: '/',
handler: function(request, reply) {
reply.view('index');
}
});
});
server.start();
// Connect to Neo4j DB
//new config();
//config.db = "bolt://35.165.107.226";
//var driver = neo4j.driver("bolt://localhost", neo4j.auth.basic("neo4j", "d1c4b9f0f6d88eddfdc028d97105d8fa6eddf322db5fa628c1c08c5b8c7e8b03"));
var driver = neo4j.driver("bolt://35.165.107.226", neo4j.auth.basic("neo4j", "enthusiastsneodev"));
driver.onCompleted = function() {
// proceed with using the driver, it was successfully instantiated
};
driver.onError = function(error) {
console.log('Driver instantiation failed', error);
};
var session = driver.session();
// Run a Cypher statement, reading the result in a streaming manner as records arrive:
session.run("MATCH (n:Enthusiast{ email: {email} }) RETURN n AS Enthusiast", { email: 'adam.mackintosh@enthusiasts.com' })
//.run("MERGE (alice:Person {name : {nameParam} }) RETURN alice.name", { nameParam:'Alice' })
.subscribe({
onNext: function(record) {
//console.log(record._fields);
const foundNode = JSON.stringify(record.get('Enthusiast'));
console.log("Found Enthusiast: " + foundNode);
console.log("Postal Code: " + foundNode['postal_code']);
Object.entries(foundNode).forEach(
([key, value]) => console.log(key, value)
);
},
onCompleted: function() {
console.log("Done.");
session.close();
driver.close();
},
onError: function(error) {
console.log(error);
driver.close();
}
});
|
/* global sch, sb, map */
function AnimationManager () {
this.bkgStep = 150
this.bkgPosition = 0
this.setAnimationSpeed = (speed) => {
document.body.style.setProperty('--animation-pace', speed)
}
this.stopRunning = () => {
sch.setPace(750)
this.getLight().style.setProperty('transform', `scale(1.0) translateX(${this.bkgPosition}px)`)
this.getHands().style.setProperty('bottom', '-5%')
}
this.startRunning = () => {
sch.setPace(350)
this.getLight().style.setProperty('transform', `scale(1.3) translateX(${this.bkgPosition}px)`)
this.getHands().style.setProperty('bottom', '-25%')
}
this.updateDirection = () => {
this.getLight().style.setProperty('transform', `translateX(${this.bkgPosition}px)`)
}
this.setBkgPosition = (p) => {
this.bkgPosition += p
}
this.moveRight = () => {
this.setBkgPosition(-this.bkgStep)
map.movePlayerRight()
}
this.moveLeft = () => {
this.setBkgPosition(this.bkgStep)
map.movePlayerLeft()
}
this.getLight = () => {
return this.light || (this.light = document.querySelector('.light'))
}
this.getHands = () => {
return this.hands || (this.hands = document.querySelector('.hands'))
}
const keyPresses = {}
window.onkeydown = (e) => {
keyPresses[e.keyCode] = true
}
window.onkeyup = (e) => {
delete keyPresses[e.keyCode]
}
// const KEY_W = 87
// const KEY_S = 83
const KEY_A = 65
const KEY_D = 68
// const KEY_UP = 38
// const KEY_DN = 40
const KEY_LFT = 37
const KEY_RGT = 39
sch.add(() => {
let hasMoved = false
if (keyPresses[KEY_D] || keyPresses[KEY_RGT]) {
this.moveRight()
hasMoved = true
}
if (keyPresses[KEY_A] || keyPresses[KEY_LFT]) {
this.moveLeft()
hasMoved = true
}
if (hasMoved) {
if (map.player.dir > 2 * Math.PI ||
map.player.dir < 0) {
this.getLight().classList.remove('light')
this.setBkgPosition(-2 * this.bkgPosition)
this.updateDirection()
sb.add('Wraped around')
}
this.getLight().classList.add('light')
this.updateDirection()
sb.add(`Direction: ${map.player.dir.toFixed(1)}rad`)
}
})
}
window.am = new AnimationManager()
|
//
// some mobile-oriented app config overrides
//
if(typeof(config) == 'undefined') config = {};
Object.merge(config, {
api_url: 'https://api.turtl.it/v2',
client: 'mobile-ubuntu',
version: cordova_app_version,
cookie_login: true,
base_url: window.location.toString().replace(/\/(index\.html)?$/, '/app'),
has_autologin: true
});
|
import latinize from 'latinize';
export function urlify(m) {
return m.toLowerCase().replace(/[^a-z0-9]/g, '');
}
// remove all html tags
export function textify(m) {
return m.replace(/<\/?[^>]+(>|$)/g, '').replace(/\s{2,}/g, ' ');
}
export function sanitize(str) {
return textify(latinize(str.toLowerCase()));
}
export function simplify(str) {
return str.replace(/<\/em>( )*<em>/ig, (match, p1) => p1 ? ' ' : '');
}
export function elipses({ text, maxLength }) {
if (text.length < maxLength) {
return text;
}
return `${text.substring(0, maxLength)}…`;
}
export function stemify(str) {
return latinize(textify(str).toLowerCase()).replace(/[^a-z]/, '');
}
|
/**
* TrackerMap
*
* @author Alexey Grebenshchikov
* @copyright (c) 2008, by Alexey Grebenshchikov
* @date 14 october 2010
* @version 0.1
*
* @license login.js is licensed under the terms of the Open Source
* LGPL 3.0 license. Commercial use is permitted to the extent that the
* code/component(s) do NOT become part of another Open Source or Commercially
* licensed development library or toolkit without explicit permission.
*
* License details: http://www.gnu.org/licenses/lgpl.html
*/
/* TrackerMap - map wrapper */
Ext.ns('Application');
Application.TrackerMap = Ext.extend(Object, {
map : null, // map object
baseLayer : null, // base layer
devicesLayer : null, // layer fo devices markers
viewProjection : new OpenLayers.Projection("EPSG:4326"), // default view projection
devicesMarkers : {}, // array of markers
/**
* constructor
*/
constructor: function() {
var options = {
projection: new OpenLayers.Projection('EPSG:900913'),
displayProjection: new OpenLayers.Projection('EPSG:4326'),
units: 'dd',
minResolution: 'auto',
maxResolution: 'auto',
controls: [
new OpenLayers.Control.OverviewMap(),
new OpenLayers.Control.MousePosition(),
new OpenLayers.Control.Navigation(),
new OpenLayers.Control.PanZoomBar(),
new OpenLayers.Control.Attribution()
]
};
this.map = new OpenLayers.Map('map', options);
this.baseLayer = new OpenLayers.Layer.OSM.Mapnik('Mapnik');
var planeStyleMap = new OpenLayers.StyleMap({
externalGraphic: "/images/marker.png",
graphicWidth: 21,
graphicHeight: 25,
fillOpacity: 0.60,
rotation: "${angle}"
});
this.devicesLayer = new OpenLayers.Layer.Vector('Devices', {
projection: new OpenLayers.Projection("EPSG:4326"),
visibility: true,
displayInLayerSwitcher: false,
styleMap: planeStyleMap
});
this.map.addLayers([this.baseLayer, this.devicesLayer]);
this.setCenter(37.650417, 55.757276, 5);
}, // eo constructor
/**
* set center of map
*/
setCenter: function(lon, lat, zoom) {
var lonlat = new OpenLayers.LonLat(lon, lat);
this.map.setCenter(lonlat.transform(this.viewProjection, this.map.projection), zoom);
}, // eo setCenter
/*
* call when click on device in grid
*/
refreshMarker: function(record) {
var imei = record.data['imei'];
var lat = parseFloat(record.data['latitude']);
var lon = parseFloat(record.data['longitude']);
var marker = null;
var zoom = this.map.getZoom();
if(this.devicesMarkers[imei] == null) {
//marker = new OpenLayers.Marker(lonlat);
var geometry = new OpenLayers.Geometry.Point(lon, lat).transform(this.viewProjection, this.map.projection);
marker = new OpenLayers.Feature.Vector(geometry, {
angle: 0,
poppedup: false
});
this.devicesMarkers[imei] = marker;
this.devicesLayer.addFeatures(marker);
this.setCenter(lon, lat, zoom);
} else {
var lonlat = new OpenLayers.LonLat(lon, lat).transform(this.viewProjection, this.map.projection);
marker = this.devicesMarkers[imei];
marker.move(lonlat);
this.setCenter(lon, lat, zoom);
}
},
/*
* get all devices markers
*/
getDevicesMarkers: function() {
return this.devicesMarkers;
}
}); // eo TrackerMap
|
( function( window ) {
"use strict";
window.innerWidth = 600;
window.innerHeight = 400;
window.gadget = window.gadget || {};
window.gadget.settings = {
"params": {},
"additionalParams": {
"interactivity": {
"interactive": false,
"scrollbars": false
},
"refresh": 0,
"region": {
"showRegion": "page",
"horizontal": 0,
"vertical": 0
},
"unload": false,
"url": "http://www.risevision.com",
"zoom": "1"
}
};
} )( window );
|
// staff-global.js
if ( KOHA === undefined ) var KOHA = {};
function _(s) { return s; } // dummy function for gettext
// http://stackoverflow.com/questions/1038746/equivalent-of-string-format-in-jquery/5341855#5341855
String.prototype.format = function() { return formatstr(this, arguments) }
function formatstr(str, col) {
col = typeof col === 'object' ? col : Array.prototype.slice.call(arguments, 1);
var idx = 0;
return str.replace(/%%|%s|%(\d+)\$s/g, function (m, n) {
if (m == "%%") { return "%"; }
if (m == "%s") { return col[idx++]; }
return col[n];
});
};
// http://stackoverflow.com/questions/14859281/select-tab-by-name-in-jquery-ui-1-10-0/16550804#16550804
$.fn.tabIndex = function () {
return $(this).parent().children('div').index(this);
};
$.fn.selectTabByID = function (tabID) {
$(this).tabs("option", "active", $(tabID).tabIndex());
};
$(document).ready(function() {
$('#header_search').tabs().on( "tabsactivate", function(e, ui) { $(this).find("div:visible").find('input').eq(0).focus(); });
$(".close").click(function(){ window.close(); });
if($("#header_search #checkin_search").length > 0){ shortcut.add('Alt+r',function (){ $("#header_search").selectTabByID("#checkin_search"); $("#ret_barcode").focus(); }); } else { shortcut.add('Alt+r',function (){ location.href="/cgi-bin/koha/circ/returns.pl"; }); }
if($("#header_search #circ_search").length > 0){ shortcut.add('Alt+u',function (){ $("#header_search").selectTabByID("#circ_search"); $("#findborrower").focus(); }); } else { shortcut.add('Alt+u',function(){ location.href="/cgi-bin/koha/circ/circulation.pl"; }); }
if($("#header_search #catalog_search").length > 0){ shortcut.add('Alt+q',function (){ $("#header_search").selectTabByID("#catalog_search"); $("#search-form").focus(); }); } else { shortcut.add('Alt+q',function(){ location.href="/cgi-bin/koha/catalogue/search.pl"; }); }
$(".focus").focus();
$(".validated").each(function() {
$(this).validate();
});
$("#logout").on("click",function(){
logOut();
});
$("#helper").on("click",function(){
openHelp();
return false;
});
$("body").on("keypress", ".noEnterSubmit", function(e){
return checkEnter(e);
});
});
// http://jennifermadden.com/javascript/stringEnterKeyDetector.html
function checkEnter(e){ //e is event object passed from function invocation
var characterCode; // literal character code will be stored in this variable
if(e && e.which){ //if which property of event object is supported (NN4)
characterCode = e.which; //character code is contained in NN4's which property
} else {
characterCode = e.keyCode; //character code is contained in IE's keyCode property
}
if(characterCode == 13){ //if generated character code is equal to ascii 13 (if enter key)
return false;
} else {
return true;
}
}
function clearHoldFor(){
$.removeCookie("holdfor", { path: '/' });
}
function logOut(){
if( typeof delBasket == 'function' ){
delBasket('main', true);
}
clearHoldFor();
}
function openHelp(){
openWindow("/cgi-bin/koha/help.pl","KohaHelp",600,600);
}
jQuery.fn.preventDoubleFormSubmit = function() {
jQuery(this).submit(function() {
$("body, form input[type='submit'], form button[type='submit'], form a").addClass('waiting');
if (this.beenSubmitted)
return false;
else
this.beenSubmitted = true;
});
};
function openWindow(link,name,width,height) {
name = (typeof name == "undefined")?'popup':name;
width = (typeof width == "undefined")?'600':width;
height = (typeof height == "undefined")?'400':height;
//IE <= 9 can't handle a "name" with whitespace
try {
var newin=window.open(link,name,'width='+width+',height='+height+',resizable=yes,toolbar=false,scrollbars=yes,top');
} catch(e) {
var newin=window.open(link,null,'width='+width+',height='+height+',resizable=yes,toolbar=false,scrollbars=yes,top');
}
}
// Use this function to remove the focus from any element for
// repeated scanning actions on errors so the librarian doesn't
// continue scanning and miss the error.
function removeFocus() {
$(':focus').blur();
}
function toUC(f) {
var x=f.value.toUpperCase();
f.value=x;
return true;
}
function confirmDelete(message) {
return (confirm(message) ? true : false);
}
function playSound( sound ) {
if ( ! ( sound.indexOf('http://') == 0 || sound.indexOf('https://') == 0 ) ) {
sound = AUDIO_ALERT_PATH + sound;
}
document.getElementById("audio-alert").innerHTML = '<audio src="' + sound + '" autoplay="autoplay" autobuffer="autobuffer"></audio>';
}
|
/**
* Copyright Intermesh
*
* This file is part of Group-Office. You should have received a copy of the
* Group-Office license along with Group-Office. See the file /LICENSE.TXT
*
* If you have questions write an e-mail to info@intermesh.nl
*
* @version $Id: EventPanel.js 22112 2018-01-12 07:59:41Z mschering $
* @copyright Copyright Intermesh
* @author Merijn Schering <mschering@intermesh.nl>
*/
GO.calendar.EventPanel = Ext.extend(GO.DisplayPanel,{
model_name : "GO\\Calendar\\Model\\Event",
stateId : 'cal-event-panel',
editGoDialogId : 'event',
editHandler : function(){
GO.calendar.showEventDialog({event_id: this.link_id});
},
updateToolbar : function(){
GO.calendar.EventPanel.superclass.updateToolbar.call(this);
this.editButton.setDisabled(!this.data.is_organizer);
},
initComponent : function(){
this.loadUrl=('calendar/event/display');
this.template =
'<table class="display-panel" cellpadding="0" cellspacing="0" border="0">'+
// '<tr>'+
// '<td colspan="2" class="display-panel-heading">'+t("Event", "calendar")+': {name}</td>'+
// '</tr>'+
// '<tr>'+
// '<td colspan="2"><table><tr><td>'+t("Calendar", "calendar")+': </td><td>{calendar_name}</td></tr></table></td>'+
// '</tr>'+
'<tr>'+
'<td colspan="2">{event_html}</td>'+
'</tr>'+
'</table>';
this.template +=GO.customfields.displayPanelTemplate;
if(go.Modules.isAvailable("legacy", "workflow")){
this.template +=GO.workflow.WorkflowTemplate;
}
GO.calendar.EventPanel.superclass.initComponent.call(this);
}
});
|
/*
* uget-chrome-wrapper is an extension to integrate uGet Download manager
* with Google Chrome, Chromium, Vivaldi and Opera in Linux and Windows.
*
* Copyright (C) 2016 Gobinath
*
* 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/>.
*/
var current_browser;
try {
current_browser = browser;
current_browser.runtime.getBrowserInfo().then(
function(info) {
if (info.name === 'Firefox') {
// Do nothing
}
}
);
} catch (ex) {
// Not Firefox
current_browser = chrome;
}
function saveChanges() {
var keywordsToExclude = document.getElementById("keywordsToExclude").value.trim();
var keywordsToInclude = document.getElementById("keywordsToInclude").value.trim();
var interrupt = document.getElementById('chk-interrupt').checked;
var minFileSize = parseInt(document.getElementById("fileSize").value) * 1024;
if (isNaN(minFileSize)) {
minFileSize = 300 * 1024;
} else if(minFileSize < 0) {
minFileSize = -1024; // Which is -1 KB
}
current_browser.runtime.getBackgroundPage(function(backgroundPage) {
backgroundPage.updateKeywords(keywordsToInclude, keywordsToExclude);
backgroundPage.setInterruptDownload(interrupt, true);
backgroundPage.updateMinFileSize(minFileSize);
});
window.close();
}
// When the popup HTML has loaded
window.addEventListener('load', function(evt) {
// Show the system status
current_browser.runtime.getBackgroundPage(function(backgroundPage) {
var state = backgroundPage.getState();
if (state == 0) {
// document.getElementById('info').innerHTML = "Info: Found uGet and uget-chrome-wrapper";
document.getElementById('info').style.display = 'block';
document.getElementById('warn').style.display = 'none';
document.getElementById('error').style.display = 'none';
var element = document.getElementById("element-id");
element.parentNode.removeChild(element);
} else if (state == 1) {
// document.getElementById('warn').innerHTML = "Warning: Please update the uget-chrome-wrapper to the latest version";
document.getElementById('info').style.display = 'none';
document.getElementById('warn').style.display = 'block';
document.getElementById('error').style.display = 'none';
} else {
// document.getElementById('error').innerHTML = "Error: Unable to connect to the uget-chrome-wrapper";
document.getElementById('info').style.display = 'none';
document.getElementById('warn').style.display = 'none';
document.getElementById('error').style.display = 'block';
}
});
let interrupt = (current_browser.storage.sync["uget-interrupt"] == "true");
document.getElementById('save').addEventListener('click', saveChanges);
current_browser.storage.sync.get(function(items) {
document.getElementById('keywordsToExclude').value = items["uget-keywords-exclude"];
document.getElementById('keywordsToInclude').value = items["uget-keywords-include"];
document.getElementById('fileSize').value = parseInt(items["uget-min-file-size"]) / 1024;
document.getElementById('chk-interrupt').checked = items["uget-interrupt"] == "true";
});
});
|
Ext.define('Omni.view.bin_skus.Inspector', {
extend:'Buildit.ux.inspector.Panel',
alias:'widget.omni-bin_skus-Inspector',
initComponent:function () {
var me = this;
// LABELS (Start) ======================================================================
// LABELS (End)
// INSPECTOR INIT (Start) ==============================================================
Ext.applyIf(this, {
associativeFilter: {
property: 'bin_sku_id',
value: me.record.get('bin_sku_id')
}
});
// INSPECTOR INIT (End)
// CARDS (Start) =======================================================================
Ext.apply(this, {
cards: [
{
title: 'Profile',
xtype: 'omni-bin_skus-Form'
}
]
});
// CARDS (End)
// TITLES (Start) ======================================================================
Ext.apply(this, {
title: 'Bin Sku',
subtitle: this.record.get('display')
});
// TITLES (End)
this.callParent();
}
});
|
module("About Scope (topics/about_scope.js)");
thisIsAGlobalVariable = 77;
test("global variables", function() {
equal(77, thisIsAGlobalVariable, 'is thisIsAGlobalVariable defined in this scope?');
});
test("variables declared inside of a function", function() {
var outerVariable = "outer";
// this is a self-invoking function. Notice that it calls itself at the end ().
(function() {
var innerVariable = "inner";
equal('outer', outerVariable, 'is outerVariable defined in this scope?');
equal('inner', innerVariable, 'is innerVariable defined in this scope?');
})();
equal('outer', outerVariable, 'is outerVariable defined in this scope?');
equal('undefined', typeof(innerVariable), 'is innerVariable defined in this scope?');
});
|
var loggedInUserInfo;
function setupMenu() {
jQuery.ajaxSetup({async:false});
$.get('/adoration/getLoggedInUserInfo', function(data) {
loggedInUserInfo = data.loggedInUserInfo;
if (loggedInUserInfo.isLoggedIn) {
$("#loggedInUserLegend").text("Belépve: " + loggedInUserInfo.loggedInUserName);
$("#nav-information").show();
$("#nav-exit").show();
} else {
$("#loggedInUserLegend").text("");
$("#nav-login").show();
}
if (loggedInUserInfo.isRegisteredAdorator) {
$("#nav-ador-list").show();
} else {
$("#nav-ador-registration").show();
}
if (loggedInUserInfo.isAdoratorAdmin) {
$("#nav-application-log").show();
}
});
jQuery.ajaxSetup({async:true});
}
function getReadableLanguageCode(code) {
var z;
switch (code) {
case "hu": z = 'magyar'; break;
case "en": z = 'angol'; break;
case "it": z = 'olasz'; break;
case "es": z = 'spanyol'; break;
case "fr": z = 'francia'; break;
case "ge": z = 'német'; break;
default: z = '???';
}
return z;
}
function validateEmail(email) {
var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; //NOSONAR
return re.test(String(email).toLowerCase());
}
function findGetParameter(parameterName) {
var result = null,
tmp = [];
var items = location.search.substr(1).split("&");
for (var index = 0; index < items.length; index++) {
tmp = items[index].split("=");
if (tmp[0] === parameterName) result = decodeURIComponent(tmp[1]);
}
return result;
}
function getDayNameLocalized(hourId, dayNames) {
var x = getDay(hourId);
return dayNames[x];
}
function getDayName(hourId) {
var dayNames = ['vasárnap', 'hétfő', 'kedd', 'szerda', 'csütörtök', 'péntek', 'szombat']
var x = getDay(hourId);
return dayNames[x];
}
/**
* Get Day ID (0..6) from hourID.
*/
function getDay(hourId) {
var x = Math.floor(hourId / 24);
return x;
}
function getHourName(hourId) {
return hourId % 24;
}
function getPerson(list, personId) {
for (var i = 0; i < list.length; i++) {
if (list[i].id == personId) {
return list[i];
}
}
return null;
}
function getCoordinator(list, hourInDayId) {
for (var i = 0; i < list.length; i++) {
if (parseInt(list[i].coordinatorType) == hourInDayId) {
return list[i];
}
}
return null;
}
//replacing alert
var alertModal;
var alertSpan;
var alertAfterCloseFunction;
function showAlert(title, message, afterCloseFunction) {
$("#commonAlertTitle").text(title);
$("#commonAlertBody").text(message);
alertModal = document.getElementById("commonAlertModal");
alertSpan = document.getElementsByClassName("commonAlertClose")[0];
alertAfterCloseFunction = afterCloseFunction;
// When the user clicks anywhere outside of the modal, close it
window.onclick = function(event) {
if (event.target == alertModal) {
hideAlert();
}
}
alertModal.style.display="block";
}
function hideAlert() {
alertModal.style.display="none";
if (typeof alertAfterCloseFunction != "undefined") {
alertAfterCloseFunction();
}
}
//replacing confirm
var confirmModal;
var confirmSpan;
var confirmAfterCloseFunctionOk;
var confirmAfterCloseFunctionCancel;
function showConfirm(title, message, afterCloseFunctionOk, afterCloseFunctionCancel) {
$("#commonConfirmTitle").text(title);
$("#commonConfirmBody").text(message);
confirmModal = document.getElementById("commonConfirmModal");
confirmSpan = document.getElementsByClassName("commonConfirmClose")[0];
confirmAfterCloseFunctionOk = afterCloseFunctionOk;
confirmAfterCloseFunctionCancel = afterCloseFunctionCancel;
// When the user clicks anywhere outside of the modal, close it
window.onclick = function(event) {
if (event.target == confirmModal) {
hideConfirmCancel();
}
}
confirmModal.style.display="block";
}
function hideConfirmCancel() {
confirmModal.style.display="none";
if (typeof confirmAfterCloseFunctionCancel != "undefined") {
confirmAfterCloseFunctionCancel();
}
}
function hideConfirmOk() {
confirmModal.style.display="none";
if (typeof confirmAfterCloseFunctionOk != "undefined") {
confirmAfterCloseFunctionOk();
}
}
function reloadLocation() {
location.reload();
}
|
var path = require('path');
var Sequelize = require('sequelize');
var env = require(path.join(__dirname, '../env'));
var db = new Sequelize(env.DATABASE_URI, {
logging: env.LOGGING
});
module.exports = db;
|
import { asyncRoute } from 'helpers/routerHelpers';
export default [
{
requireAuth: false,
module: 'goodbye',
path: 'goodbye',
getComponent: asyncRoute((nextState, cb) => {
require.ensure(
[],
() => {
const { openGoodbyeOverlay } = require('./module');
cb(null, {
overlay: openGoodbyeOverlay,
});
},
'overlay',
);
}),
},
];
// WEBPACK FOOTER //
// ./src/js/app/modules/goodbye/routes.js
|
/**
* @author Mathew "WSpecificermadev" WSpecificer
* created on 09.05.2017
*/
(function () {
'use strict';
angular.module('BlurAdmin.pages.claim')
.controller('ClaimCtrl', ClaimCtrl);
/** @ngInject */
function ClaimCtrl($scope, $stateParams, claim, explorer, utility) {
$scope.explorer = explorer;
$scope.util = utility;
var id = $stateParams.id;
claim.getSpecificDefer(id).then(function () {
var temp = claim.getSpecificData();
$scope.selectedClaimData = temp;
});
}
})();
|
function MissingFilesPage() {
}
MissingFilesPage.prototype.createNodes = function() {
var self = this;
this.page = document.createElement("div");
this.page.innerHTML = "<h1>Missing Files</h1>";
this.content = document.createElement("div");
this.page.appendChild(this.content);
this.loadList(function() {
});
return this.page;
}
MissingFilesPage.prototype.removeNodes = function() {
$(this.page).remove();
}
MissingFilesPage.prototype.groupData = function(data) {
// TODO group by directory
return data.missingFiles.reduce(function(acc, file) {
acc[file.showName] = acc[file.showName] || [];
acc[file.showName].push(file);
return acc;
}, {});
}
MissingFilesPage.prototype.loadList = function(callback) {
var self = this;
$.getJSON("/api/library/filter/missingFiles", function(data) {
var grouped = self.groupData(data);
$(self.content).empty();
for (var groupKey in grouped) {
var groupEl = document.createElement("ol");
groupEl.textContent = groupKey;
var groupArray = grouped[groupKey];
var nodes = groupArray.map(function(file) {
var el = document.createElement("li");
el.textContent = file.path;
return el;
});
var deleteButton = self.createDeleteButton(groupArray);
$(groupEl).append(deleteButton);
$(groupEl).append(nodes);
self.content.appendChild(groupEl);
}
callback(grouped);
});
}
MissingFilesPage.prototype.createDeleteButton = function(groupArray) {
var button = document.createElement("button");
button.textContent = "remove";
$(button).click(function() {
var paths = groupArray.map(function(file) {
return file.path;
});
$.ajax({
url: "/api/library/removeFiles/",
type: "DELETE",
data: JSON.stringify({paths: paths})
}).done(function() {
});;
});
return button;
}
|
/// Copyright (c) 2012 Ecma International. All rights reserved.
/// Ecma International makes this code available under the terms and conditions set
/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
/// "Use Terms"). Any redistribution of this code must retain the above
/// copyright and this notice and otherwise comply with the Use Terms.
/**
* @path ch15/15.2/15.2.3/15.2.3.5/15.2.3.5-4-46.js
* @description Object.create - 'enumerable' property of one property in 'Properties' is true (8.10.5 step 3)
*/
function testcase() {
var accessed = false;
var newObj = Object.create({}, {
prop: {
enumerable: true
}
});
for (var property in newObj) {
if (property === "prop") {
accessed = true;
}
}
return accessed;
}
runTestCase(testcase);
|
import { initializeApp } from 'firebase/app';
import { getPerformance } from 'firebase/performance';
const config = require('./config.json');
const firebaseApp = initializeApp(config);
getPerformance(firebaseApp);
export default firebaseApp;
|
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2004-2012 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Tino Butz (tbtz)
* Christopher Zuendorf (czuendorf)
************************************************************************ */
/**
* Mobile page responsible for showing the landing page for the "animation" showcase.
*/
qx.Class.define("mobileshowcase.page.AnimationLanding",
{
extend : qx.ui.mobile.page.NavigationPage,
construct : function()
{
this.base(arguments);
this.setTitle("Animation");
this.setShowBackButton(true);
this.setShowBackButtonOnTablet(true);
this.setBackButtonText("Back");
},
properties :
{
/**
* The current animaton.
*/
animation :
{
check : "String",
init : ""
}
},
members :
{
__landingText : '<strong>Tap "back" button for the reverse animation</strong>',
// overridden
_initialize : function()
{
this.base(arguments);
var embed = new qx.ui.mobile.embed.Html(this.__landingText);
if(this._isTablet) {
qx.event.Registration.addListener(this, "appear", this.__deactiveAnimation, this);
}
this.getContent().add(embed);
},
/**
* Deactivates the animation on parentContainer's layout.
*/
__deactiveAnimation : function() {
this.getLayoutParent().getLayout().setShowAnimation(false);
},
// overridden
_back : function()
{
qx.core.Init.getApplication().getRouting().executeGet("/animation", {animation:this.getAnimation(), reverse:true});
},
/*
*****************************************************************************
DESTRUCTOR
*****************************************************************************
*/
destruct : function() {
this._disposeObjects("__landingText");
}
}
});
|
import React from 'react';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import PublicationPageLayout from '../components/PublicationPageLayout';
import * as PublicationPageActions from '../actions/PublicationPageActions';
class PublicationPage extends React.Component {
render() {
return (
<PublicationPageLayout {...this.props} />
);
}
}
const mapStateToProps = (state) => ({
id: state.userState.id,
title: state.publicationState.publication.title,
description: state.publicationState.publication.description,
});
const mapDispatchToProps = (dispatch) => ({
...bindActionCreators({
...PublicationPageActions,
}, dispatch)
});
export default connect(mapStateToProps, mapDispatchToProps)(PublicationPage);
|
//Application description box
AnnoJ.AboutBox = (function()
{
var info = {
//logo : "<a href='http://www.annoj.org'><img src='http://neomorph.salk.edu/epigenome/img/Anno-J.jpg' alt='Anno-J logo' /></a>",
logo : "",
version : 'Beta 1.1',
engineer : 'Julian Tonti-Filippini',
contact : 'tontij01(at)student.uwa.edu.au',
copyright : '© 2008 Julian Tonti-Filippini',
website : "<a href='http://www.annoj.org'>http://www.annoj.org</a>",
//tutorial : "<a target='new' href='http://neomorph.salk.edu/index.html'>SALK example</a>",
license : ""
};
var body = new Ext.Element(document.createElement('DIV'));
var html =
"<div style='padding-bottom:10px;'>" + info.logo + "</div>" +
"<table style='font-size:10px';>" +
"<tr><td><div><b>Version: </b></td><td>" + info.version +"</div></td></tr>" +
"<tr><td><div><b>Engineer: </b></td><td>" + info.engineer +"</div></td></tr>" +
"<tr><td><div><b>Contact: </b></td><td>" + info.contact +"</div></td></tr>" +
"<tr><td><div><b>Copyright: </b></td><td>" + info.copyright +"</div></td></tr>" +
"<tr><td><div><b>Website: </b></td><td>" + info.website +"</div></td></tr>" +
"<tr><td><div><b>License: </b></td><td>" + info.license +"</div></td></tr>" +
"<tr><td><div><b>Tutorial: </b></td><td>" + info.tutorial +"</div></td></tr>" +
"</table>"
;
body.addCls('AJ_aboutbox');
body.update(html);
function addCitation(c)
{
body.update(c + html);
};
return function()
{
AnnoJ.AboutBox.superclass.constructor.call(this, {
title : 'Citation',
iconCls : 'silk_user_comment',
border : false,
contentEl : body,
autoScroll : true
});
this.info = info;
this.addCitation = addCitation;
};
})();
// Ext.extend(AnnoJ.AboutBox, Ext.Panel);
Ext.extend(AnnoJ.AboutBox,Ext.Panel,{})
|
/*
添加用户的教育经历
*/
import React, { PropTypes } from 'react';
import { Toast, Msg } from 'react-weui';
import RecordHistory from '../detail/RecordHistory';
import AddRecord from './AddRecord';
import RemoveRecord from './RemoveRecord';
import { connect } from 'react-redux';
import * as actions from '../../../actions/acceptors/record';
export class EditRecordComponent extends React.Component {
static propTypes = {
data: React.PropTypes.array,
add: PropTypes.func,
remove: PropTypes.func,
init: PropTypes.func,
err: PropTypes.object,
fields: PropTypes.object,
toast: PropTypes.object,
acceptorId: PropTypes.string.isRequired,
};
static contextTypes = {
setTitle: PropTypes.func.isRequired,
};
componentDidMount() {
this.props.init(this.props.acceptorId);
this.context.setTitle('修改受赠记录');
}
render() {
const { err, data, toast } = this.props;
return err ? <Msg type="warn" title="发生错误" description={JSON.stringify(err.msg)} /> : (
<div>
<RecordHistory data={data} />
<AddRecord {...this.props} />
<RemoveRecord {...this.props} />
<Toast icon="loading" show={toast.show} >加载中</Toast>
</div>
);
}
}
const mapStateToProps = state => ({
...state.acceptors.records,
});
const mapDispatchToProps = dispatch => ({
add: (id, record) => dispatch(actions.addRecord(id, record)),
init: id => dispatch(actions.initRecords(id)),
remove: (id, recordId) => dispatch(actions.deleteRecord(id, recordId)),
});
export default connect(mapStateToProps, mapDispatchToProps)(EditRecordComponent);
|
/*
Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/
CKEDITOR.plugins.setLang( 'embedbase', 'hr', {
pathName: 'objekt medija',
title: 'Media Embed',
button: 'Umetanje Media Embed',
unsupportedUrlGiven: 'Navedeni URL nije podržan',
unsupportedUrl: 'URL {url} nije podržan od strane Media Embed-a.',
fetchingFailedGiven: 'Nije moguće dohvatiti sadržaj danog URL-a.',
fetchingFailed: 'Nije moguće dohvatiti sadržaj za {url}.',
fetchingOne: 'Dohvaćanje oEmbed odgovora...',
fetchingMany: 'Dohvaćanje oEmbed odgovora, {current} od {max} gotovo...'
} );
|
$.components.register("ajax", {
defaults: {
},
init: function(context) {
},
api: function() {
$(document).on('click.site.ajax', '[data-plugin="ajax"]', function(e) {
e.preventDefault();
var $this = $(this);
var href, url = $(this).attr('data-target') || (href = $(this).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '');
var successEvent = $.Event('success.site.ajax', {
relatedTarget: $this[0]
});
var failureEvent = $.Event('failure.site.ajax', {
relatedTarget: $this[0]
});
$.get(url).then(function() {
$this.trigger(successEvent);
}, function() {
$this.trigger(failureEvent);
});
});
}
});
|
//placeholder for custom scripts
|
'use strict';
var localConnection;
var remoteConnection;
var sendChannel;
var receiveChannel;
var pcConstraint;
var dataConstraint;
var dataChannelSend = document.querySelector('textarea#dataChannelSend');
var dataChannelReceive = document.querySelector('textarea#dataChannelReceive');
var startButton = document.querySelector('button#commentStartButton');
var sendButton = document.querySelector('button#commentSendButton');
var closeButton = document.querySelector('button#commentCloseButton');
startButton.onclick = createConnection;
sendButton.onclick = sendData;
closeButton.onclick = closeDataChannels;
function enableStartButton() {
startButton.disabled = false;
}
function disableSendButton() {
sendButton.disabled = true;
}
function createConnection() {
dataChannelSend.placeholder = '';
var servers = null;
pcConstraint = null;
dataConstraint = null;
trace('Using SCTP based data channels');
// For SCTP, reliable and ordered delivery is true by default.
// Add localConnection to global scope to make it visible
// from the browser console.
window.localConnection = localConnection =
new RTCPeerConnection(servers, pcConstraint);
trace('Created local peer connection object localConnection');
sendChannel = localConnection.createDataChannel('sendDataChannel',
dataConstraint);
trace('Created send data channel');
localConnection.onicecandidate = iceCallback1;
sendChannel.onopen = onSendChannelStateChange;
sendChannel.onclose = onSendChannelStateChange;
// Add remoteConnection to global scope to make it visible
// from the browser console.
window.remoteConnection = remoteConnection =
new RTCPeerConnection(servers, pcConstraint);
trace('Created remote peer connection object remoteConnection');
remoteConnection.onicecandidate = iceCallback2;
remoteConnection.ondatachannel = receiveChannelCallback;
localConnection.createOffer().then(
gotDescription1,
onCreateSessionDescriptionError
);
startButton.disabled = true;
closeButton.disabled = false;
}
function onCreateSessionDescriptionError(error) {
trace('Failed to create session description: ' + error.toString());
}
function sendData() {
var data = dataChannelSend.value;
sendChannel.send(data);
trace('Sent Data: ' + data);
}
function closeDataChannels() {
trace('Closing data channels');
sendChannel.close();
trace('Closed data channel with label: ' + sendChannel.label);
receiveChannel.close();
trace('Closed data channel with label: ' + receiveChannel.label);
localConnection.close();
remoteConnection.close();
localConnection = null;
remoteConnection = null;
trace('Closed peer connections');
startButton.disabled = false;
sendButton.disabled = true;
closeButton.disabled = true;
dataChannelSend.value = '';
dataChannelReceive.value = '';
dataChannelSend.disabled = true;
disableSendButton();
enableStartButton();
}
function gotDescription1(desc) {
localConnection.setLocalDescription(desc);
trace('Offer from localConnection \n' + desc.sdp);
remoteConnection.setRemoteDescription(desc);
remoteConnection.createAnswer().then(
gotDescription2,
onCreateSessionDescriptionError
);
}
function gotDescription2(desc) {
remoteConnection.setLocalDescription(desc);
trace('Answer from remoteConnection \n' + desc.sdp);
localConnection.setRemoteDescription(desc);
}
function iceCallback1(event) {
trace('local ice callback');
if (event.candidate) {
remoteConnection.addIceCandidate(
event.candidate
).then(
onAddIceCandidateSuccess,
onAddIceCandidateError
);
trace('Local ICE candidate: \n' + event.candidate.candidate);
}
}
function iceCallback2(event) {
trace('remote ice callback');
if (event.candidate) {
localConnection.addIceCandidate(
event.candidate
).then(
onAddIceCandidateSuccess,
onAddIceCandidateError
);
trace('Remote ICE candidate: \n ' + event.candidate.candidate);
}
}
function onAddIceCandidateSuccess() {
trace('AddIceCandidate success.');
}
function onAddIceCandidateError(error) {
trace('Failed to add Ice Candidate: ' + error.toString());
}
function receiveChannelCallback(event) {
trace('Receive Channel Callback');
receiveChannel = event.channel;
receiveChannel.onmessage = onReceiveMessageCallback;
receiveChannel.onopen = onReceiveChannelStateChange;
receiveChannel.onclose = onReceiveChannelStateChange;
}
function onReceiveMessageCallback(event) {
trace('Received Message');
dataChannelReceive.value = event.data;
}
function onSendChannelStateChange() {
var readyState = sendChannel.readyState;
trace('Send channel state is: ' + readyState);
if (readyState === 'open') {
dataChannelSend.disabled = false;
dataChannelSend.focus();
sendButton.disabled = false;
closeButton.disabled = false;
} else {
dataChannelSend.disabled = true;
sendButton.disabled = true;
closeButton.disabled = true;
}
}
function onReceiveChannelStateChange() {
var readyState = receiveChannel.readyState;
trace('Receive channel state is: ' + readyState);
}
function trace(text) {
if (text[text.length - 1] === '\n') {
text = text.substring(0, text.length - 1);
}
if (window.performance) {
var now = (window.performance.now() / 1000).toFixed(3);
console.log(now + ': ' + text);
} else {
console.log(text);
}
}
|
import React, { Component } from 'react';
import { connect } from 'react-redux';
export class Footer extends Component {
render() {
return (
<footer className="opendata-footer footer">
<nav className="navbar bottom navbar-expand-lg navbar-dark bg-primary">
<div>
<span style={{ color: "#fff" }}>{this.props.text}:</span>
<a href="http://www.vectr.consulting"><img src="logos/VectrConsulting.svg" height={30} /></a>
<a href="http://www.vereenvoudiging.be/" ><img src="logos/DAV.png" height={30} /></a>
<a href="http://www.dekamer.be/" ><img src="logos/dekamer.jpg" height={30} /></a>
<a href="https://neo4j.com/" ><img src="logos/Neo4j.png" height={30} /></a>
</div>
</nav>
</footer>
);
}
}
export default connect(
state => ({ text: state.locale.translation.footer })
)(Footer)
|
/************************************************************************
* This file is part of EspoCRM.
*
* EspoCRM - Open Source CRM application.
* Copyright (C) 2014-2022 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
* Website: https://www.espocrm.com
*
* EspoCRM is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* EspoCRM is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
*
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
Espo.define('views/fields/datetime-short', 'views/fields/datetime', function (Dep) {
return Dep.extend({
listTemplate: 'fields/datetime-short/list',
detailTemplate: 'fields/datetime-short/detail',
data: function () {
var data = Dep.prototype.data.call(this);
if (this.mode == 'list' || this.mode == 'detail') {
data.fullDateValue = Dep.prototype.getDateStringValue.call(this);
}
return data;
},
getDateStringValue: function () {
if (this.mode == 'list' || this.mode == 'detail') {
var value = this.model.get(this.name)
if (value) {
var string;
var timeFormat = this.getDateTime().timeFormat;
if (this.params.hasSeconds) {
timeFormat = timeFormat.replace(/:mm/, ':mm:ss');
}
var d = this.getDateTime().toMoment(value);
var now = moment().tz(this.getDateTime().timeZone || 'UTC');
if (d.unix() > now.clone().startOf('day').unix() && d.unix() < now.clone().add(1, 'days').startOf('day').unix()) {
string = d.format(timeFormat);
return string;
}
var readableFormat = this.getDateTime().getReadableShortDateFormat();
if (d.format('YYYY') == now.format('YYYY')) {
string = d.format(readableFormat);
} else {
string = d.format(readableFormat + ', YY');
}
return string;
}
}
return Dep.prototype.getDateStringValue.call(this);
}
});
});
|
/* -*- indent-tabs-mode:nil; coding: utf-8 -*-
Copyright (C) 2015
"Mu Lei" known as "NalaGinrut" <NalaGinrut@gmail.com>
Grandis is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License by the Free
Software Foundation, either version 3 of the License, or (at your
option) any later version.
Grandis 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/>.
*/
var Class = easejs.Class;
var gensym = (function () {
var cnt = 0;
return function (name) { return name + cnt++; };
}) ();
function is_defined(x) {
return ((x !== 'undefined') && x);
}
function data2url(data) {
var ret = [];
for (var k in data) {
ret.push(k + '=' + data[k]);
}
return ret.join('&');
}
// (let ((cnt 0))
// ...)
// ==> (function () { var cnt = 0; ... }) ();
|
Template.messages.helpers({
messages: [
{ title : "This feature is coming soon!" }
]
});
|
/**
# Mantis Plugin "EasyEnter"
# Copyright (C) 2015 Frithjof Gnas - fg@prae-sensation.de
#
# Javascript functions and calls to slim down the bug-report-form on the
# configured base of include_fields, field_values etc..
#
# Disclaimer & License:
# This plugin - EasyEnter - 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 MantisBT. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* Function calls, plugin execution
*/
populate_field_values( );
hide_all_fields_show_include_fields( );
/*
* Functions
*/
/**
* Set the values defined in "easyenter_config" for the corresponding fields
* TODO: Implemet jQuery-populate-plugin
*/
function populate_field_values( ) {
if( !easyenter_config.hasOwnProperty( 'field_values' ) ) {
return;
}
for( field_name in easyenter_config.field_values ) {
var thisInputfield = jQuery( '[name="' + field_name + '"]' );
if( thisInputfield.length < 1 ) {
continue;
}
if( !easyenter_config.field_values.hasOwnProperty( field_name ) ) {
continue;
}
//radio buttons need special actions, the radio button with "field_name"
// AND the configured field_value should get the attribute "checked"
if( thisInputfield.attr( 'type' ) === 'radio' ) {
thisInputfield = jQuery(
'[name="' + field_name + '"][value="'
+ easyenter_config.field_values[ field_name ] + '"]'
);
thisInputfield.attr('checked', 'checked');
continue;
}
//Single checkboxes are checked when their field_value is "CHECKED"
if( thisInputfield.attr( 'type' ) === 'checkbox' ) {
if ( 'CHECKED' === easyenter_config.field_values[ field_name ] ) {
thisInputfield.attr('checked', 'checked');
continue;
}
}
thisInputfield.val( easyenter_config.field_values[ field_name ] );
}
}
/**
* Hides all fields in "report_bug_form"-form and shows the defined
* "include_fields" afterwards
*/
function hide_all_fields_show_include_fields( ) {
var i = 0;
if( !easyenter_config.hasOwnProperty( 'include_fields' ) ) {
return;
}
if( easyenter_config.include_fields.length < 1 ) {
return;
}
var form = jQuery( 'form#report_bug_form' );
//Hide all fields, except the hidden ones, submit/reset buttons
form.find( 'input, select, textarea')
.not( ':hidden' )
.not( '[type="button"][type="submit"][type="reset"]' )
.each(function( ) {
showhide_input_field_row( jQuery( this ).attr( 'name' ), 0 );
});
//Special fields/rows to hide...
if ( easyenter_config.hasOwnProperty( 'exclude_fields' ) ) {
for( i = 0; i < easyenter_config.exclude_fields.length; i++ ) {
if( easyenter_config.exclude_fields[i] === 'special.custom_profile' ) {
hide_custom_profile_row();
continue;
}
if( easyenter_config.exclude_fields[i] === 'special.mandatory_asterisks' ) {
hide_mandatory_asterisks();
continue;
}
}
}
//Workaround: Profile-Dropdown is not shown if no profiles exists so far
// (whether global nor user-specific profiles) but the approbiate row is
// shown though.
form.find('tr')
.find('td.category:contains("' + label_selectprofile + '")')
.parent('tr').hide();
// Show fields defined in include_fields
for( i = 0; i < easyenter_config.include_fields.length; i++ ) {
showhide_input_field_row( easyenter_config.include_fields[ i ], 1 );
}
}
/**
* Show or hide a table row holding input with given name and label as well
* @param field_name name of the input of which the parent row should be hidden
* @param showrow 1=show row | 0 = hide
*/
function showhide_input_field_row( field_name, showrow ) {
var field = jQuery( '[name="' + field_name + '"]' );
if ( field.length < 1 ) {
return;
}
if( showrow === 1) {
field.parents( 'tr' ).show( );
} else {
field.parents( 'tr' ).hide( );
}
}
/**
* Hides the row for entering a custom profile, this is not covered by
* hide_all_fields_... because in the corresponding row is no input
*/
function hide_custom_profile_row( ) {
jQuery( '#profile_closed' ).parent( 'td' ).parent( 'tr').hide();
}
/**
* Hide all elements with CSS-class "required" which means hide all asterisks
* as well as the notice "* means mandatory field"
*/
function hide_mandatory_asterisks( ) {
jQuery( 'span.required').hide();
}
|
/// Copyright (c) 2012 Ecma International. All rights reserved.
/// Ecma International makes this code available under the terms and conditions set
/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
/// "Use Terms"). Any redistribution of this code must retain the above
/// copyright and this notice and otherwise comply with the Use Terms.
/**
* @path ch15/15.2/15.2.3/15.2.3.3/15.2.3.3-4-200.js
* @description Object.getOwnPropertyDescriptor returns data desc (all false) for properties on built-ins (Number.POSITIVE_INFINITY)
*/
function testcase() {
var desc = Object.getOwnPropertyDescriptor(Number, "POSITIVE_INFINITY");
if (desc.writable === false &&
desc.enumerable === false &&
desc.configurable === false &&
desc.hasOwnProperty('get') === false &&
desc.hasOwnProperty('set') === false) {
return true;
}
}
runTestCase(testcase);
|
/**
* @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.md or http://ckeditor.com/license
*/
/**
* @fileOverview Defines the {@link CKEDITOR.lang} object, for the
* Catalan language.
*/
/**#@+
@type String
@example
*/
/**
* Contains the dictionary of language entries.
* @namespace
*/
CKEDITOR.lang[ 'ca' ] = {
// ARIA description.
editor: 'Editor de text enriquit',
// Common messages and labels.
common: {
// Screenreader titles. Please note that screenreaders are not always capable
// of reading non-English words. So be careful while translating it.
editorHelp: 'Premeu ALT 0 per ajuda',
browseServer: 'Veure servidor',
url: 'URL',
protocol: 'Protocol',
upload: 'Puja',
uploadSubmit: 'Envia-la al servidor',
image: 'Imatge',
flash: 'Flash',
form: 'Formulari',
checkbox: 'Casella de verificació',
radio: 'Botó d\'opció',
textField: 'Camp de text',
textarea: 'Àrea de text',
hiddenField: 'Camp ocult',
button: 'Botó',
select: 'Camp de selecció',
imageButton: 'Botó d\'imatge',
notSet: '<no definit>',
id: 'Id',
name: 'Nom',
langDir: 'Direcció de l\'idioma',
langDirLtr: 'D\'esquerra a dreta (LTR)',
langDirRtl: 'De dreta a esquerra (RTL)',
langCode: 'Codi d\'idioma',
longDescr: 'Descripció llarga de la URL',
cssClass: 'Classes del full d\'estil',
advisoryTitle: 'Títol consultiu',
cssStyle: 'Estil',
ok: 'D\'acord',
cancel: 'Cancel·la',
close: 'Tanca',
preview: 'Previsualitza',
resize: 'Arrossegueu per redimensionar',
generalTab: 'General',
advancedTab: 'Avançat',
validateNumberFailed: 'Aquest valor no és un número.',
confirmNewPage: 'Els canvis en aquest contingut que no es desin es perdran. Esteu segur que voleu carregar una pàgina nova?',
confirmCancel: 'Algunes opcions s\'han canviat. Esteu segur que voleu tancar el quadre de diàleg?',
options: 'Opcions',
target: 'Destí',
targetNew: 'Nova finestra (_blank)',
targetTop: 'Finestra superior (_top)',
targetSelf: 'Mateixa finestra (_self)',
targetParent: 'Finestra pare (_parent)',
langDirLTR: 'D\'esquerra a dreta (LTR)',
langDirRTL: 'De dreta a esquerra (RTL)',
styles: 'Estil',
cssClasses: 'Classes del full d\'estil',
width: 'Amplada',
height: 'Alçada',
align: 'Alineació',
alignLeft: 'Ajusta a l\'esquerra',
alignRight: 'Ajusta a la dreta',
alignCenter: 'Centre',
alignTop: 'Superior',
alignMiddle: 'Centre',
alignBottom: 'Inferior',
invalidValue : 'Valor no vàlid.',
invalidHeight: 'L\'alçada ha de ser un número.',
invalidWidth: 'L\'amplada ha de ser un número.',
invalidCssLength: 'El valor especificat per als "%1" camps ha de ser un número positiu amb o sense unitat de mesura vàlida de CSS (px, %, in, cm, mm, em, ex, pt o pc).',
invalidHtmlLength: 'El valor especificat per als "%1" camps ha de ser un número positiu amb o sense unitat de mesura vàlida d\'HTML (px o %).',
invalidInlineStyle: 'El valor especificat per l\'estil en línia ha de constar d\'una o més tuples amb el format "name: value", separats per punt i coma.',
cssLengthTooltip: 'Introduïu un número per un valor en píxels o un número amb una unitat vàlida de CSS (px, %, in, cm, mm, em, ex, pt o pc).',
// Put the voice-only part of the label in the span.
unavailable: '%1<span class="cke_accessibility">, no disponible</span>'
}
};
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.