code stringlengths 2 1.05M | repo_name stringlengths 5 114 | path stringlengths 4 991 | language stringclasses 1 value | license stringclasses 15 values | size int32 2 1.05M |
|---|---|---|---|---|---|
import DS from 'ember-data';
export default DS.Model.extend({
nodeId: DS.attr(),
profile: DS.belongsTo('user-profile')
});
| SolarNetwork/solarnode-dashboard | app/models/user.js | JavaScript | gpl-2.0 | 128 |
basic.forever(function () {
basic.showNumber(input.temperature())
basic.showString("Celsius")
})
| biblelamp/JavaScriptExercises | microbit.com/temperature.js | JavaScript | gpl-2.0 | 105 |
/**
* Copyright (c) 2008 Kelvin Luck (http://www.kelvinluck.com/)
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
* and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
* .
* $Id: jquery.datePicker.js 103 2010-09-22 08:54:28Z kelvin.luck $
**/
(function($){
$.fn.extend({
/**
* Render a calendar table into any matched elements.
*
* @param Object s (optional) Customize your calendars.
* @option Number month The month to render (NOTE that months are zero based). Default is today's month.
* @option Number year The year to render. Default is today's year.
* @option Function renderCallback A reference to a function that is called as each cell is rendered and which can add classes and event listeners to the created nodes. Default is no callback.
* @option Number showHeader Whether or not to show the header row, possible values are: $.dpConst.SHOW_HEADER_NONE (no header), $.dpConst.SHOW_HEADER_SHORT (first letter of each day) and $.dpConst.SHOW_HEADER_LONG (full name of each day). Default is $.dpConst.SHOW_HEADER_SHORT.
* @option String hoverClass The class to attach to each cell when you hover over it (to allow you to use hover effects in IE6 which doesn't support the :hover pseudo-class on elements other than links). Default is dp-hover. Pass false if you don't want a hover class.
* @type jQuery
* @name renderCalendar
* @cat plugins/datePicker
* @author Kelvin Luck (http://www.kelvinluck.com/)
*
* @example $('#calendar-me').renderCalendar({month:0, year:2007});
* @desc Renders a calendar displaying January 2007 into the element with an id of calendar-me.
*
* @example
* var testCallback = function($td, thisDate, month, year)
* {
* if ($td.is('.current-month') && thisDate.getDay() == 4) {
* var d = thisDate.getDate();
* $td.bind(
* 'click',
* function()
* {
* alert('You clicked on ' + d + '/' + (Number(month)+1) + '/' + year);
* }
* ).addClass('thursday');
* } else if (thisDate.getDay() == 5) {
* $td.html('Friday the ' + $td.html() + 'th');
* }
* }
* $('#calendar-me').renderCalendar({month:0, year:2007, renderCallback:testCallback});
*
* @desc Renders a calendar displaying January 2007 into the element with an id of calendar-me. Every Thursday in the current month has a class of "thursday" applied to it, is clickable and shows an alert when clicked. Every Friday on the calendar has the number inside replaced with text.
**/
renderCalendar : function(s)
{
var dc = function(a)
{
return document.createElement(a);
};
s = $.extend({}, $.fn.datePicker.defaults, s);
if (s.showHeader != $.dpConst.SHOW_HEADER_NONE) {
var headRow = $(dc('tr'));
for (var i=Date.firstDayOfWeek; i<Date.firstDayOfWeek+7; i++) {
var weekday = i%7;
var day = Date.dayNames[weekday];
headRow.append(
jQuery(dc('th')).attr({'scope':'col', 'abbr':day, 'title':day, 'class':(weekday == 0 || weekday == 6 ? 'weekend' : 'weekday')}).html(s.showHeader == $.dpConst.SHOW_HEADER_SHORT ? day.substr(0, 1) : day)
);
}
};
var calendarTable = $(dc('table'))
.attr(
{
'cellspacing':2
}
)
.addClass('jCalendar')
.append(
(s.showHeader != $.dpConst.SHOW_HEADER_NONE ?
$(dc('thead'))
.append(headRow)
:
dc('thead')
)
);
var tbody = $(dc('tbody'));
var today = (new Date()).zeroTime();
today.setHours(12);
var month = s.month == undefined ? today.getMonth() : s.month;
var year = s.year || today.getFullYear();
var currentDate = (new Date(year, month, 1, 12, 0, 0));
var firstDayOffset = Date.firstDayOfWeek - currentDate.getDay() + 1;
if (firstDayOffset > 1) firstDayOffset -= 7;
var weeksToDraw = Math.ceil(( (-1*firstDayOffset+1) + currentDate.getDaysInMonth() ) /7);
currentDate.addDays(firstDayOffset-1);
var doHover = function(firstDayInBounds)
{
return function()
{
if (s.hoverClass) {
var $this = $(this);
if (!s.selectWeek) {
$this.addClass(s.hoverClass);
} else if (firstDayInBounds && !$this.is('.disabled')) {
$this.parent().addClass('activeWeekHover');
}
}
}
};
var unHover = function()
{
if (s.hoverClass) {
var $this = $(this);
$this.removeClass(s.hoverClass);
$this.parent().removeClass('activeWeekHover');
}
};
var w = 0;
while (w++<weeksToDraw) {
var r = jQuery(dc('tr'));
var firstDayInBounds = s.dpController ? currentDate > s.dpController.startDate : false;
for (var i=0; i<7; i++) {
var thisMonth = currentDate.getMonth() == month;
var d = $(dc('td'))
.text(currentDate.getDate() + '')
.addClass((thisMonth ? 'current-month ' : 'other-month ') +
(currentDate.isWeekend() ? 'weekend ' : 'weekday ') +
(thisMonth && currentDate.getTime() == today.getTime() ? 'today ' : '')
)
.data('datePickerDate', currentDate.asString())
.hover(doHover(firstDayInBounds), unHover)
;
r.append(d);
if (s.renderCallback) {
s.renderCallback(d, currentDate, month, year);
}
// addDays(1) fails in some locales due to daylight savings. See issue 39.
//currentDate.addDays(1);
// set the time to midday to avoid any weird timezone issues??
currentDate = new Date(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate()+1, 12, 0, 0);
}
tbody.append(r);
}
calendarTable.append(tbody);
return this.each(
function()
{
$(this).empty().append(calendarTable);
}
);
},
/**
* Create a datePicker associated with each of the matched elements.
*
* The matched element will receive a few custom events with the following signatures:
*
* dateSelected(event, date, $td, status)
* Triggered when a date is selected. event is a reference to the event, date is the Date selected, $td is a jquery object wrapped around the TD that was clicked on and status is whether the date was selected (true) or deselected (false)
*
* dpClosed(event, selected)
* Triggered when the date picker is closed. event is a reference to the event and selected is an Array containing Date objects.
*
* dpMonthChanged(event, displayedMonth, displayedYear)
* Triggered when the month of the popped up calendar is changed. event is a reference to the event, displayedMonth is the number of the month now displayed (zero based) and displayedYear is the year of the month.
*
* dpDisplayed(event, $datePickerDiv)
* Triggered when the date picker is created. $datePickerDiv is the div containing the date picker. Use this event to add custom content/ listeners to the popped up date picker.
*
* @param Object s (optional) Customize your date pickers.
* @option Number month The month to render when the date picker is opened (NOTE that months are zero based). Default is today's month.
* @option Number year The year to render when the date picker is opened. Default is today's year.
* @option String|Date startDate The first date date can be selected.
* @option String|Date endDate The last date that can be selected.
* @option Boolean inline Whether to create the datePicker as inline (e.g. always on the page) or as a model popup. Default is false (== modal popup)
* @option Boolean createButton Whether to create a .dp-choose-date anchor directly after the matched element which when clicked will trigger the showing of the date picker. Default is true.
* @option Boolean showYearNavigation Whether to display buttons which allow the user to navigate through the months a year at a time. Default is true.
* @option Boolean closeOnSelect Whether to close the date picker when a date is selected. Default is true.
* @option Boolean displayClose Whether to create a "Close" button within the date picker popup. Default is false.
* @option Boolean selectMultiple Whether a user should be able to select multiple dates with this date picker. Default is false.
* @option Number numSelectable The maximum number of dates that can be selected where selectMultiple is true. Default is a very high number.
* @option Boolean clickInput If the matched element is an input type="text" and this option is true then clicking on the input will cause the date picker to appear.
* @option Boolean rememberViewedMonth Whether the datePicker should remember the last viewed month and open on it. If false then the date picker will always open with the month for the first selected date visible.
* @option Boolean selectWeek Whether to select a complete week at a time...
* @option Number verticalPosition The vertical alignment of the popped up date picker to the matched element. One of $.dpConst.POS_TOP and $.dpConst.POS_BOTTOM. Default is $.dpConst.POS_TOP.
* @option Number horizontalPosition The horizontal alignment of the popped up date picker to the matched element. One of $.dpConst.POS_LEFT and $.dpConst.POS_RIGHT.
* @option Number verticalOffset The number of pixels offset from the defined verticalPosition of this date picker that it should pop up in. Default in 0.
* @option Number horizontalOffset The number of pixels offset from the defined horizontalPosition of this date picker that it should pop up in. Default in 0.
* @option (Function|Array) renderCallback A reference to a function (or an array of separate functions) that is called as each cell is rendered and which can add classes and event listeners to the created nodes. Each callback function will receive four arguments; a jquery object wrapping the created TD, a Date object containing the date this TD represents, a number giving the currently rendered month and a number giving the currently rendered year. Default is no callback.
* @option String hoverClass The class to attach to each cell when you hover over it (to allow you to use hover effects in IE6 which doesn't support the :hover pseudo-class on elements other than links). Default is dp-hover. Pass false if you don't want a hover class.
* @option String autoFocusNextInput Whether focus should be passed onto the next input in the form (true) or remain on this input (false) when a date is selected and the calendar closes
* @type jQuery
* @name datePicker
* @cat plugins/datePicker
* @author Kelvin Luck (http://www.kelvinluck.com/)
*
* @example $('input.date-picker').datePicker();
* @desc Creates a date picker button next to all matched input elements. When the button is clicked on the value of the selected date will be placed in the corresponding input (formatted according to Date.format).
*
* @example demo/index.html
* @desc See the projects homepage for many more complex examples...
**/
datePicker : function(s)
{
if (!$.event._dpCache) $.event._dpCache = [];
// initialise the date picker controller with the relevant settings...
s = $.extend({}, $.fn.datePicker.defaults, s);
return this.each(
function()
{
var $this = $(this);
var alreadyExists = true;
if (!this._dpId) {
this._dpId = $.event.guid++;
$.event._dpCache[this._dpId] = new DatePicker(this);
alreadyExists = false;
}
if (s.inline) {
s.createButton = false;
s.displayClose = false;
s.closeOnSelect = false;
$this.empty();
}
var controller = $.event._dpCache[this._dpId];
controller.init(s);
if (!alreadyExists && s.createButton) {
// create it!
controller.button = $('<a href="#" class="dp-choose-date" title="' + $.dpText.TEXT_CHOOSE_DATE + '">' + $.dpText.TEXT_CHOOSE_DATE + '</a>')
.bind(
'click',
function()
{
$this.dpDisplay(this);
this.blur();
return false;
}
);
$this.after(controller.button);
}
if (!alreadyExists && $this.is(':text')) {
$this
.bind(
'dateSelected',
function(e, selectedDate, $td)
{
this.value = selectedDate.asString();
}
).bind(
'change',
function()
{
if (this.value == '') {
controller.clearSelected();
} else {
var d = Date.fromString(this.value);
if (d) {
controller.setSelected(d, true, true);
}
}
}
);
if (s.clickInput) {
$this.bind(
'click',
function()
{
// The change event doesn't happen until the input loses focus so we need to manually trigger it...
$this.trigger('change');
$this.dpDisplay();
}
);
}
var d = Date.fromString(this.value);
if (this.value != '' && d) {
controller.setSelected(d, true, true);
}
}
$this.addClass('dp-applied');
}
)
},
/**
* Disables or enables this date picker
*
* @param Boolean s Whether to disable (true) or enable (false) this datePicker
* @type jQuery
* @name dpSetDisabled
* @cat plugins/datePicker
* @author Kelvin Luck (http://www.kelvinluck.com/)
*
* @example $('.date-picker').datePicker();
* $('.date-picker').dpSetDisabled(true);
* @desc Prevents this date picker from displaying and adds a class of dp-disabled to it (and it's associated button if it has one) for styling purposes. If the matched element is an input field then it will also set the disabled attribute to stop people directly editing the field.
**/
dpSetDisabled : function(s)
{
return _w.call(this, 'setDisabled', s);
},
/**
* Updates the first selectable date for any date pickers on any matched elements.
*
* @param String|Date d A Date object or string representing the first selectable date (formatted according to Date.format).
* @type jQuery
* @name dpSetStartDate
* @cat plugins/datePicker
* @author Kelvin Luck (http://www.kelvinluck.com/)
*
* @example $('.date-picker').datePicker();
* $('.date-picker').dpSetStartDate('01/01/2000');
* @desc Creates a date picker associated with all elements with a class of "date-picker" then sets the first selectable date for each of these to the first day of the millenium.
**/
dpSetStartDate : function(d)
{
return _w.call(this, 'setStartDate', d);
},
/**
* Updates the last selectable date for any date pickers on any matched elements.
*
* @param String|Date d A Date object or string representing the last selectable date (formatted according to Date.format).
* @type jQuery
* @name dpSetEndDate
* @cat plugins/datePicker
* @author Kelvin Luck (http://www.kelvinluck.com/)
*
* @example $('.date-picker').datePicker();
* $('.date-picker').dpSetEndDate('01/01/2010');
* @desc Creates a date picker associated with all elements with a class of "date-picker" then sets the last selectable date for each of these to the first Janurary 2010.
**/
dpSetEndDate : function(d)
{
return _w.call(this, 'setEndDate', d);
},
/**
* Gets a list of Dates currently selected by this datePicker. This will be an empty array if no dates are currently selected or NULL if there is no datePicker associated with the matched element.
*
* @type Array
* @name dpGetSelected
* @cat plugins/datePicker
* @author Kelvin Luck (http://www.kelvinluck.com/)
*
* @example $('.date-picker').datePicker();
* alert($('.date-picker').dpGetSelected());
* @desc Will alert an empty array (as nothing is selected yet)
**/
dpGetSelected : function()
{
var c = _getController(this[0]);
if (c) {
return c.getSelected();
}
return null;
},
/**
* Selects or deselects a date on any matched element's date pickers. Deselcting is only useful on date pickers where selectMultiple==true. Selecting will only work if the passed date is within the startDate and endDate boundries for a given date picker.
*
* @param String|Date d A Date object or string representing the date you want to select (formatted according to Date.format).
* @param Boolean v Whether you want to select (true) or deselect (false) this date. Optional - default = true.
* @param Boolean m Whether you want the date picker to open up on the month of this date when it is next opened. Optional - default = true.
* @param Boolean e Whether you want the date picker to dispatch events related to this change of selection. Optional - default = true.
* @type jQuery
* @name dpSetSelected
* @cat plugins/datePicker
* @author Kelvin Luck (http://www.kelvinluck.com/)
*
* @example $('.date-picker').datePicker();
* $('.date-picker').dpSetSelected('01/01/2010');
* @desc Creates a date picker associated with all elements with a class of "date-picker" then sets the selected date on these date pickers to the first Janurary 2010. When the date picker is next opened it will display Janurary 2010.
**/
dpSetSelected : function(d, v, m, e)
{
if (v == undefined) v=true;
if (m == undefined) m=true;
if (e == undefined) e=true;
return _w.call(this, 'setSelected', Date.fromString(d), v, m, e);
},
/**
* Sets the month that will be displayed when the date picker is next opened. If the passed month is before startDate then the month containing startDate will be displayed instead. If the passed month is after endDate then the month containing the endDate will be displayed instead.
*
* @param Number m The month you want the date picker to display. Optional - defaults to the currently displayed month.
* @param Number y The year you want the date picker to display. Optional - defaults to the currently displayed year.
* @type jQuery
* @name dpSetDisplayedMonth
* @cat plugins/datePicker
* @author Kelvin Luck (http://www.kelvinluck.com/)
*
* @example $('.date-picker').datePicker();
* $('.date-picker').dpSetDisplayedMonth(10, 2008);
* @desc Creates a date picker associated with all elements with a class of "date-picker" then sets the selected date on these date pickers to the first Janurary 2010. When the date picker is next opened it will display Janurary 2010.
**/
dpSetDisplayedMonth : function(m, y)
{
return _w.call(this, 'setDisplayedMonth', Number(m), Number(y), true);
},
/**
* Displays the date picker associated with the matched elements. Since only one date picker can be displayed at once then the date picker associated with the last matched element will be the one that is displayed.
*
* @param HTMLElement e An element that you want the date picker to pop up relative in position to. Optional - default behaviour is to pop up next to the element associated with this date picker.
* @type jQuery
* @name dpDisplay
* @cat plugins/datePicker
* @author Kelvin Luck (http://www.kelvinluck.com/)
*
* @example $('#date-picker').datePicker();
* $('#date-picker').dpDisplay();
* @desc Creates a date picker associated with the element with an id of date-picker and then causes it to pop up.
**/
dpDisplay : function(e)
{
return _w.call(this, 'display', e);
},
/**
* Sets a function or array of functions that is called when each TD of the date picker popup is rendered to the page
*
* @param (Function|Array) a A function or an array of functions that are called when each td is rendered. Each function will receive four arguments; a jquery object wrapping the created TD, a Date object containing the date this TD represents, a number giving the currently rendered month and a number giving the currently rendered year.
* @type jQuery
* @name dpSetRenderCallback
* @cat plugins/datePicker
* @author Kelvin Luck (http://www.kelvinluck.com/)
*
* @example $('#date-picker').datePicker();
* $('#date-picker').dpSetRenderCallback(function($td, thisDate, month, year)
* {
* // do stuff as each td is rendered dependant on the date in the td and the displayed month and year
* });
* @desc Creates a date picker associated with the element with an id of date-picker and then creates a function which is called as each td is rendered when this date picker is displayed.
**/
dpSetRenderCallback : function(a)
{
return _w.call(this, 'setRenderCallback', a);
},
/**
* Sets the position that the datePicker will pop up (relative to it's associated element)
*
* @param Number v The vertical alignment of the created date picker to it's associated element. Possible values are $.dpConst.POS_TOP and $.dpConst.POS_BOTTOM
* @param Number h The horizontal alignment of the created date picker to it's associated element. Possible values are $.dpConst.POS_LEFT and $.dpConst.POS_RIGHT
* @type jQuery
* @name dpSetPosition
* @cat plugins/datePicker
* @author Kelvin Luck (http://www.kelvinluck.com/)
*
* @example $('#date-picker').datePicker();
* $('#date-picker').dpSetPosition($.dpConst.POS_BOTTOM, $.dpConst.POS_RIGHT);
* @desc Creates a date picker associated with the element with an id of date-picker and makes it so that when this date picker pops up it will be bottom and right aligned to the #date-picker element.
**/
dpSetPosition : function(v, h)
{
return _w.call(this, 'setPosition', v, h);
},
/**
* Sets the offset that the popped up date picker will have from it's default position relative to it's associated element (as set by dpSetPosition)
*
* @param Number v The vertical offset of the created date picker.
* @param Number h The horizontal offset of the created date picker.
* @type jQuery
* @name dpSetOffset
* @cat plugins/datePicker
* @author Kelvin Luck (http://www.kelvinluck.com/)
*
* @example $('#date-picker').datePicker();
* $('#date-picker').dpSetOffset(-20, 200);
* @desc Creates a date picker associated with the element with an id of date-picker and makes it so that when this date picker pops up it will be 20 pixels above and 200 pixels to the right of it's default position.
**/
dpSetOffset : function(v, h)
{
return _w.call(this, 'setOffset', v, h);
},
/**
* Closes the open date picker associated with this element.
*
* @type jQuery
* @name dpClose
* @cat plugins/datePicker
* @author Kelvin Luck (http://www.kelvinluck.com/)
*
* @example $('.date-pick')
* .datePicker()
* .bind(
* 'focus',
* function()
* {
* $(this).dpDisplay();
* }
* ).bind(
* 'blur',
* function()
* {
* $(this).dpClose();
* }
* );
**/
dpClose : function()
{
return _w.call(this, '_closeCalendar', false, this[0]);
},
/**
* Rerenders the date picker's current month (for use with inline calendars and renderCallbacks).
*
* @type jQuery
* @name dpRerenderCalendar
* @cat plugins/datePicker
* @author Kelvin Luck (http://www.kelvinluck.com/)
*
**/
dpRerenderCalendar : function()
{
return _w.call(this, '_rerenderCalendar');
},
// private function called on unload to clean up any expandos etc and prevent memory links...
_dpDestroy : function()
{
// TODO - implement this?
}
});
// private internal function to cut down on the amount of code needed where we forward
// dp* methods on the jQuery object on to the relevant DatePicker controllers...
var _w = function(f, a1, a2, a3, a4)
{
return this.each(
function()
{
var c = _getController(this);
if (c) {
c[f](a1, a2, a3, a4);
}
}
);
};
function DatePicker(ele)
{
this.ele = ele;
// initial values...
this.displayedMonth = null;
this.displayedYear = null;
this.startDate = null;
this.endDate = null;
this.showYearNavigation = null;
this.closeOnSelect = null;
this.displayClose = null;
this.rememberViewedMonth= null;
this.selectMultiple = null;
this.numSelectable = null;
this.numSelected = null;
this.verticalPosition = null;
this.horizontalPosition = null;
this.verticalOffset = null;
this.horizontalOffset = null;
this.button = null;
this.renderCallback = [];
this.selectedDates = {};
this.inline = null;
this.context = '#dp-popup';
this.settings = {};
};
$.extend(
DatePicker.prototype,
{
init : function(s)
{
this.setStartDate(s.startDate);
this.setEndDate(s.endDate);
this.setDisplayedMonth(Number(s.month), Number(s.year));
this.setRenderCallback(s.renderCallback);
this.showYearNavigation = s.showYearNavigation;
this.closeOnSelect = s.closeOnSelect;
this.displayClose = s.displayClose;
this.rememberViewedMonth = s.rememberViewedMonth;
this.selectMultiple = s.selectMultiple;
this.numSelectable = s.selectMultiple ? s.numSelectable : 1;
this.numSelected = 0;
this.verticalPosition = s.verticalPosition;
this.horizontalPosition = s.horizontalPosition;
this.hoverClass = s.hoverClass;
this.setOffset(s.verticalOffset, s.horizontalOffset);
this.inline = s.inline;
this.settings = s;
if (this.inline) {
this.context = this.ele;
this.display();
}
},
setStartDate : function(d)
{
if (d) {
if (d instanceof Date) {
this.startDate = d;
} else {
this.startDate = Date.fromString(d);
}
}
if (!this.startDate) {
this.startDate = (new Date()).zeroTime();
}
this.setDisplayedMonth(this.displayedMonth, this.displayedYear);
},
setEndDate : function(d)
{
if (d) {
if (d instanceof Date) {
this.endDate = d;
} else {
this.endDate = Date.fromString(d);
}
}
if (!this.endDate) {
this.endDate = (new Date('12/31/2999')); // using the JS Date.parse function which expects mm/dd/yyyy
}
if (this.endDate.getTime() < this.startDate.getTime()) {
this.endDate = this.startDate;
}
this.setDisplayedMonth(this.displayedMonth, this.displayedYear);
},
setPosition : function(v, h)
{
this.verticalPosition = v;
this.horizontalPosition = h;
},
setOffset : function(v, h)
{
this.verticalOffset = parseInt(v) || 0;
this.horizontalOffset = parseInt(h) || 0;
},
setDisabled : function(s)
{
$e = $(this.ele);
$e[s ? 'addClass' : 'removeClass']('dp-disabled');
if (this.button) {
$but = $(this.button);
$but[s ? 'addClass' : 'removeClass']('dp-disabled');
$but.attr('title', s ? '' : $.dpText.TEXT_CHOOSE_DATE);
}
if ($e.is(':text')) {
$e.attr('disabled', s ? 'disabled' : '');
}
},
setDisplayedMonth : function(m, y, rerender)
{
if (this.startDate == undefined || this.endDate == undefined) {
return;
}
var s = new Date(this.startDate.getTime());
s.setDate(1);
var e = new Date(this.endDate.getTime());
e.setDate(1);
var t;
if ((!m && !y) || (isNaN(m) && isNaN(y))) {
// no month or year passed - default to current month
t = new Date().zeroTime();
t.setDate(1);
} else if (isNaN(m)) {
// just year passed in - presume we want the displayedMonth
t = new Date(y, this.displayedMonth, 1);
} else if (isNaN(y)) {
// just month passed in - presume we want the displayedYear
t = new Date(this.displayedYear, m, 1);
} else {
// year and month passed in - that's the date we want!
t = new Date(y, m, 1)
}
// check if the desired date is within the range of our defined startDate and endDate
if (t.getTime() < s.getTime()) {
t = s;
} else if (t.getTime() > e.getTime()) {
t = e;
}
var oldMonth = this.displayedMonth;
var oldYear = this.displayedYear;
this.displayedMonth = t.getMonth();
this.displayedYear = t.getFullYear();
if (rerender && (this.displayedMonth != oldMonth || this.displayedYear != oldYear))
{
this._rerenderCalendar();
$(this.ele).trigger('dpMonthChanged', [this.displayedMonth, this.displayedYear]);
}
},
setSelected : function(d, v, moveToMonth, dispatchEvents)
{
if (d < this.startDate || d.zeroTime() > this.endDate.zeroTime()) {
// Don't allow people to select dates outside range...
return;
}
var s = this.settings;
if (s.selectWeek)
{
d = d.addDays(- (d.getDay() - Date.firstDayOfWeek + 7) % 7);
if (d < this.startDate) // The first day of this week is before the start date so is unselectable...
{
return;
}
}
if (v == this.isSelected(d)) // this date is already un/selected
{
return;
}
if (this.selectMultiple == false) {
this.clearSelected();
} else if (v && this.numSelected == this.numSelectable) {
// can't select any more dates...
return;
}
if (moveToMonth && (this.displayedMonth != d.getMonth() || this.displayedYear != d.getFullYear())) {
this.setDisplayedMonth(d.getMonth(), d.getFullYear(), true);
}
this.selectedDates[d.asString()] = v;
this.numSelected += v ? 1 : -1;
var selectorString = 'td.' + (d.getMonth() == this.displayedMonth ? 'current-month' : 'other-month');
var $td;
$(selectorString, this.context).each(
function()
{
if ($(this).data('datePickerDate') == d.asString()) {
$td = $(this);
if (s.selectWeek)
{
$td.parent()[v ? 'addClass' : 'removeClass']('selectedWeek');
}
$td[v ? 'addClass' : 'removeClass']('selected');
}
}
);
$('td', this.context).not('.selected')[this.selectMultiple && this.numSelected == this.numSelectable ? 'addClass' : 'removeClass']('unselectable');
if (dispatchEvents)
{
var s = this.isSelected(d);
$e = $(this.ele);
var dClone = Date.fromString(d.asString());
$e.trigger('dateSelected', [dClone, $td, s]);
$e.trigger('change');
}
},
isSelected : function(d)
{
return this.selectedDates[d.asString()];
},
getSelected : function()
{
var r = [];
for(var s in this.selectedDates) {
if (this.selectedDates[s] == true) {
r.push(Date.fromString(s));
}
}
return r;
},
clearSelected : function()
{
this.selectedDates = {};
this.numSelected = 0;
$('td.selected', this.context).removeClass('selected').parent().removeClass('selectedWeek');
},
display : function(eleAlignTo)
{
if ($(this.ele).is('.dp-disabled')) return;
eleAlignTo = eleAlignTo || this.ele;
var c = this;
var $ele = $(eleAlignTo);
var eleOffset = $ele.offset();
var $createIn;
var attrs;
var attrsCalendarHolder;
var cssRules;
if (c.inline) {
$createIn = $(this.ele);
attrs = {
'id' : 'calendar-' + this.ele._dpId,
'class' : 'dp-popup dp-popup-inline'
};
$('.dp-popup', $createIn).remove();
cssRules = {
};
} else {
$createIn = $('body');
attrs = {
'id' : 'dp-popup',
'class' : 'dp-popup'
};
cssRules = {
'top' : eleOffset.top + c.verticalOffset,
'left' : eleOffset.left + c.horizontalOffset
};
var _checkMouse = function(e)
{
var el = e.target;
var cal = $('#dp-popup')[0];
while (true){
if (el == cal) {
return true;
} else if (el == document) {
c._closeCalendar();
return false;
} else {
el = $(el).parent()[0];
}
}
};
this._checkMouse = _checkMouse;
c._closeCalendar(true);
$(document).bind(
'keydown.datepicker',
function(event)
{
if (event.keyCode == 27) {
c._closeCalendar();
}
}
);
}
if (!c.rememberViewedMonth)
{
var selectedDate = this.getSelected()[0];
if (selectedDate) {
selectedDate = new Date(selectedDate);
this.setDisplayedMonth(selectedDate.getMonth(), selectedDate.getFullYear(), false);
}
}
$createIn
.append(
$('<div></div>')
.attr(attrs)
.css(cssRules)
.append(
// $('<a href="#" class="selecteee">aaa</a>'),
$('<h2></h2>'),
$('<div class="dp-nav-prev"></div>')
.append(
$('<a class="dp-nav-prev-year" href="#" title="' + $.dpText.TEXT_PREV_YEAR + '"><<</a>')
.bind(
'click',
function()
{
return c._displayNewMonth.call(c, this, 0, -1);
}
),
$('<a class="dp-nav-prev-month" href="#" title="' + $.dpText.TEXT_PREV_MONTH + '"><</a>')
.bind(
'click',
function()
{
return c._displayNewMonth.call(c, this, -1, 0);
}
)
),
$('<div class="dp-nav-next"></div>')
.append(
$('<a class="dp-nav-next-year" href="#" title="' + $.dpText.TEXT_NEXT_YEAR + '">>></a>')
.bind(
'click',
function()
{
return c._displayNewMonth.call(c, this, 0, 1);
}
),
$('<a class="dp-nav-next-month" href="#" title="' + $.dpText.TEXT_NEXT_MONTH + '">></a>')
.bind(
'click',
function()
{
return c._displayNewMonth.call(c, this, 1, 0);
}
)
),
$('<div class="dp-calendar"></div>')
)
.bgIframe()
);
var $pop = this.inline ? $('.dp-popup', this.context) : $('#dp-popup');
if (this.showYearNavigation == false) {
$('.dp-nav-prev-year, .dp-nav-next-year', c.context).css('display', 'none');
}
if (this.displayClose) {
$pop.append(
$('<a href="#" id="dp-close">' + $.dpText.TEXT_CLOSE + '</a>')
.bind(
'click',
function()
{
c._closeCalendar();
return false;
}
)
);
}
c._renderCalendar();
$(this.ele).trigger('dpDisplayed', $pop);
if (!c.inline) {
if (this.verticalPosition == $.dpConst.POS_BOTTOM) {
$pop.css('top', eleOffset.top + $ele.height() - $pop.height() + c.verticalOffset);
}
if (this.horizontalPosition == $.dpConst.POS_RIGHT) {
$pop.css('left', eleOffset.left + $ele.width() - $pop.width() + c.horizontalOffset);
}
// $('.selectee', this.context).focus();
$(document).bind('mousedown.datepicker', this._checkMouse);
}
},
setRenderCallback : function(a)
{
if (a == null) return;
if (a && typeof(a) == 'function') {
a = [a];
}
this.renderCallback = this.renderCallback.concat(a);
},
cellRender : function ($td, thisDate, month, year) {
var c = this.dpController;
var d = new Date(thisDate.getTime());
// add our click handlers to deal with it when the days are clicked...
$td.bind(
'click',
function()
{
var $this = $(this);
if (!$this.is('.disabled')) {
c.setSelected(d, !$this.is('.selected') || !c.selectMultiple, false, true);
if (c.closeOnSelect) {
// Focus the next input in the form
if (c.settings.autoFocusNextInput) {
var ele = c.ele;
var found = false;
$(':input', ele.form).each(
function()
{
if (found) {
$(this).focus();
return false;
}
if (this == ele) {
found = true;
}
}
);
} else {
c.ele.focus();
}
c._closeCalendar();
}
}
}
);
if (c.isSelected(d)) {
$td.addClass('selected');
if (c.settings.selectWeek)
{
$td.parent().addClass('selectedWeek');
}
} else if (c.selectMultiple && c.numSelected == c.numSelectable) {
$td.addClass('unselectable');
}
},
_applyRenderCallbacks : function()
{
var c = this;
$('td', this.context).each(
function()
{
for (var i=0; i<c.renderCallback.length; i++) {
$td = $(this);
c.renderCallback[i].apply(this, [$td, Date.fromString($td.data('datePickerDate')), c.displayedMonth, c.displayedYear]);
}
}
);
return;
},
// ele is the clicked button - only proceed if it doesn't have the class disabled...
// m and y are -1, 0 or 1 depending which direction we want to go in...
_displayNewMonth : function(ele, m, y)
{
if (!$(ele).is('.disabled')) {
this.setDisplayedMonth(this.displayedMonth + m, this.displayedYear + y, true);
}
ele.blur();
return false;
},
_rerenderCalendar : function()
{
this._clearCalendar();
this._renderCalendar();
},
_renderCalendar : function()
{
// set the title...
$('h2', this.context).html((new Date(this.displayedYear, this.displayedMonth, 1)).asString($.dpText.HEADER_FORMAT));
// render the calendar...
$('.dp-calendar', this.context).renderCalendar(
$.extend(
{},
this.settings,
{
month : this.displayedMonth,
year : this.displayedYear,
renderCallback : this.cellRender,
dpController : this,
hoverClass : this.hoverClass
})
);
// update the status of the control buttons and disable dates before startDate or after endDate...
// TODO: When should the year buttons be disabled? When you can't go forward a whole year from where you are or is that annoying?
if (this.displayedYear == this.startDate.getFullYear() && this.displayedMonth == this.startDate.getMonth()) {
$('.dp-nav-prev-year', this.context).addClass('disabled');
$('.dp-nav-prev-month', this.context).addClass('disabled');
$('.dp-calendar td.other-month', this.context).each(
function()
{
var $this = $(this);
if (Number($this.text()) > 20) {
$this.addClass('disabled');
}
}
);
var d = this.startDate.getDate();
$('.dp-calendar td.current-month', this.context).each(
function()
{
var $this = $(this);
if (Number($this.text()) < d) {
$this.addClass('disabled');
}
}
);
} else {
$('.dp-nav-prev-year', this.context).removeClass('disabled');
$('.dp-nav-prev-month', this.context).removeClass('disabled');
var d = this.startDate.getDate();
if (d > 20) {
// check if the startDate is last month as we might need to add some disabled classes...
var st = this.startDate.getTime();
var sd = new Date(st);
sd.addMonths(1);
if (this.displayedYear == sd.getFullYear() && this.displayedMonth == sd.getMonth()) {
$('.dp-calendar td.other-month', this.context).each(
function()
{
var $this = $(this);
if (Date.fromString($this.data('datePickerDate')).getTime() < st) {
$this.addClass('disabled');
}
}
);
}
}
}
if (this.displayedYear == this.endDate.getFullYear() && this.displayedMonth == this.endDate.getMonth()) {
$('.dp-nav-next-year', this.context).addClass('disabled');
$('.dp-nav-next-month', this.context).addClass('disabled');
$('.dp-calendar td.other-month', this.context).each(
function()
{
var $this = $(this);
if (Number($this.text()) < 14) {
$this.addClass('disabled');
}
}
);
var d = this.endDate.getDate();
$('.dp-calendar td.current-month', this.context).each(
function()
{
var $this = $(this);
if (Number($this.text()) > d) {
$this.addClass('disabled');
}
}
);
} else {
$('.dp-nav-next-year', this.context).removeClass('disabled');
$('.dp-nav-next-month', this.context).removeClass('disabled');
var d = this.endDate.getDate();
if (d < 13) {
// check if the endDate is next month as we might need to add some disabled classes...
var ed = new Date(this.endDate.getTime());
ed.addMonths(-1);
if (this.displayedYear == ed.getFullYear() && this.displayedMonth == ed.getMonth()) {
$('.dp-calendar td.other-month', this.context).each(
function()
{
var $this = $(this);
var cellDay = Number($this.text());
if (cellDay < 13 && cellDay > d) {
$this.addClass('disabled');
}
}
);
}
}
}
this._applyRenderCallbacks();
},
_closeCalendar : function(programatic, ele)
{
if (!ele || ele == this.ele)
{
$(document).unbind('mousedown.datepicker');
$(document).unbind('keydown.datepicker');
this._clearCalendar();
$('#dp-popup a').unbind();
$('#dp-popup').empty().remove();
if (!programatic) {
$(this.ele).trigger('dpClosed', [this.getSelected()]);
}
}
},
// empties the current dp-calendar div and makes sure that all events are unbound
// and expandos removed to avoid memory leaks...
_clearCalendar : function()
{
// TODO.
$('.dp-calendar td', this.context).unbind();
$('.dp-calendar', this.context).empty();
}
}
);
// static constants
$.dpConst = {
SHOW_HEADER_NONE : 0,
SHOW_HEADER_SHORT : 1,
SHOW_HEADER_LONG : 2,
POS_TOP : 0,
POS_BOTTOM : 1,
POS_LEFT : 0,
POS_RIGHT : 1,
DP_INTERNAL_FOCUS : 'dpInternalFocusTrigger'
};
// localisable text
$.dpText = {
TEXT_PREV_YEAR : 'Previous year',
TEXT_PREV_MONTH : 'Previous month',
TEXT_NEXT_YEAR : 'Next year',
TEXT_NEXT_MONTH : 'Next month',
TEXT_CLOSE : 'Close',
TEXT_CHOOSE_DATE : 'Choose date',
HEADER_FORMAT : 'mmmm yyyy'
};
// version
$.dpVersion = '$Id: jquery.datePicker.js 103 2010-09-22 08:54:28Z kelvin.luck $';
$.fn.datePicker.defaults = {
month : undefined,
year : undefined,
showHeader : $.dpConst.SHOW_HEADER_SHORT,
startDate : undefined,
endDate : undefined,
inline : false,
renderCallback : null,
createButton : true,
showYearNavigation : true,
closeOnSelect : true,
displayClose : false,
selectMultiple : false,
numSelectable : Number.MAX_VALUE,
clickInput : false,
rememberViewedMonth : true,
selectWeek : false,
verticalPosition : $.dpConst.POS_TOP,
horizontalPosition : $.dpConst.POS_LEFT,
verticalOffset : 0,
horizontalOffset : 0,
hoverClass : 'dp-hover',
autoFocusNextInput : false
};
function _getController(ele)
{
if (ele._dpId) return $.event._dpCache[ele._dpId];
return false;
};
// make it so that no error is thrown if bgIframe plugin isn't included (allows you to use conditional
// comments to only include bgIframe where it is needed in IE without breaking this plugin).
if ($.fn.bgIframe == undefined) {
$.fn.bgIframe = function() {return this; };
};
// clean-up
$(window)
.bind('unload', function() {
var els = $.event._dpCache || [];
for (var i in els) {
$(els[i].ele)._dpDestroy();
}
});
})(jQuery);
| ashray-velapanur/grind-members | wp-content/themes/grind/js/libs/jquery.datePicker.js | JavaScript | gpl-2.0 | 43,881 |
define({
root : {
years: 'Years',
months: 'Months',
days: 'Days',
please_select: 'Please select...'
},
fr : true,
es : true
});
| geobricks/geobricks_ui_download_trmm | nls/translate.js | JavaScript | gpl-2.0 | 176 |
showWord(["n. ","1. Fòs fizik, kran. Jan pa gen kouray ankò, li bouke. Moun sa yo gen kouraj, yo leve granmaten bonè epi li leswa byen ta yo poko al dòmi. 2. fòs moral, konsyans. Ou gen kouray ou trayi zanmi ou? 3. Kran. Leyon se yon nonm ki te gen kouray, li pat pè lagè. Pitit la pran doulè a ak kouray, li pa menm plenn. 4. Odas. Ou gen kouray ou ap vin bay manti la a. "
]) | georgejhunt/HaitiDictionary.activity | data/words/kouraj_kouray_.js | JavaScript | gpl-2.0 | 386 |
'use strict';
angular.module('noadmin.stplugins', [])
.directive('stPaginationScroll', ['$timeout', function (timeout) {
return{
require: 'stTable',
link: function (scope, element, attr, ctrl) {
var itemByPage = 20;
var pagination = ctrl.tableState().pagination;
var lengthThreshold = 50;
var timeThreshold = 400;
var handler = function () {
//call next page
ctrl.slice(pagination.start + itemByPage, itemByPage);
};
var promise = null;
var lastRemaining = 9999;
var container = angular.element(element.parent());
container.bind('scroll', function () {
var remaining = container[0].scrollHeight - (container[0].clientHeight + container[0].scrollTop);
//if we have reached the threshold and we scroll down
if (remaining < lengthThreshold && (remaining - lastRemaining) < 0) {
//if there is already a timer running which has no expired yet we have to cancel it and restart the timer
if (promise !== null) {
timeout.cancel(promise);
}
promise = timeout(function () {
handler();
//scroll a bit up
container[0].scrollTop -= 500;
promise = null;
}, timeThreshold);
}
lastRemaining = remaining;
});
}
};
}])
.directive('stSelectAll', function () {
return {
restrict: 'E',
template: '<input type="checkbox" ng-model="isAllSelected" />',
scope: {
all: '='
},
link: function (scope, element, attr) {
scope.$watch('isAllSelected', function () {
try {
scope.all.forEach(function (val) {
val.isSelected = scope.isAllSelected;
});
} catch(err) { }
});
scope.$watch('all', function (newVal, oldVal) {
if (oldVal) {
oldVal.forEach(function (val) {
val.isSelected = false;
});
}
scope.isAllSelected = false;
});
}
}
});
| ResearchComputing/noadmin-ui | app/components/stplugins/stplugins.js | JavaScript | gpl-2.0 | 2,022 |
/*
* Title : Pinpoint Booking System WordPress Plugin (PRO)
* Version : 2.1.1
* File : assets/js/extras/backend-extra-group-item.js
* File Version : 1.0.4
* Created / Last Modified : 25 August 2015
* Author : Dot on Paper
* Copyright : © 2012 Dot on Paper
* Website : http://www.dotonpaper.net
* Description : Back end extra group item JavaScript class.
*/
var DOPBSPExtraGroupItem = new function(){
'use strict';
/*
* Private variables.
*/
var $ = jQuery.noConflict();
/*
* Public variables
*/
this.ajaxRequestInProgress;
this.ajaxRequestTimeout;
/*
* Constructor
*/
this.__construct = function(){
};
/*
* Initialize validations.
*/
this.init = function(){
/*
* Price validation.
*/
$('.DOPBSP-input-extra-group-item-price').unbind('input propertychange');
$('.DOPBSP-input-extra-group-item-price').bind('input propertychange', function(){
DOPPrototypes.cleanInput($(this), '0123456789.', '', '0');
});
};
/*
* Add extra group item.
*
* @param groupId (Number): group ID
* @param language (String): extra current selected language
*/
this.add = function(groupId,
language){
DOPBSP.toggleMessages('active', DOPBSP.text('EXTRAS_EXTRA_GROUP_ADD_ITEM_ADDING'));
$.post(ajaxurl, {action:'dopbsp_extra_group_item_add',
group_id: groupId,
position: $('#DOPBSP-extra-group-id-'+groupId+' li.dopbsp-group-item-wrapper').size()+1,
language: language}, function(data){
$('#DOPBSP-extra-group-items-'+groupId).append(data);
DOPBSP.toggleMessages('success', DOPBSP.text('EXTRAS_EXTRA_GROUP_ADD_ITEM_SUCCESS'));
}).fail(function(data){
DOPBSP.toggleMessages('error', data.status+': '+data.statusText);
});
};
/*
* Edit extra group item.
*
* @param id (Number): group item ID
* @param type (String): field type
* @param field (String): group item field
* @param value (String): group item value
* @param onBlur (Boolean): true if function has been called on blur event
*/
this.edit = function(id,
type,
field,
value,
onBlur){
onBlur = onBlur === undefined ? false:true;
this.ajaxRequestInProgress !== undefined && !onBlur ? this.ajaxRequestInProgress.abort():'';
this.ajaxRequestTimeout !== undefined ? clearTimeout(this.ajaxRequestTimeout):'';
if (onBlur
|| type === 'select'
|| type === 'switch'){
if (!onBlur){
DOPBSP.toggleMessages('active-info', DOPBSP.text('MESSAGES_SAVING'));
}
$.post(ajaxurl, {action: 'dopbsp_extra_group_item_edit',
id: id,
field: field,
value: value,
language: $('#DOPBSP-extra-language').val()}, function(data){
if (!onBlur){
DOPBSP.toggleMessages('success', DOPBSP.text('MESSAGES_SAVING_SUCCESS'));
}
}).fail(function(data){
DOPBSP.toggleMessages('error', data.status+': '+data.statusText);
});
}
else{
DOPBSP.toggleMessages('active-info', DOPBSP.text('MESSAGES_SAVING'));
this.ajaxRequestTimeout = setTimeout(function(){
clearTimeout(this.ajaxRequestTimeout);
this.ajaxRequestInProgress = $.post(ajaxurl, {action: 'dopbsp_extra_group_item_edit',
id: id,
field: field,
value: value,
language: $('#DOPBSP-extra-language').val()}, function(data){
DOPBSP.toggleMessages('success', DOPBSP.text('MESSAGES_SAVING_SUCCESS'));
}).fail(function(data){
DOPBSP.toggleMessages('error', data.status+': '+data.statusText);
});
}, 600);
}
};
/*
* Delete extra group item.
*
* @param id (Number): group item ID
*/
this.delete = function(id){
DOPBSP.toggleMessages('active', DOPBSP.text('EXTRAS_EXTRA_GROUP_DELETE_ITEM_DELETING'));
$.post(ajaxurl, {action:'dopbsp_extra_group_item_delete',
id: id}, function(data){
$('#DOPBSP-extra-group-item-'+id).stop(true, true)
.animate({'opacity':0},
600, function(){
$(this).remove();
});
DOPBSP.toggleMessages('success', DOPBSP.text('EXTRAS_EXTRA_GROUP_DELETE_ITEM_SUCCESS'));
}).fail(function(data){
DOPBSP.toggleMessages('error', data.status+': '+data.statusText);
});
};
return this.__construct();
}; | Ishtiaque-Shaad/xyz | wp-content/plugins/dopbsp/assets/js/extras/backend-extra-group-item.js | JavaScript | gpl-2.0 | 5,455 |
// -*- Mode: js; indent-tabs-mode: nil; c-basic-offset: 4; tab-width: 4 -*-
//
// Copyright (c) 2012 Giovanni Campagna <scampa.giovanni@gmail.com>
//
// Gnome Weather is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2 of the License, or (at your
// option) any later version.
//
// Gnome Weather 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 Gnome Weather; if not, write to the Free Software Foundation,
// Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
const Gtk = imports.gi.Gtk;
const GWeather = imports.gi.GWeather;
const Lang = imports.lang;
const City = imports.app.city;
const Params = imports.misc.params;
const World = imports.shared.world;
const WorldView = imports.app.world;
const Util = imports.misc.util;
const Page = {
SEARCH: 0,
CITY: 1
};
const MainWindow = new Lang.Class({
Name: 'MainWindow',
Extends: Gtk.ApplicationWindow,
_init: function(params) {
params = Params.fill(params, { width_request: 700,
height_request: 520 });
this.parent(params);
this._world = this.application.world;
this._currentInfo = null;
this._currentPage = Page.SEARCH;
this._pageWidgets = [[],[]];
Util.initActions(this,
[{ name: 'about',
activate: this._showAbout },
{ name: 'close',
activate: this._close },
{ name: 'refresh',
activate: this.update }]);
let builder = new Gtk.Builder();
builder.add_from_resource('/org/gnome/Weather/Application/window.ui');
let grid = builder.get_object('main-panel');
this._header = builder.get_object('header-bar');
this.set_titlebar(this._header);
let [title, subtitle] = this._getTitle();
this._header.title = title;
this._header.subtitle = subtitle;
this._worldView = new WorldView.WorldContentView(this.application, { visible: true });
this._worldView.hide();
this._model = this._worldView.model;
this._model.connect('show-info', Lang.bind(this, function(model, info) {
if (info)
this.showInfo(info);
else
this.showSearch(info);
}));
let initialGrid = builder.get_object('initial-grid');
let initialGridLocEntry = builder.get_object('initial-grid-location-entry');
initialGridLocEntry.connect('notify::location', Lang.bind(this, this._initialLocationChanged));
let placesButton = builder.get_object('places-button');
this._pageWidgets[Page.CITY].push(placesButton);
placesButton.set_popover(this._worldView);
let refresh = builder.get_object('refresh-button');
this._pageWidgets[Page.CITY].push(refresh);
this._stack = builder.get_object('main-stack');
this._cityView = new City.WeatherView({ hexpand: true,
vexpand: true });
this._stack.add(this._cityView);
this._stack.set_visible_child(initialGrid);
this.add(grid);
grid.show_all();
for (let i = 0; i < this._pageWidgets[Page.CITY].length; i++)
this._pageWidgets[Page.CITY][i].hide();
let autoLocation = this.application.currentLocationController.autoLocation;
if (!autoLocation)
this._model.showRecent();
},
update: function() {
this._cityView.update();
},
_initialLocationChanged: function(entry) {
if (entry.location)
this._model.addNewLocation(entry.location, false);
},
_getTitle: function() {
if (this._currentPage == Page.SEARCH)
return [_("Select Location"), null];
let location = this._cityView.info.location;
let city = location;
if (location.get_level() == GWeather.LocationLevel.WEATHER_STATION)
city = location.get_parent();
let country = city.get_parent();
while (country &&
country.get_level() > GWeather.LocationLevel.COUNTRY)
country = country.get_parent();
if (country)
return [city.get_name(), country.get_name()];
else
return [city.get_name(), null];
},
_goToPage: function(page) {
for (let i = 0; i < this._pageWidgets[this._currentPage].length; i++)
this._pageWidgets[this._currentPage][i].hide();
for (let i = 0; i < this._pageWidgets[page].length; i++) {
let widget = this._pageWidgets[page][i];
if (!widget.no_show_all)
this._pageWidgets[page][i].show();
}
this._currentPage = page;
let [title, subtitle] = this._getTitle();
this._header.title = title;
this._header.subtitle = subtitle;
},
showSearch: function() {
this._goToPage(Page.SEARCH);
},
showInfo: function(info) {
this._cityView.info = info;
this._cityView.disconnectClock();
let isCurrentLocation = false;
let currentLocation = this.application.currentLocationController.currentLocation;
if (currentLocation) {
isCurrentLocation = currentLocation.get_timezone().get_tzid() == info.location.get_timezone().get_tzid();
}
if (isCurrentLocation) {
this._cityView.infoPage.timeGrid.hide();
} else {
this._cityView.connectClock();
this._cityView.infoPage.timeGrid.show();
}
this._stack.set_visible_child(this._cityView);
this._goToPage(Page.CITY);
},
_showAbout: function() {
let artists = [ 'Jakub Steiner <jimmac@gmail.com>',
'Pink Sherbet Photography (D. Sharon Pruitt)',
'Elliott Brown',
'Analogick',
'DBduo Photography (Daniel R. Blume)',
'davharuk',
'Tech Haven Ministries',
'Jim Pennucci' ];
let aboutDialog = new Gtk.AboutDialog(
{ artists: artists,
authors: [ 'Giovanni Campagna <gcampagna@src.gnome.org>' ],
translator_credits: _("translator-credits"),
program_name: _("Weather"),
comments: _("A weather application"),
copyright: 'Copyright 2013 The Weather Developers',
license_type: Gtk.License.GPL_2_0,
logo_icon_name: 'org.gnome.Weather.Application',
version: pkg.version,
website: 'https://wiki.gnome.org/Apps/Weather',
wrap_license: true,
modal: true,
transient_for: this,
use_header_bar: true
});
aboutDialog.show();
aboutDialog.connect('response', function() {
aboutDialog.destroy();
});
},
_close: function() {
this.destroy();
}
});
| shivanipoddariiith/gnome-weather-tests-final | src/app/window.js | JavaScript | gpl-2.0 | 7,438 |
//>>built
define("dojox/charting/themes/PurpleRain",["../SimpleTheme","./common"],function(b,a){a.PurpleRain=new b({colors:["#4879bc","#ef446f","#3f58a7","#8254a2","#4956a6"]});return a.PurpleRain});
//@ sourceMappingURL=PurpleRain.js.map | joshuacoddingyou/php | public/scripts/dojox/charting/themes/PurpleRain.js | JavaScript | gpl-2.0 | 238 |
/*
Get Gravatar v1.0
Copyright © 2009 Josh Pyles / Pixelmatrix Design LLC
http://pixelmatrixdesign.com
Requires jQuery 1.3 or newer
Thanks to Tim Van Damme for the inspiration and the pretty demo page
License:
MIT License - http://www.opensource.org/licenses/mit-license.php
Usage:
jQuery("input#email-addresss").getGravatar();
Or you can specify some custom options:
jQuery("input#email-address").getGravatar({
url: '/includes/get-gravatar.php',
fallback: 'http://mysite.com/images/default.png',
avatarSize: 128,
avatarContainer: "#gravatar-preview",
start: function(){
alert("starting!");
},
stop: function(){
alert("stopping!");
}
});
Enjoy!
*/
(function(jQuery) {
jQuery.fn.getGravatar = function(options) {
//debug(this);
// build main options before element iteration
var opts = jQuery.extend({}, jQuery.fn.getGravatar.defaults, options);
// iterate and reformat each matched element
return this.each(function() {
jQuerythis = jQuery(this);
// build element specific options
var o = jQuery.meta ? jQuery.extend({}, opts, jQuerythis.data()) : opts;
var t = "";
//check to see if we're working with an text input first
if(jQuerythis.is("input[type='text']")){
//do an initial check of the value
jQuery.fn.getGravatar.getUrl(o, jQuerythis.val());
//do our ajax call for the MD5 hash every time a key is released
jQuerythis.keyup(function(){
clearTimeout(t);
var email = jQuerythis.val();
t = setTimeout(function(){jQuery.fn.getGravatar.getUrl(o, email);}, 500);
});
}
});
};
//
// define and expose our functions
//
jQuery.fn.getGravatar.getUrl = function(o, email){
//call the start function if in use
if(o.start) o.start(jQuerythis);
jQuery.get(o.url, "email="+email, function(data){
//when we have our MD5 hash, generate the gravatar URL
var id = data.gravatar_id;
var gravatar_url = "http://gravatar.com/avatar.php?gravatar_id="+id+"&default="+o.fallback+"&size="+o.avatarSize;
//call our function to output the avatar to the container
jQuery.fn.getGravatar.output(o.avatarContainer, gravatar_url, o.stop);
}, "json");
}
jQuery.fn.getGravatar.output = function(avatarContainer, gravatar_url, stop) {
//replace the src of our avatar container with the gravatar url
img = new Image();
jQuery(img)
.load(function(){
jQuery(avatarContainer).attr("src", gravatar_url);
if(stop) stop();
})
.attr("src", gravatar_url);
};
//
// plugin defaults
//
jQuery.fn.getGravatar.defaults = {
url: 'get-gravatar.php',
fallback: '',
avatarSize: 50,
avatarContainer: '#gravatar',
start: null,
stop: null
};
})(jQuery); | mandino/espressoshakespeare.com | wp-content/themes/unite/includes/js/getgravatar.js | JavaScript | gpl-2.0 | 2,715 |
/* exported advanced_timer */
'use strict';
var advanced_timer = {
/**
* Maps between user Ids and navigator ones
*/
timers: {},
/**
* Register a new timer with the user's timerId
*/
start: function(timerId, timeout, callback) {
if (typeof(callback) != 'function') {
callback = function() {};
}
var self = this;
var _id = setTimeout(function advTimer() {
delete(self.timers[timerId]);
callback();
}, timeout);
this.timers[timerId] = {
'timeout': timeout,
'internalTimerId': _id,
'timestamp': new Date().getTime()
};
},
/**
* Stops timer and returns the pending time
*/
stop: function(timerId) {
var timer = this.timers[timerId];
if (!timer) {
return 0;
}
clearTimeout(timer.internalTimerId);
var pendingTime = this.queryPendingTime();
delete(this.timers[timerId]);
return pendingTime;
},
/**
* Returns the pending time to timeout the timer
*/
queryPendingTime: function(timerId) {
var timer = this.timers[timerId];
if (!timer) {
return 0;
}
return timer.timeout - (new Date().getTime() - timer.timestamp);
}
};
| zapion/webaudio | shared/js/advanced_timer.js | JavaScript | gpl-2.0 | 1,183 |
var searchData=
[
['action',['Action',['../class_action.html',1,'']]],
['animation',['Animation',['../class_animation.html',1,'']]],
['animationkeys',['AnimationKeys',['../class_animation_keys.html',1,'']]]
];
| DruggedBunny/openb3d.mod | openb3d.mod/html/search/classes_0.js | JavaScript | gpl-2.0 | 216 |
(function ($, document, window) {
var metadataKey = "xbmcmetadata";
function loadPage(page, config, users) {
var html = '<option value="" selected="selected"></option>';
html += users.map(function (user) {
return '<option value="' + user.Id + '">' + user.Name + '</option>';
}).join('');
$('#selectUser', page).html(html).val(config.UserId || '');
$('#selectReleaseDateFormat', page).val(config.ReleaseDateFormat);
$('#chkSaveImagePaths', page).checked(config.SaveImagePathsInNfo).checkboxradio('refresh');
$('#chkEnablePathSubstitution', page).checked(config.EnablePathSubstitution).checkboxradio('refresh');
$('#chkEnableExtraThumbs', page).checked(config.EnableExtraThumbsDuplication).checkboxradio('refresh');
Dashboard.hideLoadingMsg();
}
function onSubmit() {
Dashboard.showLoadingMsg();
var form = this;
ApiClient.getNamedConfiguration(metadataKey).then(function (config) {
config.UserId = $('#selectUser', form).val() || null;
config.ReleaseDateFormat = $('#selectReleaseDateFormat', form).val();
config.SaveImagePathsInNfo = $('#chkSaveImagePaths', form).checked();
config.EnablePathSubstitution = $('#chkEnablePathSubstitution', form).checked();
config.EnableExtraThumbsDuplication = $('#chkEnableExtraThumbs', form).checked();
ApiClient.updateNamedConfiguration(metadataKey, config).then(Dashboard.processServerConfigurationUpdateResult);
});
// Disable default form submission
return false;
}
$(document).on('pageinit', "#metadataNfoPage", function () {
$('.metadataNfoForm').off('submit', onSubmit).on('submit', onSubmit);
}).on('pageshow', "#metadataNfoPage", function () {
Dashboard.showLoadingMsg();
var page = this;
var promise1 = ApiClient.getUsers();
var promise2 = ApiClient.getNamedConfiguration(metadataKey);
Promise.all([promise1, promise2]).then(function (responses) {
loadPage(page, responses[1], responses[0]);
});
});
})(jQuery, document, window);
| babgvant/MediaBrowser | MediaBrowser.WebDashboard/dashboard-ui/scripts/metadatanfo.js | JavaScript | gpl-2.0 | 2,203 |
function inscriptionsServiceFactory($resource) {
return $resource('/intra/api/inscription/:id', null, {
'query' : {method: 'GET', isArray: false},
'update' : { method: 'PUT' },
'en_cours': {
url: '/intra/api/inscription/en_cours',
method: 'GET',
isArray: false
},
'search' : {
method: 'GET',
url: '/intra/api/inscription/search',
isArray: false
}
});
}
| louiscarrese/lc-formations | resources/assets/js/services/data/inscriptions-service.js | JavaScript | gpl-2.0 | 482 |
/**
* Created by wupeiqi on 15/8/13.
*/
$(function () {
$.InitMenu('#left_menu_user');
Initialize('#table-body',1);
});
/*
刷新页面
*/
function Refresh(){
//get current page
var currentPage = GetCurrentPage('#pager');
Initialize('#table-body',currentPage);
}
/*
获取当前页码(根据分页css)
*/
function GetCurrentPage(pager) {
var page = $(pager).find("li[class='active']").text();
return page;
}
/*
搜索提交
*/
function SearchSubmit(){
Initialize('#table-body',1);
}
/*
*页面跳转
*/
function ChangePage(page){
Initialize('#table-body',page);
}
/*
更新资产(退出编辑状态;获取资产中变更的字段;提交数据;显示状态)
*/
function Save(){
if($('#edit_mode_target').hasClass('btn-warning')){
$.TableEditMode('#edit_mode_target','#table-body');
}
var target_status = '#handle_status';
//get data
var updateData = [];
$('#table-body').children().each(function(){
var rows = {};
var id = $(this).attr('auto-id');
var num = $(this).attr('num');
var flag = false;
$(this).children('td[edit-enable="true"]').each(function(){
var editType = $(this).attr('edit-type');
if(editType == 'input'){
var origin = $(this).attr('origin');
var newer = $(this).text();
var name = $(this).attr('name');
if(newer && newer.trim() && origin != newer){
rows[name] = newer;
flag = true;
}
}else{
var origin = $(this).attr('origin');
var newer = $(this).attr('new-value');
var name = $(this).attr('name');
if(newer && newer.trim() && origin != newer){
rows[name] = newer;
flag = true;
}
}
});
if(flag){
rows["id"] = id;
rows["num"] = num;
updateData.push(rows);
}
});
if(updateData.length<1){
return;
}
//submit data
updateData = JSON.stringify(updateData);
$.ajax({
url:'/userinfo/user_modify/',
type:'POST',
traditional:true,
data:{'data':updateData},
success: function (callback) {
callback = $.parseJSON(callback);
if(callback.status == 1){
//success
AllSuccessStatus(target_status,callback.data);
}else{
PartSuccessStatus(target_status,callback.data,callback.message);
}
Refresh();
},
error:function(){
alert('请求错误.');
Refresh();
}
});
}
/*
聚合搜索条件
*/
function AggregationSearchCondition(conditions){
var ret = {};
var $condition = $(conditions).find("input[is-condition='true']");
var name = $condition.attr('name');
var value = $condition.val();
if(!$condition.is('select')){
name = name + "__contains";
}
if(value) {
var valList = $condition.val().trim().replace(',', ',').split(',');
if (ret[name]) {
ret[name] = ret[name].concat(valList);
} else {
ret[name] = valList;
}
ret['email__contains'] = ret[name];
ret['phone__contains'] = ret[name];
ret['mobile__contains'] = ret[name];
ret['user_type__caption__contains'] = ret[name];
}
return ret;
}
/*
页面初始化(获取数据,绑定事件)
*/
function Initialize(tBody,page){
$.Show('#shade,#loading');
// 获取所有搜索条件
var conditions = JSON.stringify(AggregationSearchCondition('#search_conditions'));
var $body = $(tBody);
var searchConditions = {};
var page = page;
$.ajax({
url:'/userinfo/user_list/',
type:'POST',
traditional:true,
data:{'condition':conditions,'page':page},
success:function(callback){
callback = $.parseJSON(callback);
//create global variable
InitGlobalDict(callback);
//embed table
EmbedIntoTable(callback.vlan, callback.start, "#table-body");
//ResetSort()
$.ResetTableSort('#table-head',"#table-body");
//pager
CreatePage(callback.pager,'#pager');
//bind function and event
$.BindTableSort('#table-head','#table-body');
$.BindDoSingleCheck('#table-body');
$.Hide('#shade,#loading');
},
error:function(){
$.Hide('#shade,#loading');
}
})
}
/*
初始化字典到全局变量,以便Select中的选项使用
*/
function InitGlobalDict(callback){
window.window_user_type = callback.user_type_choice.data;
console.log(window_user_type);
}
/*
将后台ajax数据嵌套到table中
*/
function EmbedIntoTable(response,startNum,body){
if(!response.status){
alert(response.message);
}else{
//清除table中原内容
$(body).empty();
$.each(response.data,function(key,value){
var tds = [];
tds.push($.CreateTd({},{},$.CreateInput({'type':'checkbox'},{})));
tds.push($.CreateTd({},{},startNum + key + 1));
tds.push($.CreateTd({'edit-enable':'true','edit-type':'input','name':'name','origin':value.name},{}, value.name));
tds.push($.CreateTd({'edit-enable':'true','edit-type':'input','name':'email','origin':value.email},{}, value.email));
tds.push($.CreateTd({'edit-enable':'true','edit-type':'input','name':'phone','origin':value.phone},{}, value.phone));
tds.push($.CreateTd({'edit-enable':'true','edit-type':'input','name':'mobile','origin':value.mobile},{}, value.mobile));
tds.push($.CreateTd({'edit-enable':'true','edit-type':'select','value_key':'id','text_key':'caption','name':'user_type_id','origin':value.user_type__id,'edit-option':'contact','options':'window_user_type'},{}, value.user_type__caption));
var tr = $.CreateTr({'auto-id':value.id,'num':startNum + key + 1},{},tds);
$(body).append(tr);
})
}
}
/*
创建分页信息
*/
function CreatePage(data,target){
$(target).empty().append(data);
}
/*
删除业务线
*/
function DoDeleteVlan(){
var target_status = '#handle_status';
var table_body = '#table-body';
var rows = [];
$(table_body).find('input:checked').each(function(){
var id = $(this).parent().parent().attr('auto-id');
var num = $(this).parent().parent().attr('num');
rows.push({'id':parseInt(id),'num':parseInt(num)});
});
rows = JSON.stringify(rows);
$.ajax({
url: '/userinfo/user_del/',
type: 'POST',
traditional: true,
data: {'rows': rows},
success:function(callback){
$.Hide('#shade,#modal_delete');
callback = $.parseJSON(callback);
if(callback.status == 1){
//success
AllSuccessStatus(target_status,callback.data);
}else{
PartSuccessStatus(target_status,callback.data,callback.message);
}
Refresh();
}
});
}
/*
添加VLAN-取消
*/
function CancelModal(container){
$("#do_add_form").find('input').val('');
$('#do_add_modal').modal('hide')
}
/*
添加VLAN-提交
*/
function SubmitModal(formId,statusId){
var data_dict = {};
$(formId).find('input[type="text"],select').each(function(){
var name = $(this).attr('name');
var val = $(this).val();
data_dict[name] = val
});
ClearLineError(formId,statusId);
$.ajax({
url: '/userinfo/user_add/',
type: 'POST',
traditional: true,
data: data_dict,
success:function(callback){
callback = $.parseJSON(callback);
if(callback.status){
CancelModal();
Refresh();
}else{
if(callback.summary){
SummaryError(callback.summary,statusId);
}
if(callback.error){
LineError(callback.error,formId);
}
}
}
});
}
/*
清除所有行下的错误信息
*/
function ClearLineError(formId,statusId){
$(statusId).empty();
$(formId).find('div[class="form-error"]').remove();
}
/*
添加行错误信息
*/
function LineError(errorDict,formId){
//find all line,add error
$.each(errorDict,function(key,value){
var errorStr = '<div class="form-error">'+ value[0]['message'] +'</div>';
$(formId).find('input[name="'+key+'"]').after(errorStr);
});
}
/*
添加整体错误信息
*/
function SummaryError(errorStr,statusId){
$(statusId).text(errorStr);
}
/*
更新资产成功,显示更新信息
*/
function AllSuccessStatus(target,content){
$(target).popover('destroy');
var msg = "<i class='fa fa-check'></i>" + content;
$(target).empty().removeClass('btn-danger').addClass('btn-success').html(msg);
setTimeout(function(){ $(target).empty().removeClass('btn-success btn-danger'); },5000);
}
/*
更新资产错误,显示错误信息
*/
function PartSuccessStatus(target,content,errorList){
$(target).attr('data-toggle','popover');
var errorStr = '';
$.each(errorList,function(k,v){
errorStr = errorStr + v.num + '. '+ v.message + '</br>';
});
$(target).attr('data-content',errorStr);
$(target).popover();
var msg = "<i class='fa fa-info-circle'></i>" + content;
$(target).empty().removeClass('btn-success').addClass('btn-danger').html(msg);
}
/*
监听是否已经按下control键
*/
window.globalCtrlKeyPress = false;
window.onkeydown = function(event){
if(event && event.keyCode == 17){
window.globalCtrlKeyPress = true;
}
};
/*
按下Control,联动表格中正在编辑的select
*/
function MultiSelect(ths){
if(window.globalCtrlKeyPress){
var index = $(ths).parent().index();
var value = $(ths).val();
$(ths).parent().parent().nextAll().find("td input[type='checkbox']:checked").each(function(){
$(this).parent().parent().children().eq(index).children().val(value);
});
}
}
| willre/homework | day18/day18-2/s11day18_homework/static/js/userinfo/user.js | JavaScript | gpl-2.0 | 10,381 |
showWord(["n. ","1. Materyèl elastik, enpèmeyab, ki fèt ak latèks osnon ki atifisyèl. Yo fè tout kalite bagay ak kawotchou. 2. Wou machin. Kawotchou sa a plat. 3. Tib kawotchou. Prete m kawotchou a pou mwen pran yon ti dlo anvan tiyo a rete."
]) | georgejhunt/HaitiDictionary.activity | data/words/kawotchou_kaoutchou_.js | JavaScript | gpl-2.0 | 252 |
/**
* Copyright (C) 2015 Bonitasoft S.A.
* Bonitasoft, 32 rue Gustave Eiffel - 38000 Grenoble
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2.0 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/>.
*/
angular.module('bonitasoft.designer.editor.whiteboard')
.directive('formContainer', function() {
'use strict';
return {
restrict: 'E',
scope: {
id: '@',
formContainer: '=',
editor: '='
},
templateUrl: 'js/editor/whiteboard/form-container.html'
};
});
| bonitasoft/bonita-ui-designer | frontend/app/js/editor/whiteboard/form-container.directive.js | JavaScript | gpl-2.0 | 1,057 |
$(document).ready(function(){
$("#formuploadajax<?php echo strtotime($com['register_comment']);?>").on("submit", function(e){
e.preventDefault();
var f = $(this);
var formData = new FormData(document.getElementById("formuploadajax<?php echo strtotime($com['register_comment']);?>"));
formData.append("data", "value");
//formData.append(f.attr("name"), $(this)[0].files[0]);
$.ajax({
url: "index.php?pg=addreply.process",
type: "post",
dataType: "html",
data: formData,
cache: false,
contentType: false,
processData: false,
success : function(data) {
$('.listreplies<?php echo strtotime($com['register_comment']);?>').fadeIn(1000).html(data);
}
})
});
});
| CarloxGN/blogall | js/status_user_admin.js | JavaScript | gpl-3.0 | 770 |
"use strict";
tutao.provide('tutao.entity.sys.InvoiceOverviewServiceData');
/**
* @constructor
* @param {Object=} data The json data to store in this entity.
*/
tutao.entity.sys.InvoiceOverviewServiceData = function(data) {
if (data) {
this.updateData(data);
} else {
this.__format = "0";
this._month = null;
this._year = null;
}
this._entityHelper = new tutao.entity.EntityHelper(this);
this.prototype = tutao.entity.sys.InvoiceOverviewServiceData.prototype;
};
/**
* Updates the data of this entity.
* @param {Object=} data The json data to store in this entity.
*/
tutao.entity.sys.InvoiceOverviewServiceData.prototype.updateData = function(data) {
this.__format = data._format;
this._month = data.month;
this._year = data.year;
};
/**
* The version of the model this type belongs to.
* @const
*/
tutao.entity.sys.InvoiceOverviewServiceData.MODEL_VERSION = '10';
/**
* The url path to the resource.
* @const
*/
tutao.entity.sys.InvoiceOverviewServiceData.PATH = '/rest/sys/invoiceoverviewservice';
/**
* The encrypted flag.
* @const
*/
tutao.entity.sys.InvoiceOverviewServiceData.prototype.ENCRYPTED = false;
/**
* Provides the data of this instances as an object that can be converted to json.
* @return {Object} The json object.
*/
tutao.entity.sys.InvoiceOverviewServiceData.prototype.toJsonData = function() {
return {
_format: this.__format,
month: this._month,
year: this._year
};
};
/**
* The id of the InvoiceOverviewServiceData type.
*/
tutao.entity.sys.InvoiceOverviewServiceData.prototype.TYPE_ID = 883;
/**
* The id of the month attribute.
*/
tutao.entity.sys.InvoiceOverviewServiceData.prototype.MONTH_ATTRIBUTE_ID = 886;
/**
* The id of the year attribute.
*/
tutao.entity.sys.InvoiceOverviewServiceData.prototype.YEAR_ATTRIBUTE_ID = 885;
/**
* Sets the format of this InvoiceOverviewServiceData.
* @param {string} format The format of this InvoiceOverviewServiceData.
*/
tutao.entity.sys.InvoiceOverviewServiceData.prototype.setFormat = function(format) {
this.__format = format;
return this;
};
/**
* Provides the format of this InvoiceOverviewServiceData.
* @return {string} The format of this InvoiceOverviewServiceData.
*/
tutao.entity.sys.InvoiceOverviewServiceData.prototype.getFormat = function() {
return this.__format;
};
/**
* Sets the month of this InvoiceOverviewServiceData.
* @param {string} month The month of this InvoiceOverviewServiceData.
*/
tutao.entity.sys.InvoiceOverviewServiceData.prototype.setMonth = function(month) {
this._month = month;
return this;
};
/**
* Provides the month of this InvoiceOverviewServiceData.
* @return {string} The month of this InvoiceOverviewServiceData.
*/
tutao.entity.sys.InvoiceOverviewServiceData.prototype.getMonth = function() {
return this._month;
};
/**
* Sets the year of this InvoiceOverviewServiceData.
* @param {string} year The year of this InvoiceOverviewServiceData.
*/
tutao.entity.sys.InvoiceOverviewServiceData.prototype.setYear = function(year) {
this._year = year;
return this;
};
/**
* Provides the year of this InvoiceOverviewServiceData.
* @return {string} The year of this InvoiceOverviewServiceData.
*/
tutao.entity.sys.InvoiceOverviewServiceData.prototype.getYear = function() {
return this._year;
};
/**
* Posts to a service.
* @param {Object.<string, string>} parameters The parameters to send to the service.
* @param {?Object.<string, string>} headers The headers to send to the service. If null, the default authentication data is used.
* @return {Promise.<null=>} Resolves to the string result of the server or rejects with an exception if the post failed.
*/
tutao.entity.sys.InvoiceOverviewServiceData.prototype.setup = function(parameters, headers) {
if (!headers) {
headers = tutao.entity.EntityHelper.createAuthHeaders();
}
parameters["v"] = 10;
this._entityHelper.notifyObservers(false);
return tutao.locator.entityRestClient.postService(tutao.entity.sys.InvoiceOverviewServiceData.PATH, this, parameters, headers, null);
};
/**
* Provides the entity helper of this entity.
* @return {tutao.entity.EntityHelper} The entity helper.
*/
tutao.entity.sys.InvoiceOverviewServiceData.prototype.getEntityHelper = function() {
return this._entityHelper;
};
| 0359xiaodong/tutanota | web/js/generated/entity/sys/InvoiceOverviewServiceData.js | JavaScript | gpl-3.0 | 4,309 |
'use strict';
let gulp;
let plugins;
let app;
module.exports = function ( _gulp, _plugins, _app ) {
gulp = _gulp;
plugins = _plugins;
app = _app;
return {
/**
* addInstance
* TODO
* @param {string} key
* @param {*} instance
* @param {boolean} override [false]
*/
'addInstance': function (key, instance, override = false) {
if ( app.fn.typechecks.isEmpty(key) ) {
app.logger.warning( 'the given key param is empty/undefined.' );
}
else
if ( app.fn.typechecks.isEmpty(instance) ) {
app.logger.warning( 'the given key param is empty/undefined.' );
}
else {
// when instance already exists and the boolean flag override is true, reset the instance
if ( null !== app.instances[key] && override ) {
app.logger.warning( `instance with given key >>${key.cyan}<< already exists and will be replaced by the new instance.` );
}
app.instances[key] = instance;
}
},
/**
* requireModule
* TODO
* @param {string} moduleNames
*/
'requireModule': function (...moduleNames) {
let module = null;
if (app.fn.typechecks.isNotEmpty(moduleNames)) {
// app.modules.underscore.each(moduleName, function (element, index, list) {
for (let moduleName of moduleNames) {
let moduleKey = moduleName;
// if camel-case is installed, camelcase the current moduleKey
if ( null !== app.modules.camelCase ) {
moduleKey = app.modules.camelCase.camelCase(moduleKey);
}
// if module isn't already loaded, require it and store it in global app.modules
if (!app.modules[moduleKey]) {
try {
module = app.modules[moduleKey] = require(moduleName);
}
catch (e) {
app.logger.error(`${'failed'.red} to register npm module '${moduleKey.red}'. is the package name included or is it misspelled?`);
}
}
}
}
// return last required module
return module;
}
}
};
| sgtmurtaugh/clickdummy-creator | skeletor.core/gulp/fn/app-utils.js | JavaScript | gpl-3.0 | 2,499 |
/**
* followpoint.js
* Created by Ugrend on 6/07/2016.
*/
osu = osu || {};
osu.objects = osu.objects || {};
osu.objects.FollowPoint = class FollowPoint{
constructor(hitObject1, hitObject2){
this.hitObject1 = hitObject1;
this.hitObject2 = hitObject2;
this.drawn = false;
this.destroyed = false;
}
init(){
this.x1 = this.hitObject1.endX || this.hitObject1.x;
this.y1 = this.hitObject1.endY || this.hitObject1.y;
this.x2 = this.hitObject2.x;
this.y2 = this.hitObject2.y;
this.drawTime = this.hitObject1.endTime || this.hitObject1.startTime;
this.drawTime -= this.hitObject1.approachRate/2;
var xDiff = this.x2 - this.x1;
var yDiff = this.y2 - this.y1;
var angle = Math.atan2(yDiff, xDiff);
var distance = osu.helpers.math.distance(this.x1, this.y1, this.x2, this.y2);
var numPoints = Math.round(distance / (this.hitObject1.size/1.5));
var steps = 1/(numPoints+1);
var nextStep = steps;
this.followPointContainer = new PIXI.Container();
var arrowTexture = osu.skins.resources.followpoint.texture;
for(var i = 0 ; i < numPoints; i++){
var arrowSprite = new PIXI.Sprite(arrowTexture);
arrowSprite.rotation = angle;
arrowSprite.position.x = this.x1 + (xDiff * nextStep);
arrowSprite.position.y = this.y1 + (yDiff * nextStep);
this.followPointContainer.addChild(arrowSprite);
nextStep += steps;
}
}
reset(){
this.destroyed = false;
this.drawn = false;
}
draw(cur_time){
if(this.destroyed){
return false;
}
if(!this.drawn && cur_time >= this.drawTime){
this.hitObject1.game.hit_object_container.addChildAt(this.followPointContainer,0);
this.drawn = true;
return true;
}
if(!this.destroyed && cur_time > this.hitObject2.startTime){
this.destroy();
this.destroyed = true;
}
return true;
}
destroy(){
this.hitObject1.game.hit_object_container.removeChild(this.followPointContainer);
}
};
| Ugrend/mmmyeh | src/js_src/osu/objects/followpoint.js | JavaScript | gpl-3.0 | 2,224 |
/* eslint strict: 0 */
((doc) => {
const form = doc.querySelector('form[action="/tipping/purchase_tokens/"]');
form.querySelector('input#bitcoin').click();
form.querySelector('input#btc_desired_tokens').value = '<PAYMENT_AMOUNT>';
form.querySelector('input[type="submit"]').click();
})(document);
| paulallen87/chaturbate-browser | scripts/payment.js | JavaScript | gpl-3.0 | 306 |
/**
* Created by gjrwcs on 11/10/2016.
*/
(()=>{
'use strict';
const MDT = require('../mallet/mallet.dependency-tree').MDT;
/**
* Controls behavior of the ship and handles scoring
*/
angular.module('pulsar.warp').service('warp.Ship', [
MDT.Scheduler,
MDT.Camera,
MDT.Math,
MDT.Keyboard,
MDT.const.Keys,
MDT.Geometry,
Ship]);
function Ship(MScheduler, MCamera, MM, MKeyboard, MKeys, Geometry){
var self = this,
velocity = MM.vec3(0),
destLane = 0,
moveSpeed = 0.0045,
laneWidth = 1.15,
bankAngle = MM.vec3(Math.PI / 12, Math.PI / 24, Math.PI / 4),
bankPct = 0,
bankRate = 0.008;
//create the ship's transform
this.transform = new Geometry.Transform()
.translate(-laneWidth, -1, -2)
.scaleBy(0.75, 0.5, 0.75);
//Shorter local reference
var tShip = this.transform;
this.lane = 0;
this.score = 0;
this.priority = 10;
/**
* Determines if the ship is switching lanes
* @returns {boolean}
*/
function isSwitchingLanes() {
return destLane !== self.lane;
}
/**
* Gets the direction of lane switch
* @returns {number}
*/
function getSwitchDirection(){
return MM.sign(destLane - self.lane);
}
/**
* Checks position of the ship to determine if it has reached the destination lane
* @returns {boolean}
*/
function hasReachedLane(){
var lanePos = (destLane - 1) * laneWidth;
return getSwitchDirection() > 0 ? tShip.position.x >= lanePos : tShip.position.x <= lanePos;
}
/**
* Calculates how far between the start and dest lanes the ship is
* @returns {number} 0 to 1
*/
function getLaneCoord() {
var relPos = (tShip.position.x + laneWidth) % laneWidth;
return relPos / laneWidth;
}
/**
* Sets the velocity for movement and increases the bank angle
* @param dt {number} delta time
* @param dir {number} sign of direction
*/
function move(dt, dir) {
velocity.x = moveSpeed * dir;
bankPct += bankRate * dt * dir;
bankPct = MM.clamp(bankPct, -1, 1);
}
/**
* Determines what lane the ship is in from it's position
* @returns {number} 0 - 2
*/
this.getLaneFromPos = function(){
var rightBound = 0;
while((rightBound - 1) * laneWidth <= tShip.position.x){
rightBound++;
}
return getLaneCoord() > 0.5 ? rightBound : rightBound - 1;
};
function setDestLane(lane){
destLane = MM.clamp(lane, 0, 2);
}
var activeCtrl = null;
function switchLane(key){
activeCtrl = key;
setDestLane(key === MKeys.Left ? destLane - 1 : destLane + 1);
}
MKeyboard.onKeyDown(MKeys.Left, ()=>switchLane(MKeys.Left));
MKeyboard.onKeyDown(MKeys.Right, ()=>switchLane(MKeys.Right));
/**
* Determines if the destination position is in lane bounds
* @param {number} moveDistance
* @returns {boolean}
*/
function isInBounds(moveDistance) {
var minBound = -laneWidth - moveDistance,
maxBound = +laneWidth + moveDistance;
return tShip.position.x <= maxBound && tShip.position.x >= minBound;
}
MScheduler.schedule(dt => {
//Clear out the velocity
velocity.scale(0);
if(!isInBounds(0)){ //If ship is out of bounds, clamp it back in
tShip.position.x -= tShip.position.x - MM.sign(tShip.position.x) * laneWidth;
}
/**
* Move the ship if
* - there's an active control
* - and the control is still pressed
* - and the target position is in the lane bounds
*/
if(activeCtrl !== null && MKeyboard.isKeyDown(activeCtrl) && isInBounds(moveSpeed * dt)) {
move(dt, activeCtrl === MKeys.Left ? -1 : 1);
} //Otherwise, if there's still an active lane switch
else if(isSwitchingLanes()) {
move(dt, getSwitchDirection());
if(hasReachedLane()){ //move until we reach the target lane
tShip.position.x = (destLane - 1) * laneWidth;
self.lane = destLane;
velocity.scale(0);
activeCtrl = null;
}
} //Finally if there's an active control but the key was released
else if(activeCtrl !== null) {
//"snaps" the ship to the middle of a lane when the user is releases all controls
var rightBound = 0; //figure out which lane ship is left of
while((rightBound - 1) * laneWidth <= tShip.position.x){
rightBound++;
}
//Determine if the ship is close to the left or right lane
//Then set the destination and current lanes accordingly
var laneCoord = getLaneCoord();
destLane = (laneCoord > 0.5) ? rightBound : rightBound - 1;
self.lane = (laneCoord > 0.5) ? rightBound - 1 : rightBound;
//Conditionally clamp the destination and start lanes
if(destLane > 2){
destLane = 2;
self.lane = 1;
}
else if(destLane < 0){
destLane = 0;
self.lane = 1;
}
//cancel the active movement
activeCtrl = null;
}
//Gradually return the ship to resting rotation if there's no movement
if(bankPct !== 0 && velocity.len2() === 0) {
var sign = MM.sign(bankPct);
bankPct -= bankRate * dt * sign;
bankPct = MM.clamp(bankPct, -1, 1);
var newSign = MM.sign(bankPct);
if(newSign !== sign){
bankPct = 0;
}
}
tShip.timeTranslate(velocity, dt);
MScheduler.draw(() => {
//Rotate ship
tShip.rotation.set(
- Math.PI / 9 - Math.abs(bankPct * bankAngle.x),
bankPct * bankAngle.y,
bankPct * bankAngle.z);
//Render in slightly muted red
MCamera.render(Geometry.meshes.Ship, tShip, MM.vec3(225, 20, 20));
MCamera.present();
//Draw Shadow
//MEasel.context.fillStyle = 'rgba(0,0,0,.25)';
//MCamera.drawShape(Shapes.Triangle, MM.vec3(tShip.position.x, 0, tShip.position.z), shipWidth * Math.cos(bankAngle), 10, 0);
}, this.priority);
}, this.priority);
}
})();
| thunder033/RMWA | pulsar/app/warp/ship.svc.js | JavaScript | gpl-3.0 | 7,212 |
var casper = require('casper').create();
var har = require('./har');
var page = {
url: 'https://trd.promo.eprize.com/1.19.12.0/client/dist/optimizeit/?environment=design',
resources: []
};
casper.options.onResourceRequested = function(casper, request) {
page.startTime = page.startTime || new Date();
page.resources[request.id] = {
request: request,
startReply: null,
endReply: null
};
};
casper.options.onResourceReceived = function(casper, response) {
if (response.stage === 'start') {
page.resources[response.id].startReply = response;
}
if (response.stage === 'end') {
page.resources[response.id].endReply = response;
}
};
casper.start(page.url);
casper.then(function() {
page.endTime = new Date();
page.title = this.getTitle();
this.echo(JSON.stringify(har.createHAR(page), null, ' '));
});
casper.run();
| dustinboston/baseline | casper.js | JavaScript | gpl-3.0 | 863 |
function Routes(dependencies) {
/// Dependencies
var _console;
var _app;
var _express;
var _io;
var _bodyParser;
var _morgan;
var _mongoose;
var _jwt;
var _checkInternet;
var _database;
var _cross;
var _apiRoutes;
var constructor = function () {
_app = dependencies.app;
_express = dependencies.express;
_bodyParser = dependencies.bodyParser;
_database = dependencies.database;
_console = dependencies.console;
_apiRoutes = _express.Router();
_cross = dependencies.cross;
_jwt = dependencies.jwt;
createAPI();
_console.log('API routes module initialized', 'server-success');
}
var createAPI = function () {
/// Welcome
/// -------------------------
// route to show message (GET http://localhost:3000/api/Welcome)
_apiRoutes.get('/Welcome', function (req, res) {
res.json({ message: 'Welcome to the coolest API on earth!' });
});
/// Humidity api routes
/// -------------------------
// (GET http://localhost:3000/api/Humidity/Id[ID])
_apiRoutes.get('/Humidity/Id/:Id', function (req, res) {
_database.Humidity().GetHumidityById(req.params.Id, function (result) {
res.json({ message: 'GetHumidityById', result: result });
})
});
// (GET http://localhost:3000/api/Humidity)
_apiRoutes.get('/Humidity/All', function (req, res) {
_database.Humidity().GetAllHumidity(null, function (result) {
res.json({ message: 'GetAllHumidity', result: result });
})
});
/// Photocell api routes
/// -------------------------
// (GET http://localhost:3000/api/Photocell/Id[ID])
_apiRoutes.get('/Photocell/Id/:Id', function (req, res) {
_database.Photocell().GetPhotocellById(req.params.Id, function (result) {
res.json({ message: 'GetPhotocellById', result: result });
})
});
// (GET http://localhost:3000/api/Photocell)
_apiRoutes.get('/Photocell/All', function (req, res) {
_database.Photocell().GetAllPhotocell(null, function (result) {
res.json({ message: 'GetAllPhotocell', result: result });
})
});
// apply the routes to our application with the prefix /api
_app.use('/api', _apiRoutes);
}
return {
Initialize: constructor
}
}
module.exports = Routes; | thEpisode/DevFest-IoT-Microsoft | Server/app/controllers/routesController.js | JavaScript | gpl-3.0 | 2,587 |
!function(){"use strict";var t={n:function(n){var e=n&&n.__esModule?function(){return n.default}:function(){return n};return t.d(e,{a:e}),e},d:function(n,e){for(var c in e)t.o(e,c)&&!t.o(n,c)&&Object.defineProperty(n,c,{enumerable:!0,get:e[c]})},o:function(t,n){return Object.prototype.hasOwnProperty.call(t,n)}},n=window.wp.i18n,e=window.jQuery,c=t.n(e);!function(){const t={update:0,install:0,activate:0,deactivate:0};c()(".llms-bulk-close").on("click",(function(t){t.preventDefault(),c()("input.llms-bulk-check").filter(":checked").prop("checked",!1).trigger("change")})),c()("input.llms-bulk-check").on("change",(function(){const e=c()(this).attr("data-action");c()(this).is(":checked")?t[e]++:t[e]--,function(){const e=c()("#llms-addons-bulk-actions");t.update||t.install||t.activate||t.deactivate?e.addClass("active"):e.removeClass("active"),c().each(t,(function(t,c){const i=e.find(".llms-bulk-desc."+t);let o="";c?(
// Translators: %d = Number of add-ons to perform the specified action against.
o=(0,n.sprintf)((0,n._n)("%d add-on","%d add-ons",c,"lifterlms"),c),i.show()):i.hide(),i.find("span").text(o)}))}()})),c()("#llms-active-keys-toggle").on("click",(function(){c()("#llms-key-field-form").toggle()}))}()}(); | gocodebox/lifterlms | assets/js/llms-admin-addons.js | JavaScript | gpl-3.0 | 1,224 |
/*
* Allmighty Link Shortener - https://github.com/RyanTheAllmighty/Allmighty-Link-Shortener
* Copyright (C) 2015 RyanTheAllmighty
*
* 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/>.
*/
/* globals angular */
(function () {
'use strict';
angular.module('AllmightyLinkShortenerAdmin').controller('LoginController', loginController);
loginController.$inject = ['$rootScope', '$state', 'config', 'Login', 'Notification'];
function loginController($rootScope, $state, config, Login, Notification) {
/* jshint validthis:true */
let vm = this;
/* jshint validthis:false */
vm.config = config;
vm.username = '';
vm.password = '';
vm.login = function () {
Login.login(vm.username, vm.password).then(function (token) {
$rootScope.$apply(function () {
$rootScope.loginToken = token;
$state.go('dashboard');
});
}).catch((err) => Notification.error({message: err.message, delay: 5000}));
};
}
})(); | RyanTheAllmighty/Allmighty-Link-Shortener | resources/js/admin/controllers/login.controller.js | JavaScript | gpl-3.0 | 1,672 |
import React, { Component } from "react";
import PropTypes from "prop-types";
import { compose, withProps } from "recompose";
import getServiceConfig from "nodemailer-wellknown";
import { registerComponent, composeWithTracker } from "@reactioncommerce/reaction-components";
import { Meteor } from "meteor/meteor";
import { Reaction } from "/client/api";
import actions from "../actions";
import SMTPEmailConfig from "../components/SMTPEmailConfig";
const wrapComponent = (Comp) => (
class SMTPEmailConfigContainer extends Component {
static propTypes = {
settings: PropTypes.shape({
host: PropTypes.string,
password: PropTypes.string,
port: PropTypes.oneOfType([
PropTypes.number,
PropTypes.string
]),
service: PropTypes.string,
user: PropTypes.string
})
}
constructor(props) {
super(props);
this.state = {
status: null,
error: null
};
}
componentDidMount() {
this._isMounted = true;
this.checkEmailStatus();
}
componentWillReceiveProps(nextProps) {
const { settings } = this.props;
const { settings: nextSettings } = nextProps;
// if the email settings do not match check the email status
if (JSON.stringify(settings) !== JSON.stringify(nextSettings)) {
this.checkEmailStatus();
} else {
return;
}
}
componentWillUnmount() {
this._isMounted = false;
}
// checking email settings
// and updating status
checkEmailStatus() {
const { settings } = this.props;
const { service, host, port, user, password } = settings;
if (service && host && port && user && password) {
Meteor.call("email/verifySettings", (error) => {
if (!this._isMounted) return;
if (error) {
this.setState({ status: "error" });
} else {
this.setState({ status: "valid" });
}
});
} else {
this.setState({ status: "error" });
}
}
render() {
const { status } = this.state;
return (
<Comp {...this.props} status={status} />
);
}
}
);
const composer = (props, onData) => {
if (Meteor.subscribe("Packages").ready()) {
const shopSettings = Reaction.getShopSettings();
const settings = shopSettings.mail || {};
if (settings.service && settings.service !== "custom") {
const config = getServiceConfig(settings.service);
// show localhost for test providers like Maildev that have no host
settings.host = config.host || "localhost";
settings.port = config.port;
}
return onData(null, { settings });
}
};
const handlers = { saveSettings: actions.settings.saveSettings };
registerComponent("SMTPEmailConfig", SMTPEmailConfig, [
composeWithTracker(composer),
withProps(handlers),
wrapComponent
]);
export default compose(
composeWithTracker(composer),
withProps(handlers),
wrapComponent
)(SMTPEmailConfig);
| anthonybrown/reaction | imports/plugins/included/email-smtp/client/containers/SMTPEmailConfigContainer.js | JavaScript | gpl-3.0 | 3,030 |
function SendEvent(eventType, refreshPage, data) {
if (parent.SendEvent && (parent != this)) {
parent.SendEvent(eventType, refreshPage, data);
}
else {
// Set the refresh page
if (typeof (refreshPage) !== "undefined") {
refreshPageOnClose = refreshPage;
}
// Top frame events (do not delegate them to the child frames)
switch (eventType) {
case 'close':
if (typeof (refreshPageOnClose) === 'undefined') {
refreshPageOnClose = false;
}
CloseDialog(refreshPageOnClose);
return;
case 'setrefreshpage':
refreshPageOnClose = true;
return;
case 'updatevariantposition':
UpdateVariantPosition(data.itemCode, data.variantId);
return;
case 'changewidget':
ChangeWidget(data.zoneId, data.widgetId, data.aliasPath);
return;
case 'setcontentchanged':
SetContentChanged();
return;
}
// Start raising child frames events
RaiseEvent(eventType, refreshPage);
}
}
// Raise the event. If there are frames, delegate the event into the frames.
function RaiseEvent(eventType, refreshPage) {
// Delegate the refreshPage flag to the child pages where the variable is defined (solves issue with CloseDialog() in the layout pages)
if (typeof (refreshPageOnClose) !== 'undefined') {
refreshPageOnClose = !!refreshPage;
}
var applyHandler = false;
// If frames collection contains itself, apply handler
if (frames != null) {
for (var i = 0; i < frames.length; i++) {
if (frames[i].location.href == this.location.href) {
applyHandler = true;
break;
}
}
}
// Other event handlers which are to be delegated to the child frames
if (!applyHandler && (frames != null)) {
for (var i = 0; i < frames.length; i++) {
try {
if (frames[i].RaiseEvent) {
frames[i].RaiseEvent(eventType, refreshPage);
}
}
catch (ex) {
}
}
}
// Call the event handler when is registered for this frame
if (eventType == 'ok') {
if (typeof (OnOkHandler) == 'function') {
OnOkHandler();
}
}
if (eventType == 'apply') {
if (typeof (OnApplyHandler) == 'function') {
OnApplyHandler();
}
}
}
| CCChapel/ccchapel.com | CMS/CMSScripts/DesignMode/WebPartProperties.js | JavaScript | gpl-3.0 | 2,625 |
'use strict';
/**
* @ngdoc function
* @name bitbloqApp.controller:HeaderCtrl
* @description
* # HeaderCtrl
* Controller of the bitbloqApp
*/
angular.module('bitbloqApp')
.controller('HeaderCtrl', function ($scope, $location, $rootScope, _, ngDialog, userApi, $document, $translate, centerModeApi, alertsService, utils) {
$scope.userApi = userApi;
$scope.utils = utils;
$scope.translate = $translate;
$scope.showHeader = false;
$scope.showUserHeader = false;
$scope.common.session.save = false;
$scope.createCenter = function () {
function tryCenter() {
modalOptions.title = 'centerMode_modal_createCenter-title';
modalOptions.mainText = 'centerMode_modal_createCenter-mainText';
modalOptions.confirmButton = 'create_button';
modalOptions.type = 'form';
modalOptions.extraButton = '';
modalOptions.confirmAction = createCenter;
modalOptions.center = {};
function createCenter() {
if (modalOptions.center.name && modalOptions.center.location && modalOptions.center.telephone) {
centerModeApi.createCenter(modalOptions.center).then(function () {
ngDialog.close(centerModal);
$scope.common.userRole = 'headmaster';
$location.url('/center');
alertsService.add({
text: 'centerMode_alert_createCenter',
id: 'createCenter',
type: 'ok',
time: 5000
});
}).catch(function () {
alertsService.add({
text: 'centerMode_alert_createCenter-Error',
id: 'createCenter',
type: 'ko'
});
});
} else {
modalOptions.errors = true;
}
}
}
var modalOptions = $rootScope.$new();
_.extend(modalOptions, {
title: 'centerMode_modal_createCenterTitle',
contentTemplate: 'views/modals/centerMode/activateCenterMode.html',
customClass: 'modal--information',
mainText: 'centerMode_modal_createCenter-introText',
confirmButton: 'centerMode_modal_confirmation-button',
confirmAction: tryCenter,
modalButtons: true,
type: 'information',
errors: false
});
var centerModal = ngDialog.open({
template: '/views/modals/modal.html',
className: 'modal--container modal--centerMode',
scope: modalOptions
});
};
$scope.logout = function () {
userApi.logout();
$scope.common.setUser(null);
localStorage.projectsChange = false;
$location.url('/');
};
$scope.openUserMenu = function ($event) {
$event.stopPropagation();
$scope.showUserHeader = !$scope.showUserHeader;
};
$scope.openMenu = function ($event) {
$event.stopPropagation();
$scope.showHeader = !$scope.showHeader;
};
function clickDocumentHandler() {
if ($scope.showUserHeader) {
$scope.showUserHeader = false;
}
if ($scope.showHeader) {
$scope.showHeader = false;
}
utils.apply($scope);
}
$document.on('click', clickDocumentHandler);
$scope.$on('$destroy', function () {
$document.off('click', clickDocumentHandler);
});
});
| bq/bitbloq-frontend | app/scripts/controllers/header.js | JavaScript | gpl-3.0 | 4,013 |
/*
VideoSegments. Extension to Cut YouTube Videos.
Copyright (C) 2017-2019 Alex Lys
This file is part of VideoSegments.
VideoSegments 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.
VideoSegments 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 VideoSegments. If not, see <https://www.gnu.org/licenses/>.
*/
'use strict';
class Player {
constructor(video, mutePlayEvent) {
// save video reference
this.video = video;
// acceleration vars
this.prevPlaybackRate = null;
this.preventRateChangedEvent = false;
this.muteEvent = -1;
this.startTime = null;
this.seekTime = null;
if (mutePlayEvent) {
this.muteEvent = 1;
}
// extract youtube video ID
// let tmp = document.getElementsByClassName('ytp-title-link')[0];
// let src = (tmp ? tmp.href : null) || (this.video ? this.video.src : null);
// this.id = src.match(/(?:youtube\.com\/(?:[^\/]+\/.+\/|(?:v|e(?:mbed)?)\/|.*[?&]v=)|youtu\.be\/)([^"&?\/ ]{11})/i)[1];
this.id = window.location.href.match(/(?:youtube\.com\/(?:[^\/]+\/.+\/|(?:v|e(?:mbed)?)\/|.*[?&]v=)|youtu\.be\/)([^"&?\/ ]{11})/i)[1];
// play event will be called several times before video start
this.onPlayBeforeLoadedContext = () => {
// if autopause enabled
if (settings.autoPauseDuration > 0.0) {
// round video's current time because it already played 0.0001'th of second
this.video.currentTime = Math.round(this.video.currentTime);
log('autopausing video at: ', this.video.currentTime);
this.startTime = Math.round(this.video.currentTime);
// if video is not paused
if (this.video.paused === false) {
// pause video
this.video.pause();
// if autopause timer doesn't exists
if (!this.timer) {
// set autopause timer
this.timer = setTimeout(() => {
log('autopause timeout');
this.video.removeEventListener('play', this.onPlayBeforeLoadedContext);
this.video.play();
}, settings.autoPauseDuration * 1000);
}
}
}
}
// listen for play events before segmentation is loaded
this.video.addEventListener('play', this.onPlayBeforeLoadedContext);
// force pause for video (required for playlists)
this.onPlayBeforeLoadedContext();
// if video is ready to play
if (this.video.readyState > 3) {
// request segmentation
this.getSegmentation();
log('video stream is ready');
} else {
// when video is ready to play
let ctx = () => {
this.video.removeEventListener('canplay', ctx);
this.getSegmentation();
}
// wait for video
this.video.addEventListener('canplay', ctx);
log('waiting for video to load...');
}
if (settings.hideEndScreenCards === 'yes') {
injectCSSRule('.ytp-ce-channel {visibility: hidden !important;}');
injectCSSRule('.ytp-ce-playlist {visibility: hidden !important;}');
injectCSSRule('.annotation {visibility: hidden !important;}');
injectCSSRule('.ytp-cards-button {visibility: hidden !important;}');
injectCSSRule('.ytp-ce-video {visibility: hidden !important;}');
injectCSSRule('.ytp-ce-expanding-image {visibility: hidden !important;}');
}
}
async getSegmentation() {
let self = this;
log('requesting segmentation...');
this.segmentation = null;
// create segmentsbar
let progressBar = document.getElementsByClassName("ytp-progress-bar-container")[0] || document.getElementsByClassName("no-model cue-range-markers")[0];
this.segmentsbar = new Segmentsbar(progressBar);
let pid = getQueryString('vs-pid');
if (pid === null) {
// request local and community segmentations
this.getCommunitySegmentation().then(segmentation => {
if (typeof segmentation.types === 'undefined') {
self.channel = segmentation.channel;
}
if (typeof segmentation.types === 'undefined') {
self.onGotSegmentation('official', {}, 'local');
} else {
self.onGotSegmentation('official', {
timestamps: segmentation.timestamps,
types: segmentation.types
}, 'local');
}
});
this.getLocalSegmentation().then(segmentation => self.onGotSegmentation('local', segmentation, 'official'));
} else {
this.segmentation = await this.getPendingSegmentation(pid);
this.onSegmentationReady();
}
}
onGotSegmentation(origin, segmentation, secondaryOrigin) {
log(settings.databasePriority);
log('got ' + ((settings.databasePriority === origin) ? 'primary' : 'secondary') + ' segmentation:', origin, segmentation);
// save current segmentation
this[origin] = segmentation;
// if this segmentation have priority
if (settings.databasePriority === origin) {
// if this segmentation exists
if (this[origin] && this[origin].types) {
// set as primary
this.segmentation = segmentation;
this.segmentation.origin = origin;
log('primary segmentation is ready');
this.onSegmentationReady();
}
// if secondary segmentation exists
else if (this[secondaryOrigin] && this[secondaryOrigin].types) {
// set secondary segmentation as primary
this.segmentation = this[secondaryOrigin];
this.segmentation.origin = secondaryOrigin;
log('no primary segmentation exists, use secondary as primary');
this.onSegmentationReady();
}
}
// save this segmentation as secondary
else {
// if no primary segmentation exists
if (typeof this[settings.databasePriority] !== 'undefined' && typeof this[settings.databasePriority].types === 'undefined' && typeof segmentation.types !== 'undefined') {
// set secondary segmentation as primary
this.segmentation = segmentation;
this.segmentation.origin = origin;
log('no primary segmentation exists, use secondary as primary');
this.onSegmentationReady();
}
}
// if no segmentation
if (this.segmentation === null && this[origin] && this[secondaryOrigin]) {
log('no segmentations exists');
this.segmentation = {
origin: 'noSegmentation'
};
this.onSegmentationReady();
}
}
async onSegmentationReady() {
if (typeof this.editor !== 'undefined') {
return;
}
if (this.segmentation.origin === 'noSegmentation') {
this.segmentation = await tryChannelFilter(this.channel, this.video.duration);
} else {
this.segmentation = this.prepareSegmentation(this.segmentation);
if ((typeof this.segmentation.types !== 'undefined') && this.segmentation.types[this.segmentation.types.length - 1] === '-') {
this.segmentation.timestamps.pop();
this.segmentation.types.pop();
}
}
// bind events so "this" will be reference to object instead of "video"
this.onPlayEventContext = this.onPlayEvent.bind(this);
this.onPauseEventContext = this.onPauseEvent.bind(this);
this.onRateChangeEventContext = this.onRateChangeEvent.bind(this);
// listen for events
this.video.addEventListener('play', this.onPlayEventContext);
this.video.addEventListener('seeked', () => {
// quick fix for looped videos
if (this.video.currentTime <= 0.1) {
this.startTime = 0.0;
this.onPlayEvent(""); // pass something or handler will reject
}
});
this.video.addEventListener('pause', this.onPauseEventContext);
this.video.addEventListener('ratechange', this.onRateChangeEventContext);
// sometime player reset video to 0 at start
// this.video.addEventListener('seeked', () => {
// log('seeked', this.video.currentTime);
// if (this.seekTime !== null && Math.abs(this.seekTime-this.video.currentTime) > 0.1 ) {
// this.video.currentTime = this.seekTime;
// this.seekTime = null;
// log('corrected seek time');
// }
// });
if (settings.mode === 'simplified') {
this.originalSegmentation = this.segmentation;
this.segmentation = this.getSimplifiedSegmentation(this.segmentation);
this.segmentation.origin = this.originalSegmentation.origin;
}
// remove play listener
this.video.removeEventListener('play', this.onPlayBeforeLoadedContext);
// if autopause timer is working
if (this.timer) {
// disable timer
clearTimeout(this.timer);
this.timer = undefined;
// start video playback
this.video.play();
} else {
// fake play event
this.onPlayEventContext();
}
this.segmentsbar.set(this.segmentation.timestamps, this.segmentation.types, this.video.duration);
// log('segmentsbar created');
// if it is not iframe
if (window.parent === window) {
// start editor
this.editor = new Editor(this, this.segmentsbar, this.video, this.id, this.segmentation);
this.createCutVideoButton();
}
}
createCutVideoButton() {
if (this.cutButtonTimer !== null) {
clearInterval(this.cutButtonTimer);
}
this.cutButtonTimer = setInterval(() => {
this.cutButton = document.getElementById('vs-cut-video-button');
if (this.cutButton !== null) {
return;
}
let actions = document.getElementById('top-level-buttons');
if (actions !== null && actions.childNodes.length !== 0) {
clearInterval(this.cutButtonTimer);
this.cutButtonTimer == null;
let button = document.createElement('button');
button.id = 'vs-cut-video-button';
let image = document.createElement('span');
image.id = 'vs-cut-video-button-image';
image.classList.add('fa');
image.classList.add('fa-cut');
button.appendChild(image);
let text = document.createElement('span');
text.id = 'vs-cut-video-button-text';
if (settings.showPanel === 'always') {
translateNodeText(text, "HidePanel");
} else {
translateNodeText(text, "CutVideo");
}
button.appendChild(text);
actions.childNodes[1].insertAdjacentElement('afterEnd', button);
button.addEventListener('click', () => {
if (settings.showPanel === 'always') {
settings.showPanel = 'never';
this.editor.panel.style.visibility = 'hidden';
translateNodeText(text, "CutVideo");
} else {
settings.showPanel = 'always';
this.editor.panel.style.visibility = 'visible';
translateNodeText(text, "HidePanel");
}
saveSettings();
});
playTutorial(settings.tutorial.section, button);
}
}, 1000);
}
// TODO: move get request to utils
getCommunitySegmentation() {
// browser.runtime.sendMessage({
// 'get_segmentation': this.id
// }, function (response) {
// console.log(response);
// });
return new Promise(resolve => {
let xhr = new XMLHttpRequest();
xhr.open('GET', 'https://db.videosegments.org/api/v3/get.php?id=' + this.id);
xhr.onreadystatechange = () => {
if (xhr.readyState == 4) {
if (xhr.status == 200) {
let response = JSON.parse(xhr.responseText);
resolve(response || {});
} else {
resolve({});
}
}
};
xhr.setRequestHeader("content-type", "application/x-www-form-urlencoded");
xhr.send();
});
}
getLocalSegmentation() {
let self = this;
return new Promise(resolve => {
let storageId = 'youtube-' + self.id;
browser.storage.local.get({
[storageId]: ''
}, function (result) {
if (result[storageId] !== '') {
let response = {
timestamps: result[storageId].timestamps,
types: result[storageId].types
};
resolve(response || {});
} else {
resolve({});
}
});
});
}
async getPendingSegmentation(pid) {
let response = await xhr_get('https://db.videosegments.org/api/v3/review.php?id=' + pid);
if (typeof response.timestamps !== 'undefined' && response.timestamps.length > 0) {
let timestamps = response.timestamps;
let types = response.types;
let origin = 'pending';
return {
timestamps: timestamps,
types: types,
origin: origin
};
} else {
// window.location.href = removeParam("vs-pid", window.location.href);
window.location = removeParam("vs-pid", window.location.href);
}
return ({});
}
prepareSegmentation(segmentation) {
if (typeof segmentation.types !== 'undefined') {
segmentation.timestamps.unshift(0.0);
segmentation.timestamps.push(parseFloat(this.video.duration));
}
return segmentation;
}
getSimplifiedSegmentation(segmentation) {
if (typeof segmentation.types === 'undefined') {
return {
timestamps: undefined,
types: undefined
};
}
let simplified = {
timestamps: [0.0],
types: []
};
let lastType = this.getSegmentSimplifiedType(segmentation.types[0]);
for (let i = 1; i < segmentation.types.length; ++i) {
if (this.getSegmentSimplifiedType(segmentation.types[i]) !== lastType) {
simplified.timestamps.push(segmentation.timestamps[i]);
simplified.types.push(lastType);
lastType = this.getSegmentSimplifiedType(segmentation.types[i]);
}
}
if (this.getSegmentSimplifiedType(segmentation.types[segmentation.types.length - 1]) === lastType) {
simplified.timestamps.push(segmentation.timestamps[segmentation.timestamps.length - 1]);
simplified.types.push(lastType);
}
return simplified;
}
getOriginalSegmentation(segmentation) {
if (typeof this.originalSegmentation === 'undefined' || typeof this.originalSegmentation.timestamps === 'undefined') {
return {
timestamps: segmentation.timestamps,
types: convertSimplifiedSegmentation(segmentation.types)
}
} else {
return this.originalSegmentation;
}
}
getSegmentSimplifiedType(type) {
if (type === 'c' || type == 'ac') {
return 'pl';
} else {
return 'sk';
}
}
onPlayEvent(event) {
log('player::onPlayEvent: ', this.video.currentTime, this.startTime, this.seekTime);
if (typeof event === 'undefined') {
return;
}
// if (this.muteEvent === 0) {
// this.muteEvent = -1;
// log('muted');
// return;
// }
// this.muteEvent = this.muteEvent - 1;
if (this.segmentation) {
if (this.timer) {
clearTimeout(this.timer);
this.timer = undefined;
}
this.restoreSpeed();
let segmentToRewind = this.findNextSegmentToRewind(0);
if (segmentToRewind !== null) {
this.tryRewind(segmentToRewind);
}
}
}
tryRewind(toSegmentNumber) {
let currentTime;
if (this.startTime !== null) {
currentTime = this.startTime;
this.startTime = null;
} else {
currentTime = this.video.currentTime;
}
log(currentTime, toSegmentNumber);
let delay = this.segmentation.timestamps[toSegmentNumber] - currentTime;
if (delay <= 0) {
let duration = this.segmentation.timestamps[toSegmentNumber + 1] - currentTime;
if (duration <= settings.segments[this.segmentation.types[toSegmentNumber]].duration) {
this.prevPlaybackRate = this.video.playbackRate;
this.preventRateChangedEvent = true;
this.video.playbackRate = settings.segments[this.segmentation.types[toSegmentNumber]].speed;
delay = duration * (1000 / this.video.playbackRate);
// timers have awful precision so start a little bit earlier
if (delay > 500 && delay > 40) {
// TODO: timers precision is about 10ms, so it can be calculated more precisily depending on speed
delay -= 40;
}
this.timer = setTimeout(() => {
this.restoreSpeed(toSegmentNumber);
this.onPlayEvent();
}, delay);
} else {
this.seekTime = this.segmentation.timestamps[toSegmentNumber + 1];
this.video.currentTime = this.segmentation.timestamps[toSegmentNumber + 1];
toSegmentNumber = this.findNextSegmentToRewind(toSegmentNumber);
delay = this.segmentation.timestamps[toSegmentNumber] - this.video.currentTime;
}
}
if (toSegmentNumber !== null) {
this.timer = setTimeout(() => {
this.tryRewind(toSegmentNumber);
}, delay * (1000 / this.video.playbackRate));
}
}
restoreSpeed() {
if (this.prevPlaybackRate !== null) {
this.preventRateChangedEvent = true;
this.video.playbackRate = this.prevPlaybackRate;
this.prevPlaybackRate = null;
}
}
findNextSegmentToRewind(currentSegmentNumber) {
if (!this.segmentation || !this.segmentation.timestamps || !this.segmentation.types) return null;
let currentTime;
if (this.startTime !== null) {
currentTime = Math.round(this.startTime * 100) / 100;
} else {
currentTime = Math.round(this.video.currentTime * 100) / 100;
}
for (let i = currentSegmentNumber; i < this.segmentation.types.length; ++i) {
if (settings.segments[this.segmentation.types[i]].skip == true && this.segmentation.timestamps[i] >= currentTime) {
return i;
}
}
return null;
}
onRateChangeEvent() {
log('player::onRateChangeEvent: ', this.video.currentTime);
if (this.preventRateChangedEvent === false) {
this.onPlayEvent();
} else {
this.preventRateChangedEvent = false;
}
}
onPauseEvent() {
log('player::onPauseEvent: ', this.video.currentTime);
if (this.timer && this.muteEvent !== 0) {
clearTimeout(this.timer);
this.timer = undefined;
}
}
updateSettings(prop, value) {
if (prop === 'databasePriority') {
settings[prop] = value;
} else if (prop === 'segmentsBarLocation') {
settings[prop] = value;
this.segmentsbar.updatePosition();
} else if (prop === 'mode') {
settings[prop] = value;
if (value === 'simplified') {
this.segmentation = this.getSimplifiedSegmentation(this.segmentation);
} else {
this.segmentation = this.getOriginalSegmentation(this.segmentation);
}
this.editor.updateSettings(prop, {
mode: value,
segmentation: this.segmentation
});
} else if (prop === 'autoPauseDuration') {
settings[prop] = value;
} else if (prop === 'popupDurationOnSend') {
settings[prop] = value;
} else if (prop === 'color') {
settings.segments[value.segment].color = value.newColor;
settings.segments[value.segment].opacity = value.opacity;
if (settings.mode === 'simplified') {
if (value.segment === 'pl' || value.segment === 'sk') {
this.segmentsbar.updateColor(value.segment, settings.segments[value.segment].color, settings.segments[value.segment].opacity);
}
} else {
if (value.segment !== 'pl' && value.segment !== 'sk') {
this.segmentsbar.updateColor(value.segment, settings.segments[value.segment].color, settings.segments[value.segment].opacity);
}
}
} else if (prop === 'playback') {
settings.segments[value.segment].skip = value.skip;
} else if (prop === 'accelerationDuration') {
settings.segments[value.segment].duration = value.duration;
} else if (prop === 'accelerationSpeed') {
settings.segments[value.segment].speed = value.speed;
} else {
this.editor.updateSettings(prop, value);
}
}
remove() {
this.video.removeEventListener('play', this.onPlayEventContext);
this.video.removeEventListener('pause', this.onPauseEventContext);
this.video.removeEventListener('ratechange', this.onRateChangeEventContext);
if (this.timer) {
clearTimeout(this.timer);
this.timer = undefined;
}
if (this.cutButtonTimer !== null) {
clearInterval(this.cutButtonTimer);
}
this.segmentation = undefined;
this.editor.remove();
this.editor = undefined;
this.segmentsbar.remove();
this.segmentsbar = undefined;
}
} | videosegments/videosegments | player/player.js | JavaScript | gpl-3.0 | 19,395 |
exports.CreateClient = {
name: 'CreateClient',
description: 'Create Client entity',
outputExample: {
},
inputs: {
Email : {required: true},
Address : {required: true},
ClientStatus : {required: true},
PaymentMethodId : {required: true},
DocumentNumber : {required: true},
DocumentType : {required: true},
PhoneNumber : {required: true}
},
authenticated: true,
version: 1.0,
run: function(api, data, next){
var client = new api.MongoDB.Client({
_id : new api.MongoDB.ObjectId(),
Email : data.params.Email,
Address : data.params.Address,
ClientStatus : data.params.ClientStatus,
PaymentMethodId : data.params.PaymentMethodId,
DocumentNumber : data.params.DocumentNumber,
DocumentType : data.params.DocumentType,
PhoneNumber : data.params.PhoneNumber
});
client.save(function(err, result){
if (err) console.log(err);
data.response.result = result;
next();
})
}
};
exports.EditClient = {
name: 'EditClient',
description: 'Edit Client entity',
outputExample: {
},
inputs: {
Email : {required: true},
Address : {required: true},
ClientStatus : {required: true},
PaymentMethodId : {required: true},
DocumentNumber : {required: true},
DocumentType : {required: true},
PhoneNumber : {required: true}
},
authenticated: true,
version: 1.0,
run: function(api, data, next){
var client = new api.MongoDB.Client({
_id : new api.MongoDB.ObjectId(),
Email : data.params.Email,
Address : data.params.Address,
ClientStatus : data.params.ClientStatus,
PaymentMethodId : data.params.PaymentMethodId,
DocumentNumber : data.params.DocumentNumber,
DocumentType : data.params.DocumentType,
PhoneNumber : data.params.PhoneNumber
});
var query = {"_id": data.params.Id};
api.MongoDB.Client.findOneAndUpdate(query, client, {new: true}, function(err, result){
if (err) {console.log('Error on update:\n');console.log(err)};
data.response.result = result;
next();
})
}
};
exports.GetClientById = {
name: 'GetClientById',
description: 'Get Client by Id',
outputExample: {
},
inputs: {
ClientId : {required: true}
},
authenticated: true,
version: 1.0,
run: function(api, data, next){
api.MongoDB.Client.findOne({"_id" : data.params.ClientId}, function(err, client){
if (err) console.log(err);
data.response.Client = client;
next();
})
}
};
exports.GetAllClients = {
name: 'GetAllClients',
description: 'Get Client by Id',
outputExample: {
},
inputs: {
},
authenticated: true,
version: 1.0,
run: function(api, data, next){
api.MongoDB.Client.find({}, function(err, clients){
if (err) console.log(err);
data.response.Clients = clients;
next();
})
}
};
exports.DeleteClient = {
name: 'DeleteClient',
description: 'Change status of Client to disabled',
outputExample: {
},
inputs: {
Id : {required: true}
},
authenticated: true,
version: 1.0,
run: function(api, data, next){
var client = new api.MongoDB.Client({
ClientStatus: api.MongoDB.ClientStatus.Deleted
});
var query = {"_id": data.params.Id};
api.MongoDB.Client.findOneAndUpdate(query, client, {new: true}, function(err, result){
if (err) {console.log('Error on update:\n');console.log(err)};
data.response.result = result;
next();
})
}
};
exports.ForcedRemovalClient = {
name: 'ForcedRemovalClient',
description: 'Forced removal for Client, caution, can\'t restore and is needed audit.',
outputExample: {
},
inputs: {
Id : {required: true}
},
authenticated: true,
version: 1.0,
run: function(api, data, next){
api.MongoDB.Company.findOneAndRemove(data.params.Id, function(err, result){
if (err) {console.log('Error on update:\n');console.log(err)};
data.response.result = result;
next();
})
}
}; | StratosAgein/Sigma.API | API/actions/ClientController.js | JavaScript | gpl-3.0 | 4,281 |
$(function(){
var plate = new Microplate({
padding:30,
annotations: true
});
$('#test').append(plate.render())
}); | DeeSeeDee/labwarejs | example.js | JavaScript | gpl-3.0 | 121 |
$(document).ready(function() {
"use strict";
//LEFT MOBILE MENU OPEN
$(".mob-menu").on('click', function() {
$(".menu").css('left', '0px');
$(".mob-menu").fadeOut("fast");
$(".mob-close").fadeIn("20000");
});
//LEFT MOBILE MENU CLOSE
$(".mob-close").on('click', function() {
$(".mob-close").hide("fast");
$(".menu").css('left', '-92px');
$(".mob-menu").show("slow");
});
//mega menu
$(".tr-menu").hover(function() {
$(".cat-menu").fadeIn(50);
});
$(".i-head-top").mouseleave(function() {
$(".cat-menu").fadeOut("slow");
});
//PRE LOADING
$('#status').fadeOut();
$('#preloader').delay(350).fadeOut('slow');
$('body').delay(350).css({
'overflow': 'visible'
});
});
//Slider
var slideIndex = 1;
showSlides(slideIndex);
function plusSlides(n) {
showSlides(slideIndex += n);
}
function currentSlide(n) {
showSlides(slideIndex = n);
}
function showSlides(n) {
var i;
var slides = document.getElementsByClassName("mySlides");
var dots = document.getElementsByClassName("dot");
if (n > slides.length) {
slideIndex = 1
}
if (n < 1) {
slideIndex = slides.length
}
for (i = 0; i < slides.length; i++) {
slides[i].style.display = "none";
}
for (i = 0; i < dots.length; i++) {
dots[i].className = dots[i].className.replace(" active", "");
}
slides[slideIndex - 1].style.display = "block";
} | vimukthi101/StrikingSports | StrikingSports/js/custom.js | JavaScript | gpl-3.0 | 1,514 |
Ext.define('RODAdmin.view.dashboard.portlets.TraficPortlet', {
extend: 'Ext.panel.Panel',
alias: 'widget.traficportlet',
requires: [
'Ext.data.JsonStore',
'Ext.chart.theme.Base',
'Ext.chart.series.Series',
'Ext.chart.series.Line',
'Ext.chart.axis.Numeric'
],
initComponent: function(){
Ext.apply(this, {
layout: 'fit',
height: 300,
items: {
xtype: 'chart',
animate: false,
shadow: false,
store: Ext.create('RODAdmin.store.dashboard.Trafic'),
legend: {
position: 'bottom'
},
axes: [
{
type: 'Numeric',
position: 'left',
fields: ['visitors', 'visits', 'views'],
title: 'Traffic',
label: {
font: '11px Arial'
}
},
{
type: 'Category',
position: 'bottom',
fields: ['day'],
title: 'Day',
// dateFormat: 'd-M-Y',
label: {
font: '11px Arial'
}
}
],
series: [{
type: 'line',
lineWidth: 1,
showMarkers: true,
fill: true,
axis: 'left',
xField: 'day',
yField: 'visitors',
style: {
'stroke-width': 1,
stroke: 'rgb(148, 174, 10)'
}
}, {
type: 'line',
lineWidth: 1,
showMarkers: false,
axis: 'left',
xField: 'day',
yField: 'visits',
style: {
'stroke-width': 1,
stroke: 'rgb(17, 95, 166)'
},
},
{
type: 'line',
lineWidth: 1,
showMarkers: false,
fill: true,
axis: 'left',
xField: 'day',
yField: 'views',
style: {
'stroke-width': 1,
stroke: 'rgb(17, 95, 166)'
},
}
]
}
});
this.callParent(arguments);
}
});
| cosminrentea/roda | src/main/webapp/RODAdmin/app/view/dashboard/portlets/TraficPortlet.js | JavaScript | gpl-3.0 | 2,807 |
/*
@license
This file was created 2014-2015 by https://github.com/wurfmaul
and licensed under the GNU GENERAL PUBLIC LICENSE Version 3
https://gnu.org/licenses/gpl-3.0.txt
*/
(function(){$(function(){return $(".close").click(function(){return $(this).parent(".alert").hide("slow")})})}).call(this),function(){$(function(){return $.tablesorter.themes.bootstrap={table:"table table-bordered table-striped table-hover",caption:"caption",header:"bootstrap-header",sortNone:"",sortAsc:"",sortDesc:"",active:"",hover:"",icons:"",iconSortNone:"bootstrap-icon-unsorted",iconSortAsc:"glyphicon glyphicon-chevron-up",iconSortDesc:"glyphicon glyphicon-chevron-down",filterRow:"",footerRow:"",footerCells:"",even:"",odd:""},$(".table-sortable").tablesorter({theme:"bootstrap",widthFixed:!0,headerTemplate:"{content} {icon}",widgets:["uitheme","filter","zebra"],widgetOptions:{zebra:["even","odd"],filter_reset:".reset",filter_cssFilter:"form-control"}}).tablesorterPager({container:$(".ts-pager"),cssGoto:".pagenum",removeRows:!1,output:"{startRow}-{endRow} ({filteredRows})"})})}.call(this); | wurfmaul/kartulimardikas | js/index.min.js | JavaScript | gpl-3.0 | 1,085 |
var
util = require("util"),
events = require("events"),
Message = require("./message"),
zmq = require("zmq"),
_ = require("lodash"),
VERSION = "1.0",
MESSAGE_TYPE_HANDLERS = {
"HELLO": "_onHello",
"STATUS": "_onStatus",
"COMMAND": "_onCommand",
"BYE": "_onBye"
};
/*
class Sensor(options)
attributes:
methods:
* connect
* disconnect
* setValue
* getValue
* setInfo
* getInfo
events:
* disconnect
* connect
* timeout
*/
function Sensor(options) {
this.addr = options.addr;
this.key = options.key;
this.timeout = options.timeout || 10000;
}
util.inherits(Sensor, events.EventEmitter);
_.extend(Sensor.prototype, {
connect: function() {
if (this._connected) {
return;
}
this.socket = zmq.socket("req");
this.socket.on("message", this._onMessage.bind(this));
this.socket.connect(this.addr);
this._sendHello();
this._connected = true;
},
disconnect: function() {
if (!this._connected) {
return;
}
this.socket.disconnect(this.addr);
this._connected = false;
this.emit("disconnect");
},
setValue: function(value) {
this.value = value;
},
getValue: function(value) {
return this.value;
},
setInfo: function(info) {
this.info = info;
},
getInfo: function() {
return this.info;
},
_onMessage: function(buffer) {
var message = Message.decode(buffer),
method = MESSAGE_TYPE_HANDLERS[message.type];
this[method](message);
this._restartHeartbeat();
},
_onHello: function(message) {
this._sendInfo();
this.emit("connect");
},
_onStatus: function(message) {
this._sendStatus();
},
_onBye: function(message) {
},
_onTimeout: function() {
this.disconnect();
this.emit("timeout");
},
_onCommand: function(message) {
var cmd = message.data.command;
this.emit("command:" + cmd, message.data.params);
this._sendStatus();
},
_restartHeartbeat: function() {
if (this._timeoutId) {
clearTimeout(this._timeoutId);
}
this._timeoutId = setTimeout(this._onTimeout.bind(this), this.timeout);
},
_send: function(message) {
this.socket.send(message.encode());
},
_sendHello: function() {
var message = new Message("HELLO", VERSION);
this._send(message);
},
_sendStatus: function() {
var message = new Message("STATUS", {
value: this.value
});
this._send(message);
},
_sendInfo: function() {
var message = new Message("INFO", {
key: this.key,
info: this.info
});
this._send(message);
},
});
module.exports = Sensor;
| cezar-berea/celsius | lib/protocol/sensor.js | JavaScript | gpl-3.0 | 2,682 |
var TimeTools = require('../src/js/common/time.js');
describe('timeZoneTools', function() {
beforeEach(function() {
});
afterEach(function() {
});
it('should properly format the UTC offset', function() {
var tests = [
{values: {hours: 0, minutes: 0}, expected: "+00:00"},
{values: {hours: 10, minutes: 1}, expected: "+10:01"},
{values: {hours: 1, minutes: 1}, expected: "+01:01"},
{values: {hours: -1, minutes: 1}, expected: "-01:01"},
];
for (var i in tests) {
var t = tests[i];
expect(TimeTools.formatUTCOffset(t.values.hours, t.values.minutes)).toEqual(t.expected);
}
});
it('should properly pick the right timezone from offset', function() {
var tests = [
{offset: 0, expected: "Europe/London"},
{offset: -(4*3600 + 0*60), expected: "America/New_York"},
{offset: (3*3600 + 0*60), expected: "Europe/Moscow"},
{offset: (4*3600 + 30*60), expected: "Asia/Kabul"},
{offset: (0*3600 + 30*60), expected: "Chatham Islands/New Zealand"},
{offset: (24*3600 + 30*60), expected: "Chatham Islands/New Zealand"},
];
for (var i in tests) {
var t = tests[i];
expect(TimeTools.pickTimeZoneFromOffset(t.offset).name).toEqual(t.expected);
}
});
});
| snapcore/snapweb | www/tests/timeZoneSpec.js | JavaScript | gpl-3.0 | 1,270 |
// jquery.parallax.js
// @weblinc, @jsantell, (c) 2012
;(function( $ ) {
$.fn.parallax = function ( userSettings ) {
var options = $.extend( {}, $.fn.parallax.defaults, userSettings );
return this.each(function () {
var $this = $(this),
isX = options.axis === 'x',
origPos = ( $this.css( 'background-position' ) || '' ).split(' '),
origX = $this.css( 'background-position-x' ) || origPos[ 0 ],
origY = $this.css( 'background-position-y' ) || origPos[ 1 ],
dist = function () {
return -$( window )[ isX ? 'scrollLeft' : 'scrollTop' ]();
};
$this
.css( 'background-attachment', 'fixed' )
.addClass( 'inview' );
$this.bind('inview', function ( e, visible ) {
$this[ visible ? 'addClass' : 'removeClass' ]( 'inview' );
});
$( window ).bind( 'scroll', function () {
if ( !$this.hasClass( 'inview' )) { return; }
var xPos = isX ? ( dist() * options.speed ) + 'px' : origX,
yPos = isX ? origY : ( dist() * options.speed ) + 'px';
$this.css( 'background-position', xPos + ' ' + yPos );
});
});
};
$.fn.parallax.defaults = {
start: 0,
//stop: $( document ).height(),
speed: 1,
axis: 'x'
};
})( jQuery );
| helldemons/iCheap | Sources/iCheap.WebApp/assets/client/js/jquery.parallax.js | JavaScript | gpl-3.0 | 1,490 |
/*
* * ********* ********* ** ** ********* ********* ********* *********
* * * * * * * * * * * *
* * * * * * * * * * * *
* * ********* * * * * * ********* * *********
* * * * * * * * * *
* * * * * * * * ** * *
********* ********* ******** * * * ********* ** ***** *********
*/ | Usimte/usimte.github.io | assets/js/scripts_Usimte.js | JavaScript | gpl-3.0 | 645 |
// Global condition is used because some compatibility issues found with various browsers.
var globalRequestAnimationCodition;
// requestAnimationFrame() shim by Paul Irish
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
window.requestAnimFrame = (function() {
return window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame ||
window.msRequestAnimationFrame ||
function(/* function */ callback, /* DOMElement */ element){
window.setTimeout(callback, 1000 / 60);
};
})();
/**
* Behaves the same as setInterval except uses requestAnimationFrame() where possible for better performance
* @param {function} fn The callback function
* @param {int} delay The delay in milliseconds
*/
window.requestInterval = function(fn, delay) {
if( !window.requestAnimationFrame &&
!window.webkitRequestAnimationFrame &&
!(window.mozRequestAnimationFrame && window.mozCancelRequestAnimationFrame) && // Firefox 5 ships without cancel support
!window.oRequestAnimationFrame &&
!window.msRequestAnimationFrame)
return window.setInterval(fn, delay);
globalRequestAnimationCodition = true;
var start = new Date().getTime(),
handle = new Object();
function loop() {
var current = new Date().getTime(),
delta = current - start;
if(delta >= delay) {
fn.call();
start = new Date().getTime();
}
if (globalRequestAnimationCodition)
handle.value = requestAnimFrame(loop);
};
if (globalRequestAnimationCodition)
handle.value = requestAnimFrame(loop);
return handle;
};
/**
* Behaves the same as clearInterval except uses cancelRequestAnimationFrame() where possible for better performance
* @param {int|object} fn The callback function
*/
window.clearRequestInterval = function(handle) {
window.cancelAnimationFrame ? window.cancelAnimationFrame(handle.value) :
window.webkitCancelAnimationFrame ? window.webkitCancelAnimationFrame(handle.value) :
window.webkitCancelRequestAnimationFrame ? window.webkitCancelRequestAnimationFrame(handle.value) : /* Support for legacy API */
window.mozCancelRequestAnimationFrame ? window.mozCancelRequestAnimationFrame(handle.value) :
window.oCancelRequestAnimationFrame ? window.oCancelRequestAnimationFrame(handle.value) :
window.msCancelRequestAnimationFrame ? window.msCancelRequestAnimationFrame(handle.value) :
clearInterval(handle);
globalRequestAnimationCodition = false;
};
| zefferno/SnakeMadness | js/gameRequestAnimiation.js | JavaScript | gpl-3.0 | 2,563 |
export function Feature(featureType, propertyValues) {
this.featureType = featureType;
this.propertyValues = propertyValues;
}
| elkonurbaev/nine-e | src/featuremodel/Feature.js | JavaScript | gpl-3.0 | 136 |
GisClient.Redline = new Class({
initialize: function(objDiv,app) {
this.owner = app;
//NON SONO RIUSCITO A PASSARLI VIA CSS
this.annotationDiv = new Element('div',{'id':'annotationDiv','styles':{'position':'absolute','left':110,'top':220,'width':300,'height':150,'border':'2px solid #000000','visibility':'hidden','background-color':'#dddddd'}});
this.annotationTxt = new Element('textarea',{'id':'annotationTxt','styles':{'margin-left':5,'width':275,'height':100}});
var annotationSave = new Element('input',{
'id':'annotationSave',
'type':'button',
'value':GC_LABEL["Insert"],
'styles':{'margin-top':2,'margin-left':170,'width':60,'height':25}
});
annotationSave.addEvent('click',function(){this.add()}.bindWithEvent(this));
var annotationCancel = new Element('input',{
'id':'annotationCancel',
'type':'button',
'value':GC_LABEL["Cancel"],
'styles':{'margin-top':2,'margin-left':5,'width':60,'height':25}
});
annotationCancel.addEvent('click',function(){this.cancel()}.bindWithEvent(this));
this.annotationDiv.appendChild(this.annotationTxt);
this.annotationDiv.appendChild(annotationSave);
this.annotationDiv.appendChild(annotationCancel);
objDiv.appendChild(this.annotationDiv);
},
addText: function(geom){
this.geom = geom;
var x = geom.X[geom.X.length-1];
var y = geom.Y[geom.Y.length-1];
this.annotationDiv.setStyles({'visibility':'visible','left':x,'top':y-50});
this.annotationTxt.focus();
},
add: function(geom){
if(geom) this.geom = geom;
if(this.geom.X.length<2){
alert("Elemento non valido");
return;
}
this.owner.setBusy(true);
var param = {'mapset':this.owner.mapset,'action':'redline','imageWidth':this.owner.map.getWidth(),'imageHeight':this.owner.map.getHeight(),'geopixel':this.owner.geoPixel,'Xgeo':this.owner.oXgeo,'Ygeo':this.owner.oYgeo,'imgX':this.geom.X,'imgY':this.geom.Y,'imgT':this.annotationTxt.get('value')};
this.owner.setBusy(true);
this.owner.post(param);
this.cancel();
},
remove: function(){
var param = {'mapset':this.owner.mapset,'action':'redline','imageWidth':this.owner.map.getWidth(),'imageHeight':this.owner.map.getHeight(),'remove':1};
this.owner.setBusy(true);
this.owner.post(param);
},
cancel:function(){
this.annotationTxt.set('value','');
this.annotationDiv.setStyle('visibility','hidden');
this.owner.map.clear();
}
}); | gisweb/GisClient-2 | public/jslib/GisClient.Redline.js | JavaScript | gpl-3.0 | 2,403 |
(function() {
var Cli = {
_$container: $('.cli-container')
};
Cli.echo = function(value) {
Cli._$container.append(value);
};
Cli.clear = function() {
Cli._$container.empty();
};
Cli.prompt = function(callback, options) {
var defaults = {
label: '',
type: 'text'
};
options = $.extend({}, defaults, options);
$prompt = $('<div></div>').addClass('cli-prompt');
$label = $('<span></span>').addClass('cli-prompt-label').html(options.label);
$input = $('<input/>', { type: options.type });
$input.keydown(function(e) {
if (e.keyCode == 13) {
var value = $input.val();
if (options.type != 'password') {
$input.replaceWith(value);
} else {
$input.remove();
}
callback(value);
e.preventDefault();
}
});
$prompt.prepend($label).append($input);
Cli.echo($prompt);
$input.focus();
};
Cli.login = function() {
Webos.User.getLogged(function(user) {
if (user) {
Cli.displayCmdPrompt();
} else {
Cli.clear();
Cli.prompt(function(username) {
Cli.prompt(function(password) {
Webos.User.login(username, password, [function() {
Cli.displayCmdPrompt();
}, function(response) {
Cli.echo('<p>Login incorrect.</p>');
Cli.login();
}]);
}, { label: 'Password :', type: 'password' });
}, { label: 'Login :' });
}
});
};
Cli.displayCmdPrompt = function() {
if (!Cli._terminal) {
Cli._terminal = new W.Terminal();
Cli._terminal.on('echo', function(data) {
Cli.echo(data.contents);
});
}
Cli._terminal.refreshData([function() {
var data = Cli._terminal.data();
if (data.username === false) {
Cli.login();
return;
}
var label = data.username+'@'+data.host+':'+data.location+((data.root) ? '#' : '$');
Cli.prompt(function(cmd) {
if (!cmd) {
Cli.displayCmdPrompt();
return;
}
var process = Cli._terminal.enterCmd(cmd, [function() {
var onStopFn = function() {
Cli.displayCmdPrompt();
};
if (process.isRunning()) {
process.on('stop', function() {
onStopFn();
});
} else {
onStopFn();
}
}, function(response) {
Cli.displayCmdPrompt();
}]);
}, { label: label });
}, function(response) {
Cli.login();
}]);
};
Webos.Error.setErrorHandler(function(error) {
var message;
if (error instanceof Webos.Error) {
message = error.html.message;
} else {
message = error.name + ' : ' + error.message;
}
Cli.echo('<p>'+message+'</p>');
});
Cli.login();
})(); | MatiasNAmendola/gnome-web | boot/uis/cli/index.js | JavaScript | gpl-3.0 | 2,561 |
module.exports = {
bar: function(done) {
console.log('bar!');
done();
}
};
| sytac/gulp-cjs-tasks-examples | tasks/bar.js | JavaScript | gpl-3.0 | 87 |
//////////////////////////////////////////////////////////////////////////////////
// CloudCarousel V1.0.4
// (c) 2010 by R Cecco. <http://www.professorcloud.com>
// MIT License
//
// Reflection code based on plugin by Christophe Beyls <http://www.digitalia.be>
//
// Please retain this copyright header in all versions of the software
//////////////////////////////////////////////////////////////////////////////////
(function($) {
// START Reflection object.
// Creates a reflection for underneath an image.
// IE uses an image with IE specific filter properties, other browsers use the Canvas tag.
// The position and size of the reflection gets updated by updateAll() in Controller.
function Reflection(img, reflHeight, opacity) {
var reflection, cntx, imageWidth = img.width, imageHeight = img.width, gradient, parent;
parent = $(img.parentNode);
if ($.browser.msie) {
this.element = reflection = parent.append("<img class='reflection' style='position:absolute'/>").find(':last')[0];
reflection.src = img.src;
reflection.style.filter = "flipv progid:DXImageTransform.Microsoft.Alpha(opacity=" + (opacity * 100) + ", style=1, finishOpacity=0, startx=0, starty=0, finishx=0, finishy=" + (reflHeight / imageHeight * 100) + ")";
} else {
this.element = reflection = parent.append("<canvas class='reflection' style='position:absolute'/>").find(':last')[0];
if (!reflection.getContext)
{
return;
}
cntx = reflection.getContext("2d");
try {
$(reflection).attr({width: imageWidth, height: reflHeight});
cntx.save();
cntx.translate(0, imageHeight-1);
cntx.scale(1, -1);
cntx.drawImage(img, 0, 0, imageWidth, imageHeight);
cntx.restore();
cntx.globalCompositeOperation = "destination-out";
gradient = cntx.createLinearGradient(0, 0, 0, reflHeight);
gradient.addColorStop(0, "rgba(255, 255, 255, " + (1 - opacity) + ")");
gradient.addColorStop(1, "rgba(255, 255, 255, 1.0)");
cntx.fillStyle = gradient;
cntx.fillRect(0, 0, imageWidth, reflHeight);
} catch(e) {
return;
}
}
// Store a copy of the alt and title attrs into the reflection
$(reflection).attr({ 'alt': $(img).attr('alt'), title: $(img).attr('title')} );
} //END Reflection object
// START Item object.
// A wrapper object for items within the carousel.
var Item = function(imgIn, options)
{
this.orgWidth = imgIn.width;
this.orgHeight = imgIn.height;
this.image = imgIn;
this.reflection = null;
this.alt = imgIn.alt;
this.title = imgIn.title;
this.imageOK = false;
this.options = options;
this.imageOK = true;
if (this.options.reflHeight > 0)
{
this.reflection = new Reflection(this.image, this.options.reflHeight, this.options.reflOpacity);
}
$(this.image).css('position','absolute'); // Bizarre. This seems to reset image width to 0 on webkit!
};// END Item object
// Controller object.
// This handles moving all the items, dealing with mouse clicks etc.
var Controller = function(container, images, options)
{
var items = [], funcSin = Math.sin, funcCos = Math.cos, ctx=this;
this.controlTimer = 0;
this.stopped = false;
//this.imagesLoaded = 0;
this.container = container;
this.xRadius = options.xRadius;
this.yRadius = options.yRadius;
this.showFrontTextTimer = 0;
this.autoRotateTimer = 0;
if (options.xRadius === 0)
{
this.xRadius = ($(container).width()/2.3);
}
if (options.yRadius === 0)
{
this.yRadius = ($(container).height()/6);
}
this.xCentre = options.xPos;
this.yCentre = options.yPos;
this.frontIndex = 0; // Index of the item at the front
// Start with the first item at the front.
this.rotation = this.destRotation = Math.PI/2;
this.timeDelay = 1000/options.FPS;
// Turn on the infoBox
if(options.altBox !== null)
{
$(options.altBox).css('display','block');
$(options.titleBox).css('display','block');
}
// Turn on relative position for container to allow absolutely positioned elements
// within it to work.
$(container).css({ position:'relative', overflow:'hidden'} );
$(options.buttonLeft).css('display','inline');
$(options.buttonRight).css('display','inline');
// Setup the buttons.
$(options.buttonLeft).bind('mouseup',this,function(event){
event.data.rotate(-1);
return false;
});
$(options.buttonRight).bind('mouseup',this,function(event){
event.data.rotate(1);
return false;
});
// You will need this plugin for the mousewheel to work: http://plugins.jquery.com/project/mousewheel
if (options.mouseWheel)
{
$(container).bind('mousewheel',this,function(event, delta) {
event.data.rotate(delta);
return false;
});
}
$(container).bind('mouseover click',this,function(event){
clearInterval(event.data.autoRotateTimer); // Stop auto rotation if mouse over.
var text = $(event.target).attr('alt');
// If we have moved over a carousel item, then show the alt and title text.
if ( text !== undefined && text !== null )
{
clearTimeout(event.data.showFrontTextTimer);
$(options.altBox).html( ($(event.target).attr('alt') ));
$(options.titleBox).html( ($(event.target).attr('title') ));
if ( options.bringToFront && event.type == 'click' )
{
var idx = $(event.target).data('itemIndex');
var frontIndex = event.data.frontIndex;
var diff = idx - frontIndex;
event.data.rotate(-diff);
}
}
});
// If we have moved out of a carousel item (or the container itself),
// restore the text of the front item in 1 second.
$(container).bind('mouseout',this,function(event){
var context = event.data;
clearTimeout(context.showFrontTextTimer);
context.showFrontTextTimer = setTimeout( function(){context.showFrontText();},1000);
context.autoRotate(); // Start auto rotation.
});
// Prevent items from being selected as mouse is moved and clicked in the container.
$(container).bind('mousedown',this,function(event){
event.data.container.focus();
return false;
});
container.onselectstart = function () { return false; }; // For IE.
this.innerWrapper = $(container).wrapInner('<div style="width:100%;height:100%;"/>').children()[0];
// Shows the text from the front most item.
this.showFrontText = function()
{
if ( items[this.frontIndex] === undefined ) { return; } // Images might not have loaded yet.
$(options.titleBox).html( $(items[this.frontIndex].image).attr('title'));
$(options.altBox).html( $(items[this.frontIndex].image).attr('alt'));
};
this.go = function()
{
if(this.controlTimer !== 0) { return; }
var context = this;
this.controlTimer = setTimeout( function(){context.updateAll();},this.timeDelay);
};
this.stop = function()
{
clearTimeout(this.controlTimer);
this.controlTimer = 0;
};
// Starts the rotation of the carousel. Direction is the number (+-) of carousel items to rotate by.
this.rotate = function(direction)
{
this.frontIndex -= direction;
this.frontIndex %= items.length;
this.destRotation += ( Math.PI / items.length ) * ( 2*direction );
this.showFrontText();
this.go();
};
this.autoRotate = function()
{
if ( options.autoRotate !== 'no' )
{
var dir = (options.autoRotate === 'right')? 1 : -1;
this.autoRotateTimer = setInterval( function(){ctx.rotate(dir); }, options.autoRotateDelay );
}
};
// This is the main loop function that moves everything.
this.updateAll = function()
{
var minScale = options.minScale; // This is the smallest scale applied to the furthest item.
var smallRange = (1-minScale) * 0.5;
var w,h,x,y,scale,item,sinVal;
var change = (this.destRotation - this.rotation);
var absChange = Math.abs(change);
this.rotation += change * options.speed;
if ( absChange < 0.001 ) { this.rotation = this.destRotation; }
var itemsLen = items.length;
var spacing = (Math.PI / itemsLen) * 2;
//var wrapStyle = null;
var radians = this.rotation;
var isMSIE = $.browser.msie;
// Turn off display. This can reduce repaints/reflows when making style and position changes in the loop.
// See http://dev.opera.com/articles/view/efficient-javascript/?page=3
this.innerWrapper.style.display = 'none';
var style;
var px = 'px', reflHeight;
var context = this;
for (var i = 0; i<itemsLen ;i++)
{
item = items[i];
sinVal = funcSin(radians);
scale = ((sinVal+1) * smallRange) + minScale;
x = this.xCentre + (( (funcCos(radians) * this.xRadius) - (item.orgWidth*0.5)) * scale);
y = this.yCentre + (( (sinVal * this.yRadius) ) * scale);
if (item.imageOK)
{
var img = item.image;
w = img.width = item.orgWidth * scale;
h = img.height = item.orgHeight * scale;
img.style.left = x + px ;
img.style.top = y + px;
img.style.zIndex = "" + (scale * 100)>>0; // >>0 = Math.foor(). Firefox doesn't like fractional decimals in z-index.
if (item.reflection !== null)
{
reflHeight = options.reflHeight * scale;
style = item.reflection.element.style;
style.left = x + px;
style.top = y + h + options.reflGap * scale + px;
style.width = w + px;
if (isMSIE)
{
style.filter.finishy = (reflHeight / h * 100);
}else
{
style.height = reflHeight + px;
}
}
}
radians += spacing;
}
// Turn display back on.
this.innerWrapper.style.display = 'block';
// If we have a preceptable change in rotation then loop again next frame.
if ( absChange >= 0.001 )
{
this.controlTimer = setTimeout( function(){context.updateAll();},this.timeDelay);
}else
{
// Otherwise just stop completely.
this.stop();
}
}; // END updateAll
// Create an Item object for each image
// func = function(){return;ctx.updateAll();} ;
// Check if images have loaded. We need valid widths and heights for the reflections.
this.checkImagesLoaded = function()
{
var i;
for(i=0;i<images.length;i++) {
if ( (images[i].width === undefined) || ( (images[i].complete !== undefined) && (!images[i].complete) ))
{
return;
}
}
for(i=0;i<images.length;i++) {
items.push( new Item( images[i], options ) );
$(images[i]).data('itemIndex',i);
}
// If all images have valid widths and heights, we can stop checking.
clearInterval(this.tt);
this.showFrontText();
this.autoRotate();
this.updateAll();
};
this.tt = setInterval( function(){ctx.checkImagesLoaded();},50);
}; // END Controller object
// The jQuery plugin part. Iterates through items specified in selector and inits a Controller class for each one.
$.fn.CloudCarousel = function(options) {
this.each( function() {
options = $.extend({}, {
reflHeight:0,
reflOpacity:0.5,
reflGap:0,
minScale:0.5,
xPos:0,
yPos:0,
xRadius:0,
yRadius:0,
altBox:null,
titleBox:null,
FPS: 30,
autoRotate: 'no',
autoRotateDelay: 1500,
speed:0.2,
mouseWheel: false,
bringToFront: false
},options );
// Create a Controller for each carousel.
$(this).data('cloudcarousel3d', new Controller( this, $('.cloudcarousel3d',$(this)), options) );
});
return this;
};
})(jQuery); | CCChapel/ccchapel.com | CMS/CMSScripts/jquery/jquery-cloud-carousel.js | JavaScript | gpl-3.0 | 11,848 |
// Connect to the database
var knex = require('knex'),
config;
config = {
development: {
client: 'pg',
// debug: true,
connection: {
host: 'postgres',
user: 'postgres',
database: 'rosetta_development',
password: 'rosetta'
}
},
test: {
client: 'pg',
// debug: true,
connection: {
host: 'postgres',
user: 'postgres',
database: 'rosetta_test',
password: 'rosetta'
}
},
staging: {
client: 'pg',
// debug: true,
connection: process.env.DATABASE_URL
},
production: {
client: 'pg',
// debug: true,
connection: process.env.DATABASE_URL
}
};
module.exports = knex(config[process.env.NODE_ENV || 'development']);
| Rosetta-String/nodejs-koa | lib/db/index.js | JavaScript | gpl-3.0 | 849 |
/*
#
# AHPS Web - web server for managing an AtHomePowerlineServer instance
# Copyright (C) 2014, 2015 Dave Hocker (email: AtHomeX10@gmail.com)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# 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 LICENSE file for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program (the LICENSE file). If not, see <http://www.gnu.org/licenses/>.
#
*/
/*
Edit house page controller
*/
app.controller('editHouseController', function($scope, $http) {
// Initialization
$scope.title = "AHPS Web";
$scope.error = "";
$scope.message = "";
var houseid = $("#houseid").val();
get_house(houseid);
function get_house(houseid) {
$http.get('/house/' + String(houseid), {}).
success(function(data, status, headers, config) {
$scope.house = data.house;
$scope.message = "";
}).
error(function(data, status, headers, config) {
if (data && data.message) {
$scope.error = data.message;
}
else {
$scope.error = "Unable to get house";
}
});
};
$scope.save_house = function(houseid) {
$http.post('/house/' + String(houseid), {"data": $scope.house}).
success(function(data, status, headers, config) {
$scope.message = "Saved";
$scope.error = "";
}).
error(function(data, status, headers, config) {
if (data && data.message) {
$scope.error = data.message;
}
else {
$scope.error = "Unable to save house";
}
});
};
}); | dhocker/ahps_web | ahps_web/static/js/edit_house.js | JavaScript | gpl-3.0 | 2,118 |
(function() {
'use strict';
angular
.module('bloggerApp')
.controller('TagController', TagController);
TagController.$inject = ['Tag', 'TagSearch', 'ParseLinks', 'AlertService', 'paginationConstants'];
function TagController(Tag, TagSearch, ParseLinks, AlertService, paginationConstants) {
var vm = this;
vm.tags = [];
vm.loadPage = loadPage;
vm.itemsPerPage = paginationConstants.itemsPerPage;
vm.page = 0;
vm.links = {
last: 0
};
vm.predicate = 'id';
vm.reset = reset;
vm.reverse = true;
vm.clear = clear;
vm.loadAll = loadAll;
vm.search = search;
loadAll();
function loadAll () {
if (vm.currentSearch) {
TagSearch.query({
query: vm.currentSearch,
page: vm.page,
size: vm.itemsPerPage,
sort: sort()
}, onSuccess, onError);
} else {
Tag.query({
page: vm.page,
size: vm.itemsPerPage,
sort: sort()
}, onSuccess, onError);
}
function sort() {
var result = [vm.predicate + ',' + (vm.reverse ? 'asc' : 'desc')];
if (vm.predicate !== 'id') {
result.push('id');
}
return result;
}
function onSuccess(data, headers) {
vm.links = ParseLinks.parse(headers('link'));
vm.totalItems = headers('X-Total-Count');
for (var i = 0; i < data.length; i++) {
vm.tags.push(data[i]);
}
}
function onError(error) {
AlertService.error(error.data.message);
}
}
function reset () {
vm.page = 0;
vm.tags = [];
loadAll();
}
function loadPage(page) {
vm.page = page;
loadAll();
}
function clear () {
vm.tags = [];
vm.links = {
last: 0
};
vm.page = 0;
vm.predicate = 'id';
vm.reverse = true;
vm.searchQuery = null;
vm.currentSearch = null;
vm.loadAll();
}
function search (searchQuery) {
if (!searchQuery){
return vm.clear();
}
vm.tags = [];
vm.links = {
last: 0
};
vm.page = 0;
vm.predicate = '_score';
vm.reverse = false;
vm.currentSearch = searchQuery;
vm.loadAll();
}
}
})();
| arslanberk/Blogger | src/main/webapp/app/entities/tag/tag.controller.js | JavaScript | gpl-3.0 | 2,835 |
/**
* Created by nuintun on 2016/9/24.
*/
'use strict';
module.exports = {
'/contact/comment': [
{
action: 'index'
}
]
};
| GXTLW/gxt-front | routers/contact/comment.js | JavaScript | gpl-3.0 | 144 |
/**
* Cloxy Copyright (C) 2014 Christian South
* This program comes with ABSOLUTELY NO WARRANTY;
* This is free software, and you are welcome to redistribute it
* under certain conditions;
*
* DOCUMENTATION:
* SOCKS 5: http://tools.ietf.org/html/rfc1928
* SOCKS 5 Authentication: http://tools.ietf.org/html/rfc1929
* SOCKS 5 GSS-API AUTH: http://tools.ietf.org/html/rfc1961
*/
var net = require('net');
/**
* SOCKS 5 Handler
* @param {Net.Socket} socket Socket from Net.createServer connection.
*/
function SOCKS5(socket) {
/**
* Socket from server connection
* @type {Net.Socket}
*/
this.nodeNetSocket = socket;
/**
* Request address types
* @type {Object}
*/
this.addressTypes = {
ipv4: 1,
domain: 3,
ipv6: 4
};
/**
* Request auth methods
* @type {Object}
*/
this.authMethods = {
noAuth: 0,
gssApi: 1,
usernamePassword: 2
};
/**
* Request commands
* @type {Object}
*/
this.commands = {
connect: 1,
bind: 2,
udpAssociate: 3
};
}
/**
* Get the host and port from the process buffer
*
* @param {Net.Buffer} chunk Proxy buffer
* @return {Object} Object containing host and port
*/
SOCKS5.prototype.getHostAndPortFromRequestChunk = function(chunk) {
var retVal = {
host: '',
port: ''
};
portOffset = 4;
switch(chunk[3]) {
case this.addressTypes.ipv4:
retVal['host'] = [].slice.call(chunk, 4, 8).join('.');
portOffset += 4;
break;
case this.addressTypes.domain:
retVal['host'] = chunk.toString('utf8', 5, 5 + chunk[4]);
portOffset += 5+chunk[4];
break;
case this.addressTypes.ipv6:
/**
* Yeah, I know this is no where close to right... I'll figure it out later.
*/
retVal['host'] = [].slice.call(chunk, 4, 20).join('.');
portOffset += 16;
break;
}
retVal['port'] = chunk.readUInt16BE(portOffset);
return retVal;
};
/**
* Initial handshake functionality
*
* - Grab version
* - Verify version is 5
* - Get auth methods
* - Determine appropriate auth method
* - Set next appropriate response handler
* - Send response with chosen auth method
*
* @param {Net.Buffer} chunk Request sent in by client
* @return void
*/
SOCKS5.prototype.handle = function(chunk) {
/**
* Setting it up for failure...
*/
var response = Buffer(2);
response[0] = 5;
response[1] = 255;
var version = chunk[0];
/**
* This socket handler is only setup for version 5
*/
if(version !== 5) {
this.nodeNetSocket.end(response);
return;
}
var numberOfAuthMethods = chunk[1];
var selectedAuthMethod = 0;
/**
* Figure out which auth method to use - Higher is better
* TODO - This should check some sort of user setting to determine which to use and which is not a valid option.
*/
for(authMethodOffset = 2; authMethodOffset <= numberOfAuthMethods + 2; authMethodOffset++) {
if(chunk[authMethodOffset] > selectedAuthMethod) {
selectedAuthMethod = chunk[authMethodOffset];
}
}
if(selectedAuthMethod === 1) {
// Temp fix until GSS-API is implemented, sometime a long time from now.
selectedAuthMethod = 0;
}
switch(selectedAuthMethod) {
case this.authMethods.noAuth: // No authentication
this.nodeNetSocket.once('data', this.processProxyRequest.bind(this));
break;
case this.authMethods.usernamePassword: // Username and password authentication
this.nodeNetSocket.once('data', this.usernamePasswordAuth.bind(this));
break;
default:
this.nodeNetSocket.end(response);
return;
}
/**
* Tell the client what the chosen auth method will be
*/
response[1] = selectedAuthMethod;
this.nodeNetSocket.write(response);
};
/**
* Process the actual proxy connection
*
* @param {Net.Buffer} chunk Connection buffer
* @return {void}
*/
SOCKS5.prototype.processConnection = function(chunk) {
var addressAndPort = this.getHostAndPortFromRequestChunk(chunk);
var connection = net.createConnection(addressAndPort);
var response = new Buffer(chunk.length);
chunk.copy(response);
response[1] = 0;
this.nodeNetSocket.write(response);
this.nodeNetSocket.on('end', function() {
connection.removeAllListeners();
connection.end();
});
connection.on('end', function() {
this.nodeNetSocket.removeAllListeners();
this.nodeNetSocket.end();
}.bind(this));
this.nodeNetSocket.on('data', function(chunk) {
connection.write(chunk);
});
connection.on('data', function(chunk) {
this.nodeNetSocket.write(chunk);
}.bind(this));
};
/**
* Handler for the actual proxy request
*
* @param {Net.Buffer} chunk Request buffer
* @return {void}
*/
SOCKS5.prototype.processProxyRequest = function(chunk) {
switch(chunk[1]) {
case this.commands.connect:
this.processConnection(chunk);
break;
case this.commands.bind:
break;
case this.commands.udpAssociate:
break;
}
};
/**
* Authenticate a user based on username and password
*
* @param {Net.Buffer} chunk Authentication buffer
* @return {void}
*/
SOCKS5.prototype.usernamePasswordAuth = function(chunk) {
if(chunk[0] !== 1) {
// This should never happen, but you know....
this.nodeNetSocket.end();
return;
}
var userByteCount = chunk[1];
var passStart = 3 + userByteCount;
var passByteCount = chunk[2+userByteCount];
var user = chunk.toString('utf8', 2, 2 + userByteCount);
var pass = chunk.toString('utf8', passStart, passStart + passByteCount);
var response = new Buffer(2);
response[0] = 0x01;
/**
* TODO: This need to get usernames and passwords from some internal database...
*/
if(user !== 'test' || pass !== 'test') {
response[0] = 0xff;
this.nodeNetSocket.end(response);
return;
}
response[1] = 0x00;
this.nodeNetSocket.once('data', this.processProxyRequest.bind(this));
this.nodeNetSocket.write(response);
};
module.exports = SOCKS5; | csouth/cloxy | library/Handler/SOCKS5.js | JavaScript | gpl-3.0 | 6,501 |
function $(tag, attrs, styles) {
var elem = document.createElement(tag), attr;
if (attrs) {
for (attr in attrs)
elem[attr] = attrs[attr];
}
if (styles) {
for (attr in styles)
elem.style[attr] = styles[attr];
}
return elem;
}
var ajax = {
createRequest: function() {
if (window.XMLHttpRequest)
return new XMLHttpRequest();
if (window.ActiveXObject)
return new ActiveXObject("Msxml2.XMLHTTP");
return null;
},
sendQuery: function(query) {
var request = this.createRequest();
if (!request)
return null;
request.onreadystatechange = function() {
if (request.readyState != 4)
return;
if (request.status == 200) {
query.callback(request);
return;
}
var msg = request.status + " (" + request.statusText + ")";
query.callback(null, { type: "HttpError", message: msg, url: query.url });
};
var queryStr = "", arg;
for (arg in query.args) {
var value = query.args[arg];
if (!(value instanceof Array))
value = [ value ];
for (var i = 0; i < value.length; ++i) {
if (queryStr != "")
queryStr += "&";
queryStr += arg + "=" + encodeURIComponent(value[i]);
}
}
var queryUrl = query.url;
if (query.method == "GET") {
queryUrl += "?" + queryStr;
queryStr = null;
}
request.open(query.method, queryUrl, true);
if (query.method == "POST")
request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
request.send(queryStr);
return request;
}
};
var json = {
TIMEOUT: 7000, // milliseconds
id: 0,
r: {},
sendQuery: function(query) {
var id = this.id++;
this.r[id] = query;
var queryStr = "_id=" + id, arg;
for (arg in query.args) {
var value = query.args[arg];
if (!(value instanceof Array))
value = [ value ];
for (var i = 0; i < value.length; ++i)
queryStr += "&" + arg + "=" + encodeURIComponent(value[i]);
}
var queryUrl = query.url + "?" + queryStr;
var body = document.getElementsByTagName("BODY")[0];
var script = $("SCRIPT", { type: "text/javascript", src: queryUrl, charset: "utf-8" });
this.r[id].timer = window.setTimeout(
function() { json.timeout(id) }, json.TIMEOUT);
body.appendChild(script);
},
response: function(id, obj) {
var r = this.r[id];
if (r) {
delete this.r[id];
window.clearTimeout(r.timer);
r.callback(obj);
}
},
timeout: function(id) {
var r = this.r[id];
if (r) {
delete this.r[id];
r.callback(null, { type: "TimeoutError", message: "Timeout expired", url: r.url });
}
}
};
var util = {
attachEvent: function(ctrl, event, handler) {
if (ctrl.addEventListener)
ctrl.addEventListener(event, handler, false);
else if (ctrl.attachEvent)
ctrl.attachEvent("on" + event, handler);
},
detachEvent: function(ctrl, event, handler) {
if (ctrl.removeEventListener)
ctrl.removeEventListener(event, handler, false);
else if (ctrl.attachEvent)
ctrl.detachEvent("on" + event, handler);
},
selectItem: function(ctrl, value) {
ctrl.selectedIndex = -1;
var options = ctrl.options;
for (var i = 0; i < options.length; ++i) {
if (options[i].value == value) {
ctrl.selectedIndex = i;
return true;
}
}
return false;
},
extend: function(subClass, baseClass) {
function inherit() {}
inherit.prototype = baseClass.prototype;
subClass.prototype = new inherit();
subClass.prototype.constructor = subClass;
subClass.superCtor = baseClass;
subClass.superClass = baseClass.prototype;
},
_abc: [ "A-Z", "a-z", "\u0401-\u04e9" ],
isAlpha: function(ch, pos) {
var c = ch.charCodeAt(pos || 0);
for (var i = 0; i < this._abc.length; ++i) {
var r = this._abc[i];
var from = r.charCodeAt(0), to = r.charCodeAt(r.length - 1);
if (c >= from && c <= to)
return true;
}
return false;
},
htmlEncode: function(str) {
return str.replace(/&/g, "&").replace(/</g, "<").replace (/>/g, ">");
},
trim: function(str) {
return str.replace(/^\s+|\s+$/g, "");
},
setCookies: function(name, dic, days) {
var attr, value = "", sep = "";
for (attr in dic) {
value += sep + attr + "=" + dic[attr];
sep = "&";
}
var now = new Date();
var expires = new Date(now.getTime() + (days || 100) * 24 * 3600 * 1000);
document.cookie = name + "=" + escape(value) + "; path=/; expires=" + expires.toUTCString();
},
getCookies: function(name) {
var items = document.cookie.split("; ");
var dic = {};
for (var i = 0; i < items.length; ++i) {
var cookie = items[i].split("=");
if (cookie[0] != name)
continue;
var attrs = unescape(cookie[1]).split("&");
for (var j = 0; j < attrs.length; ++j) {
var pair = attrs[j].split("=");
dic[pair[0]] = unescape(pair[1] || "");
}
break;
}
return dic;
},
modalDialog: function(url, size, args, onResult) {
var left = 0, top = 0;
if (window.outerWidth) {
left = window.screenX + ((window.outerWidth - size.width) >> 1);
top = window.screenY + ((window.outerHeight - size.height) >> 1);
}
if (window.showModalDialog && navigator.userAgent.indexOf("Opera") < 0) {
var features = "dialogWidth:" + size.width + "px;dialogHeight:" + size.height + "px;scroll:no;help:no;status:no;";
if (navigator.userAgent.indexOf("Firefox") >= 0)
features += "dialogLeft:" + left + "px;dialogTop:" + top + "px;";
window.showModalDialog(url, args, features);
if (onResult)
onResult();
}
else {
var name = url.replace(/[\/\.]/g, "");
var features = "width=" + size.width + ",height=" + size.height + ",toolbar=no,status=no,menubar=no,directories=no,resizable=no";
if (left || top)
features += ",left=" + left + ",top=" + top;
window.theDlgArgs = args;
var dlg = window.open(url, name, features);
if (onResult)
dlg.onunload = onResult;
}
},
localStorage: function() {
try {
if (window.localStorage)
return window.localStorage;
if (window.globalStorage)
return window.globalStorage[document.domain];
return null;
}
catch(e) {
return null;
}
}
};
var yandex = {
json: json
}
function SpellDic(name) {
this.items = {}
if (name)
this.load(name);
this.dirty = false;
}
SpellDic.prototype.add = function(word, changeTo) {
this.items[SpellDic.norm(word)] = (changeTo || "");
this.dirty = true;
}
SpellDic.prototype.remove = function(word) {
delete this.items[SpellDic.norm(word)];
this.dirty = true;
}
SpellDic.prototype.check = function(word) {
return typeof(this.items[SpellDic.norm(word)]) != "undefined";
}
SpellDic.prototype.getChange = function(word) {
return this.items[SpellDic.norm(word)];
}
SpellDic.prototype.clear = function() {
this.items = {};
this.dirty = true;
}
SpellDic.prototype.load = function(name) {
this.storage = util.localStorage();
if (!this.storage)
return;
this.name = name;
this.setContent(String(this.storage[name] || ""));
this.dirty = false;
}
SpellDic.prototype.save = function() {
if (!this.storage)
return;
this.storage[this.name] = this.getContent();
this.dirty = false;
}
SpellDic.prototype.isDirty = function() {
return this.dirty;
}
SpellDic.prototype.setContent = function(str) {
this.items = {};
var arr = str.split("\n");
for (var i = 0; i < arr.length; ++i) {
var word = SpellDic.norm(arr[i]);
if (word)
this.items[word] = "";
}
this.dirty = true;
}
SpellDic.compare = function(a, b) {
if (a == b)
return 0;
return (a.toLowerCase() + " " + a) < (b.toLowerCase() + " " + b) ? -1 : 1;
}
SpellDic.prototype.getContent = function() {
var arr = [];
for (var word in this.items)
arr.push(word);
return arr.sort(SpellDic.compare).join("\n");
}
SpellDic.norm = function(s) {
return s.replace(/\s+/g, " ").replace(/^\s+|\s+$/g, "");
}
//////////////////////////////////////////////////////////////////////////////
//
// SpellDialog
//
function SpellDialog() {
}
SpellDialog.prototype.init = function() {
var args = { ctrls: [] };
if (window.dialogArguments)
args = window.dialogArguments;
else if (window.opener && window.opener.theDlgArgs)
args = window.opener.theDlgArgs;
else
return;
window.oncontextmenu = function() { return false; }
this.form = document.forms["form"];
this.form.onsubmit = function() { return false; }
this.form.word.origValue = "";
this.optionEmpty = this.form.suggest.options[0];
this.fragment = document.getElementById("fragment");
this.reason = document.getElementById("reason");
this.errMessages = this.getStr("spellErrors").split(":");
this.speller = new Speller(this, args);
this.session = this.speller.session;
this.speller.startCheck();
var ref = this;
this.form.word.onkeyup =
this.form.word.onmousedown = function() { ref.updateUI(); }
this.form.ignoreOnce.onclick = function() { ref.session.ignore(false); }
this.form.ignoreAll.onclick = function() { ref.session.ignore(true); }
this.form.change.onclick = function() { ref.doChange(0); }
this.form.changeAll.onclick = function() { ref.doChange(1); }
if (this.speller.userDic) {
this.form.addToDic.style.visibility = "visible";
this.form.addToDic.onclick = function() { ref.session.addToDic(); }
}
this.form.cancel.onclick = function() { ref.close(); }
this.form.suggest.ondblclick = function() { ref.doChange(2); }
this.form.undo.onclick = function() { ref.session.undo(); }
this.form.options.onclick = function() { ref.speller.optionsDialog(); }
this.form.langList.onchange = function() {
var langList = ref.form.langList;
ref.speller.setLang(langList.options[langList.selectedIndex].value);
}
}
SpellDialog.prototype.close = function() {
window.close();
}
SpellDialog.prototype.enable = function(isActive) {
for (var i = 0; i < this.form.elements.length; ++i) {
var ctrl = this.form.elements[i];
if (ctrl.name == "cancel")
continue;
ctrl.disabled = !isActive;
}
this.updateUI();
}
SpellDialog.prototype.setError = function(e) {
var errIndex = e.code < this.errMessages.length ? e.code : 0;
this.form.word.value = e.word;
this.form.word.origValue = e.word;
this.fragment.innerHTML = this.session.textDoc.getHtmlFragment(e.r);
this.reason.innerHTML = this.errMessages[errIndex] + ":";
this.form.addToDic.disabled = (e.code == Speller.REPEAT_WORD);
this.form.undo.disabled = !this.session.canUndo();
var suggest = this.form.suggest;
suggest.options.length = 0;
suggest.options.length = e.s.length;
for (var i = 0; i < e.s.length; ++i)
suggest.options[i].text = e.s[i];
if (e.s.length > 0)
suggest.selectedIndex = 0;
else
suggest.options.add(this.optionEmpty);
this.updateUI();
}
SpellDialog.prototype.clearError = function() {
this.form.word.value = "";
this.fragment.innerHTML = "";
this.reason.innerHTML = "";
this.form.suggest.options.length = 0;
}
SpellDialog.prototype.setLang = function(lang) {
return util.selectItem(this.form.langList, lang);
}
SpellDialog.prototype.doChange = function(cmd) {
var all = (cmd == 1), isOk = false;
var s = this.form.suggest;
var suggest = "";
if (s.selectedIndex >= 0)
suggest = s.options[s.selectedIndex].text;
if (cmd != 2 && this.form.word.value != this.form.word.origValue)
suggest = this.form.word.value;
for (var i = 0; i < s.options.length; ++i) {
if (s.options[i].text == suggest)
isOk = true;
}
var ref = this;
if (!isOk) {
this.session.checkWord(suggest, function(ok) {
if (!ok) {
var msg = ref.getStr("wordNotFound").replace("{0}", suggest);
if (!window.confirm(msg))
return;
}
ref.session.change(all, suggest) || ref.changeFailed(suggest);
});
return;
}
this.session.change(all, suggest) || this.changeFailed(suggest);
}
SpellDialog.prototype.updateUI = function() {
var word = this.form.word;
var changeDisabled = (word.value == word.origValue && !this.hasSuggest());
this.form.change.disabled = changeDisabled;
this.form.changeAll.disabled = changeDisabled;
var suggestDisabled = (word.value != word.origValue || !this.hasSuggest());
this.form.suggest.disabled = suggestDisabled;
}
SpellDialog.prototype.changeFailed = function(suggest) {
alert(this.getStr("changeError").replace("{0}", suggest));
}
SpellDialog.prototype.hasSuggest = function() {
var s = this.form.suggest;
return (s.options.length >= 1) && (s.options[0] != this.optionEmpty);
}
SpellDialog.prototype.getStr = function(id) {
var p = document.getElementById(id);
if (!p)
return "";
return p.innerHTML;
}
SpellDialog.prototype.stateChanged = function(isStopped) {
this.enable(isStopped);
}
SpellDialog.prototype.errorFound = function() {
this.setError(this.session.getError());
}
SpellDialog.prototype.checkCompleted = function() {
alert(this.getStr("checkComplete"));
this.speller.endCheck();
}
SpellDialog.prototype.onError = function(err) {
var msg = err.message;
switch (err.type) {
case "HttpError":
msg = "HTTP error: " + msg + "\nURL: " + err.url;
break;
case "TimeoutError":
msg = this.getStr("timeoutError") + "\nURL: " + err.url;
break;
}
alert(msg);
}
//////////////////////////////////////////////////////////////////////////////
//
// Speller
//
function Speller(dialog, args) {
this.dialog = dialog;
this.args = args;
this.initParams();
this.session = new SpellSession(dialog, args.ctrls);
if (util.localStorage()) {
this.userDic = new SpellDic("yandex.userdic")
this.session.setUserDic(this.userDic);
}
}
Speller.URL = "http://speller.yandex.net/services/spellservice.js";
Speller.MAX_TEXT_LEN = 300;
Speller.LATIN_OPTIONS = 0x0090;
Speller.REPEAT_WORD = 2;
Speller.TOO_MANY_ERRORS = 4;
Speller.START = 0;
Speller.CONTINUE = 1;
function s(value) {
return typeof(value) == "undefined" ? "" : value.toString();
}
Speller.prototype.initParams = function() {
var cookies = util.getCookies("yandex.spell");
this.params = {};
this.params.lang = this.args.lang || cookies.lang || this.args.defLang;
this.params.options = parseInt(
s(this.args.options) || s(cookies.options) || s(this.args.defOptions));
this.dialog.setLang(this.params.lang);
}
Speller.prototype.startCheck = function() {
this.doStart(Speller.START);
}
Speller.prototype.endCheck = function() {
this.dialog.close();
}
Speller.prototype.doStart = function(cmd) {
this.session.setParams(this.params);
this.session.start(cmd);
}
Speller.prototype.optionsDialog = function() {
var ref = this;
var args = { lang: this.params.lang, options: this.params.options,
recheck: false, userDicDlg: this.args.userDicDlg };
util.modalDialog("spellopt.html", this.args.optDlg, args,
function() {
var cmd = args.recheck ? Speller.START : Speller.CONTINUE;
if (ref.setParams(args) || args.recheck)
ref.doStart(cmd);
}
);
}
Speller.prototype.setLang = function(lang) {
if (this.setParams({ lang: lang, options: this.params.options }))
this.doStart(Speller.CONTINUE);
}
Speller.prototype.setParams = function(params) {
if (params.lang == this.params.lang && params.options == this.params.options)
return false;
this.params.lang = params.lang;
this.params.options = params.options;
this.dialog.setLang(params.lang);
this.saveParams();
return true
}
Speller.prototype.saveParams = function() {
this.args.lang = this.params.lang;
this.args.options = this.params.options;
util.setCookies("yandex.spell", this.params);
}
//////////////////////////////////////////////////////////////////////////////
//
// SpellSession
//
function SpellSession(listener, ctrls) {
this.listener = listener;
this.url = Speller.URL;
this.protocol = this.url.indexOf(".js") > 0 ? "json" : "xml";
this.textDoc = new TextDoc(ctrls);
this.ignoreDic = new SpellDic();
this.changeDic = new SpellDic();
this.userDic = null;
this.resetErrors();
this.params = { lang: "ru", options: 0 };
}
SpellSession.prototype.setParams = function(params) {
this.params.lang = params.lang;
this.params.options = params.options;
}
SpellSession.prototype.setUserDic = function(dic) {
this.userDic = dic;
}
SpellSession.prototype.start = function(cmd) {
var ref = this;
if (cmd == Speller.START) {
this.ignoreDic.clear();
this.changeDic.clear();
this.resetErrors();
}
else {
var e = this.getError();
if (e) {
this.errors = this.errors.slice(0, this.errorIndex);
this.docSel.endDoc = e.docIndex;
this.docSel.endPos = e.pos;
}
}
this.checkText(this.textDoc.getTexts(this.docSel),
function(results) { ref.completeCheck(results); });
}
SpellSession.prototype.completeCheck = function(results) {
this.listener.stateChanged(true);
for (var docIndex = 0; docIndex < results.length; ++docIndex) {
var errors = results[docIndex];
for (var i = 0; i < errors.length; ++i) {
var e = errors[i];
if (docIndex == 0)
e.pos += this.docSel.startPos;
e.docIndex = docIndex + this.docSel.startDoc;
if (e.code == Speller.TOO_MANY_ERRORS) {
this.docSel.endDoc = e.docIndex;
this.docSel.endPos = e.pos;
break;
}
e.r = { docIndex: e.docIndex, pos: e.pos, text: e.origWord };
this.errors.push(e);
}
}
this.nextError(0);
}
SpellSession.prototype.checkWord = function(word, callback) {
var ref = this;
this.checkText([ word ],
function(results) {
ref.listener.stateChanged(true);
callback(results[0].length == 0);
});
}
SpellSession.prototype.ignore = function(all) {
var error = this.getError();
if (!error)
return;
if (all) {
var dic = this.ignoreDic;
error.undo = function() { dic.remove(error.word); }
this.ignoreDic.add(error.word);
}
this.nextError(1);
}
SpellSession.prototype.change = function(all, suggest) {
var error = this.getError();
if (!this.changeText(error.r, suggest))
return false;
if (all) {
var dic = this.changeDic;
error.undo = function() { dic.remove(error.word); }
this.changeDic.add(error.word, suggest);
}
this.nextError(1);
return true;
}
SpellSession.prototype.addToDic = function() {
var error = this.getError();
if (!this.userDic || !error || error.code == Speller.REPEAT_WORD)
return false;
var dic = this.userDic;
dic.add(error.word);
dic.save();
error.undo = function() { dic.remove(error.word); dic.save(); }
this.nextError(1);
return true;
}
SpellSession.prototype.undo = function() {
while (this.errorIndex > 0) {
var error = this.errors[this.errorIndex - 1];
var word = error.word;
if (word != error.r.text) {
if (!this.changeText(error.r, word))
return false;
}
--this.errorIndex;
if (error.undo) {
error.undo();
error.undo = null;
}
if (this.ignoreDic.check(word) || this.changeDic.check(word))
continue;
break;
}
var error = this.getError();
this.textDoc.select(error.r);
this.listener.errorFound();
}
SpellSession.prototype.canUndo = function() {
return this.errorIndex > 0;
}
SpellSession.prototype.getError = function() {
if (this.errorIndex >= this.errors.length)
return null;
return this.errors[this.errorIndex];
}
SpellSession.prototype.nextError = function(skip) {
this.errorIndex += skip;
for (; this.errorIndex < this.errors.length; ++this.errorIndex) {
var error = this.errors[this.errorIndex];
var isRepeat = (error.code == Speller.REPEAT_WORD);
if (this.ignoreDic.check(error.word))
continue;
if (this.changeDic.check(error.word)) {
var change = this.changeDic.getChange(error.word);
if (this.changeText(error.r, change))
continue;
}
if (!isRepeat && this.userDic && this.userDic.check(error.word))
continue;
this.textDoc.select(error.r);
this.listener.errorFound();
return;
}
if (this.docSel.endDoc < this.textDoc.length) {
this.start(Speller.CONTINUE);
return;
}
this.listener.checkCompleted();
}
SpellSession.prototype.resetErrors = function() {
this.errors = [];
this.errorIndex = 0;
this.docSel = { startDoc: 0, startPos: 0, endDoc: 0, endPos: 0 };
}
SpellSession.prototype.changeText = function(r, text) {
if (!this.textDoc.change(r, text))
return false;
this.updateRanges(r, text);
return true;
}
SpellSession.prototype.updateRanges = function(r, text) {
var diff = text.length - r.text.length;
for (var i = 0; i < this.errors.length; ++i) {
var e = this.errors[i].r;
if (e.docIndex != r.docIndex)
continue;
if (e.pos > r.pos)
e.pos += diff;
if (e.pos == r.pos)
e.text = text;
}
if (this.docSel.endDoc == r.docIndex)
this.docSel.endPos += diff;
}
SpellSession.prototype.parseResult = function(xml) {
var results = [];
var resultNodes = xml.getElementsByTagName("SpellResult");
for (var i = 0; i < resultNodes.length; ++i) {
var errors = [];
var resultNode = resultNodes[i];
var errorNodes = resultNode.getElementsByTagName("error");
for (var j = 0; j < errorNodes.length; ++j) {
var errorNode = errorNodes[j];
var error = {
code: parseInt(errorNode.getAttribute("code")),
pos: parseInt(errorNode.getAttribute("pos")),
len: parseInt(errorNode.getAttribute("len")),
word: errorNode.getElementsByTagName("word")[0].firstChild.nodeValue
};
var sNodes = errorNode.getElementsByTagName("s");
var s = [];
for (var k = 0; k < sNodes.length; ++k)
s.push(sNodes[k].firstChild.nodeValue);
error.s = s;
errors.push(error);
}
results.push(errors);
}
return results;
}
SpellSession.prototype.onResponse = function(query, result, error) {
if (error) {
this.listener.onError(error);
return;
}
if (this.protocol == "xml")
result = this.parseResult(result.responseXML);
this.setOrigWords(result, query.args.text);
query.complete(result);
}
SpellSession.prototype.checkText = function(text, complete) {
var ref = this;
var lang = this.params.lang;
var options = this.params.options;
if (lang == "en")
options &= ~Speller.LATIN_OPTIONS;
else if ((options & Speller.LATIN_OPTIONS) == 0)
lang += ";en"
this.listener.stateChanged(false);
var args = { lang: lang, options: options, text: text };
var query = { complete: complete, args: args, url: this.url + "/checkTexts",
callback: function(result, error) { ref.onResponse(query, result, error) }};
if (this.protocol == "json") {
json.sendQuery(query);
}
else {
query.method = "POST";
ajax.sendQuery(query);
}
}
SpellSession.prototype.setOrigWords = function(results, text) {
for (var i = 0; i < results.length; ++i) {
var t = text[i].split("\n");
var errors = results[i];
for (var j = 0; j < errors.length; ++j) {
var e = errors[j];
e.origWord = t[e.row].substr(e.col, e.len);
}
}
}
//////////////////////////////////////////////////////////////////////////////
//
// TextDoc
//
function TextDoc(ctrls) {
this.ctrls = [];
for (var i = 0; i < ctrls.length; ++i)
this.ctrls[i] = ctrls[i];
this.length = this.ctrls.length;
}
TextDoc.prototype.getTexts = function(docSel) {
var texts = [], textLen = 0, maxLen = Speller.MAX_TEXT_LEN;
docSel.startDoc = docSel.endDoc;
docSel.startPos = docSel.endPos;
for (var i = docSel.startDoc; i < this.ctrls.length; ++i) {
var text = "", len = 0;
for (;;) {
text = this.ctrls[i].value.substr(docSel.endPos);
len = text.length;
if (textLen + len <= maxLen)
break;
if (textLen > 0)
return texts;
var seps = "\n \t|,;";
var leftPos = 0, rightPos = text.length;
for (var j = 0; j < seps.length; ++j) {
var s = seps.charAt(j);
if (s == "|") {
if (leftPos > 0)
break;
continue;
}
leftPos = Math.max(leftPos, (s + text).lastIndexOf(s, maxLen));
rightPos = Math.min(rightPos, (text + s).indexOf(s));
}
if ((len = leftPos) > 0)
break;
docSel.startPos = (docSel.endPos += rightPos);
}
docSel.endDoc = i; docSel.endPos += len;
if (len == 0 && texts.length == 0) { // Not to insert "" as 1st element
docSel.startDoc = docSel.endDoc = i + 1;
docSel.startPos = docSel.endPos = 0;
continue;
}
texts.push(text.substr(0, len)); textLen += len;
if (len != text.length)
break;
docSel.endDoc = i + 1; docSel.endPos = 0;
}
return texts;
}
TextDoc.prototype.select = function(pos) {
var ctrl = this.ctrls[pos.docIndex];
var range = TextDoc.createRange(ctrl);
if (!range.select(pos))
return null;
return range;
}
TextDoc.prototype.change = function(pos, changeTo) {
var r = this.select(pos);
if (!r)
return false;
r.setText(changeTo);
return true;
}
TextDoc.prototype.getHtmlFragment = function(pos, fragmentLen) {
fragmentLen = fragmentLen || 150;
var endPos = pos.pos + pos.text.length;
var text = this.ctrls[pos.docIndex].value;
var leftPos = text.lastIndexOf("\n", pos.pos) + 1;
var rightPos = (text + "\n").indexOf("\n", endPos);
var selected = text.substring(pos.pos, endPos);
var left = text.substring(leftPos, pos.pos);
var right = text.substring(endPos, rightPos);
return util.htmlEncode(TextDoc.truncStr(left, 70, -1))
+ "<WBR>" + util.htmlEncode(selected).fontcolor("red").bold()
+ util.htmlEncode(TextDoc.truncStr(right, 200));
}
TextDoc.createRange = function(ctrl) {
if (ctrl.createTextRange)
return new TextRange(ctrl);
return new CtrlRange(ctrl);
}
TextDoc.truncStr = function(str, len, dir) {
if (str.length <= len)
return str;
if (dir && dir < 0) {
var pos = str.lastIndexOf(" ", str.length - len);
if (pos >= 0)
str = "..." + str.substr(pos);
}
else {
var pos = str.indexOf(" ", len);
if (pos >= 0)
str = str.substr(0, pos + 1) + "...";
}
return str;
}
function TextRange(ctrl) {
this.ctrl = ctrl;
this.r = null;
}
TextRange.prototype.select = function(pos) {
var r = this.ctrl.createTextRange();
var text = this.ctrl.value + "\n", off = 0;
while (off < pos.pos) {
var nextOff = text.indexOf("\n", off);
if (nextOff >= pos.pos)
break;
var len = nextOff - off;
if (len > 0 && text.substr(nextOff - 1, 1) == "\r")
--len;
r.move("character", len);
r.moveEnd("character", 1);
if (r.text == "\r")
r.moveEnd("character", 1);
r.collapse(false);
off = nextOff + 1;
}
r.move("character", pos.pos - off);
r.moveEnd("character", pos.text.length);
if (r.text != pos.text)
return false;
r.select();
this.r = r;
return true;
}
TextRange.prototype.setText = function(text) {
this.r.text = text;
}
function CtrlRange(ctrl) {
this.ctrl = ctrl;
}
CtrlRange.prototype.select = function(pos) {
var valueText = this.ctrl.value.substr(pos.pos, pos.text.length);
if (valueText != pos.text)
return false;
this.pos = pos.pos;
this.len = pos.text.length;
return true;
}
CtrlRange.prototype.setText = function(text) {
var v = this.ctrl.value;
this.ctrl.value = v.substr(0, this.pos) + text + v.substr(this.pos + this.len);
}
//////////////////////////////////////////////////////////////////////////////
//
// SpellOptDialog
//
function SpellOptDialog() {
this.args = { lang: "ru", options: 0 };
if (window.dialogArguments)
this.args = window.dialogArguments;
else if (window.opener && window.opener.theDlgArgs)
this.args = window.opener.theDlgArgs;
}
SpellOptDialog.OPTIONS = [
[ "ignoreUppercase", 0x0001, -1 ],
[ "ignoreDigits", 0x0002, -1 ],
[ "ignoreUrls", 0x0004, -1 ],
[ "findRepeat", 0x0008, -1 ],
[ "latin", 0x0010, 0 ],
[ "latin", 0x0080, 1 ]
];
SpellOptDialog.prototype.init = function() {
var ref = this;
window.oncontextmenu = function() { return false; }
this.form = document.forms["form"];
this.form.userDic.onclick = function() { ref.userDicDialog(); }
this.form.userDic.disabled = !util.localStorage();
this.form.ok.onclick = function() { ref.onOk(); window.close(); }
this.form.cancel.onclick = function() { window.close(); }
this.form.langList.onchange = function() { ref.updateUI(); }
for (var i = 0; i < 3; ++i)
this.form.latin[i].onclick = function() { ref.updateUI(); return true; }
this.initParams();
this.setLang(this.params.lang);
this.setOptions(this.params.options);
if (typeof(this.args.recheck) != "boolean") {
document.getElementById("recheck").style.visibility = "hidden";
document.getElementById("labelRecheck").style.visibility = "hidden";
}
}
function s(value) {
return typeof(value) == "undefined" ? "" : value.toString();
}
SpellOptDialog.prototype.initParams = function() {
var cookies = util.getCookies("yandex.spell"), a = this.args;
this.params = {};
this.params.lang = a.lang || cookies.lang || a.defLang;
this.params.options = parseInt(s(a.options) || s(cookies.options) || s(a.defOptions) || "0");
}
SpellOptDialog.prototype.setOptions = function(options) {
this.form["latin"][2].checked = true;
for (var i = 0; i < SpellOptDialog.OPTIONS.length; ++i) {
var o = SpellOptDialog.OPTIONS[i], name = o[0], value = o[1];
var ctrl = this.form[name];
if (o[2] >= 0)
ctrl = ctrl[o[2]];
ctrl.checked = ((options & value) != 0);
}
this.updateUI();
}
SpellOptDialog.prototype.setLang = function(lang) {
util.selectItem(this.form.langList, lang);
this.updateUI();
}
SpellOptDialog.prototype.getOptions = function() {
var options = 0;
for (var i = 0; i < SpellOptDialog.OPTIONS.length; ++i) {
var o = SpellOptDialog.OPTIONS[i], name = o[0], value = o[1];
var ctrl = this.form[name];
if (o[2] >= 0)
ctrl = ctrl[o[2]];
if (ctrl.checked)
options |= value;
}
return options;
}
SpellOptDialog.prototype.getLang = function() {
var langList = this.form.langList;
if (langList.selectedIndex < 0)
return "";
return langList.options[langList.selectedIndex].value;
}
SpellOptDialog.prototype.updateUI = function() {
var lang = this.getLang();
this.enableGroup("groupLatin", lang != "en");
this.form.latinLang.disabled = (lang == "en" || !this.form.latin[2].checked);
}
SpellOptDialog.prototype.enableGroup = function(id, enable) {
var groupRoot = document.getElementById(id);
var tags = ["INPUT", "SELECT", "LABEL"];
for (var i = 0; i < tags.length; ++i) {
var ctrls = groupRoot.getElementsByTagName(tags[i]);
for (var j = 0; j < ctrls.length; ++j)
ctrls[j].disabled = !enable;
}
}
SpellOptDialog.prototype.onOk = function() {
this.args.lang = this.getLang();
this.args.options = this.getOptions();
this.args.recheck = this.form["recheck"].checked;
util.setCookies("yandex.spell", this.params);
}
SpellOptDialog.prototype.userDicDialog = function() {
util.modalDialog("userdic.html", this.args.userDicDlg, {});
}
function UserDicDialog() {
this.userDic = new SpellDic("yandex.userdic");
this.dicContent = this.userDic.getContent();
this.closed = false;
}
UserDicDialog.prototype.init = function() {
var ref = this;
this.form = document.forms["form"];
this.form.dic.value = this.dicContent;
this.form.ok.onclick = function() { ref.end(1); window.close(); }
window.onbeforeunload = function() { ref.end(-1); }
window.onunload = function() { ref.end(-1); }
window.oncontextmenu = function() { return false; }
}
UserDicDialog.prototype.end = function(save) {
if (this.closed)
return;
var dicValue = this.form.dic.value.replace(/\r/g, "");
if (this.dicContent == dicValue)
save = 0;
if (save < 0) {
var msg = document.getElementById("saveDic").innerHTML;
save = window.confirm(msg) ? 1 : 0;
}
if (save) {
this.userDic.setContent(dicValue);
this.userDic.save();
}
this.closed = true;
}
| MaemoWorld/MaemoWorld.ru | source/forum/extensions/fancy_spellcheck/js/spellchecker_yandex.js | JavaScript | gpl-3.0 | 35,218 |
"use strict";
var controllers = require('./lib/controllers'),
SocketPlugins = require.main.require('./src/socket.io/plugins'),
defaultComposer = require.main.require('nodebb-plugin-composer-default'),
plugins = module.parent.exports,
meta = module.parent.require('./meta'),
async = module.parent.require('async'),
winston = module.parent.require('winston'),
plugin = {};
plugin.init = function(data, callback) {
var router = data.router,
hostMiddleware = data.middleware,
hostControllers = data.controllers;
router.get('/admin/plugins/composer-redactor', hostMiddleware.admin.buildHeader, controllers.renderAdminPage);
router.get('/api/admin/plugins/composer-redactor', controllers.renderAdminPage);
// Expose the default composer's socket method calls for this composer as well
plugin.checkCompatibility(function(err, checks) {
if (checks.composer) {
SocketPlugins.composer = defaultComposer.socketMethods;
} else {
winston.warn('[plugin/composer-redactor] Another composer plugin is active! Please disable all other composers.');
}
});
callback();
}
plugin.checkCompatibility = function(callback) {
async.parallel({
active: async.apply(plugins.getActive),
markdown: async.apply(meta.settings.get, 'markdown')
}, function(err, data) {
callback(null, {
markdown: data.active.indexOf('nodebb-plugin-markdown') === -1 || data.markdown.html === 'on',
// ^ plugin disabled ^ HTML sanitization disabled
composer: data.active.filter(function(plugin) {
return plugin.startsWith('nodebb-plugin-composer-') && plugin !== 'nodebb-plugin-composer-redactor';
}).length === 0
})
});
};
plugin.addAdminNavigation = function(header, callback) {
header.plugins.push({
route: '/plugins/composer-redactor',
icon: 'fa-edit',
name: 'Redactor (Composer)'
});
callback(null, header);
};
module.exports = plugin; | havasnewyork/nodebb-plugin-composer-redactor | library.js | JavaScript | gpl-3.0 | 1,879 |
/**
build MediaWidget HTML IFrame
*** Inserting the iframe from this script instead of including it as a template
** allows us to display it only in forms using rich text fields, as markitup
* is the default widget.
*/
function generate_widget() {
media_iframe = $('<iframe></iframe>');
media_iframe.attr('src',"/media_widget/embed/new/picture"); //TODO(NumericA) {% url ... %}
media_iframe.attr('width',"100%");
media_iframe.attr('height',"100%");
media_iframe.attr('frameborder',"0");
media_iframe.css("min-height", "480px");
div_iframe = $('<div id="media_iframe"></div>');
div_iframe.html(media_iframe);
return div_iframe;
}
function insert_media_iframe(){
widget = generate_widget();
$('body').append(widget);
}
// on first load insert media-widget.html
$(function(){
insert_media_iframe();
});
// on close re-load widget
function refresh_widget(selector){
selector += " iframe";
media_iframe = $(selector);
src = media_iframe.attr('src');
media_iframe.attr('src', src); // reload iframe
}
/**
*** jQuery-UI Widgets declaration
*/
/**Pictures Upload Widget*/
$.widget("cyclope.picturesWidget", $.ui.dialog, {
options: {
autoOpen: false,
modal: true,
title: gettext('Article images'),
minWidth: 531,
minHeight: 571,
closeText: "Cerrar"
},
position: function(objt){
this.options.position = {my: "left top", at: "right bottom", of: objt, collision: "fit"}
}
});
var pictures_widget;
//bindings
$(function(){
//form becomes widget
$('#pictures_iframe').picturesWidget({
close: function(event, ui){ return refresh_widget('#pictures_iframe'); },
});
// picture button triggers widget
$("#media_widget").on('click', "#media_widget_button", function(){
pictures_widget = $("#pictures_iframe").picturesWidget("position", this).picturesWidget("open");
});
});
/**Embedded Media Widget*/
$.widget("cyclope.mediaWidget", $.ui.dialog, {
options: {
autoOpen: false,
modal: true,
title: gettext('Embed multimedia content'),
minWidth: 470,
minHeight: 480,
closeText: gettext("Cerrar")
},
position: function(objt){
this.options.position = {my: "left top", at: "right bottom", of: objt, collision: "fit"}
},
fb_helper: false,
});
//bindings
$(function(){
$("#media_iframe").mediaWidget({
// bind dialog close callback to widget's iframe refresh
close: function( event, ui ) { return refresh_widget("#media_iframe"); },
});
});
// trigger is fired by markitup
| CodigoSur/cyclope | cyclope/apps/media_widget/static/media_widget/cyclope_media_widget.js | JavaScript | gpl-3.0 | 2,639 |
/**
* adventureSystem.js
*
* It's an improved bankheist, basically.
*
* Viewers can start/join an adventure using the commands.
* A random story will then bee chosen from the available stories.
* This means this heist can have more than one story, in fact it can have pretty much
* an infinite amount of different locations, events etc...
*
* When a user joins the adventure the module will check if
* the Tamagotchi module is active and attempt to retrieve the user's tamagotchi.
* If the user owns a tamagotchi and it's feeling good enough it wil join
* the adventure with it's own entry of half of its owner's bet.
* If the tamagotchi survives it wil then give it's price to it's owner.
*/
(function() {
var joinTime = $.getSetIniDbNumber('adventureSettings', 'joinTime', 60),
coolDown = $.getSetIniDbNumber('adventureSettings', 'coolDown', 900),
gainPercent = $.getSetIniDbNumber('adventureSettings', 'gainPercent', 30),
minBet = $.getSetIniDbNumber('adventureSettings', 'minBet', 10),
maxBet = $.getSetIniDbNumber('adventureSettings', 'maxBet', 1000),
enterMessage = $.getSetIniDbBoolean('adventureSettings', 'enterMessage', false),
warningMessage = $.getSetIniDbBoolean('adventureSettings', 'warningMessage', false),
tgFunIncr = 1,
tgExpIncr = 0.5,
tgFoodDecr = 0.25,
currentAdventure = 1,
stories = [],
moduleLoaded = false,
lastStory;
function reloadAdventure () {
joinTime = $.getIniDbNumber('adventureSettings', 'joinTime');
coolDown = $.getIniDbNumber('adventureSettings', 'coolDown');
gainPercent = $.getIniDbNumber('adventureSettings', 'gainPercent');
minBet = $.getIniDbNumber('adventureSettings', 'minBet');
maxBet = $.getIniDbNumber('adventureSettings', 'maxBet');
enterMessage = $.getIniDbBoolean('adventureSettings', 'enterMessage');
warningMessage = $.getIniDbBoolean('adventureSettings', 'warningMessage');
};
/**
* @function loadStories
*/
function loadStories() {
var storyId = 1,
chapterId,
lines;
stories = [];
for (storyId; $.lang.exists('adventuresystem.stories.' + storyId + '.title'); storyId++) {
lines = [];
for (chapterId = 1; $.lang.exists('adventuresystem.stories.' + storyId + '.chapter.' + chapterId); chapterId++) {
lines.push($.lang.get('adventuresystem.stories.' + storyId + '.chapter.' + chapterId));
}
stories.push({
game: ($.lang.exists('adventuresystem.stories.' + storyId + '.game') ? $.lang.get('adventuresystem.stories.' + storyId + '.game') : null),
title: $.lang.get('adventuresystem.stories.' + storyId + '.title'),
lines: lines,
});
}
$.consoleDebug($.lang.get('adventuresystem.loaded', storyId - 1));
};
/**
* @function top5
*/
function top5() {
var payoutsKeys = $.inidb.GetKeyList('adventurePayouts', ''),
temp = [],
counter = 1,
top5 = [],
i;
if (payoutsKeys.length == 0) {
$.say($.lang.get('adventuresystem.top5.empty'));
}
for (i in payoutsKeys) {
if (payoutsKeys[i].equalsIgnoreCase($.ownerName) || payoutsKeys[i].equalsIgnoreCase($.botName)) {
continue;
}
temp.push({
username: payoutsKeys[i],
amount: parseInt($.inidb.get('adventurePayouts', payoutsKeys[i])),
});
}
temp.sort(function(a, b) {
return (a.amount < b.amount ? 1 : -1);
});
for (i in temp) {
if (counter <= 5) {
top5.push(counter + '. ' + temp[i].username + ': ' + $.getPointsString(temp[i].amount));
counter++;
}
}
$.say($.lang.get('adventuresystem.top5', top5.join(', ')));
};
/**
* @function checkUserAlreadyJoined
* @param {string} username
* @returns {boolean}
*/
function checkUserAlreadyJoined(username) {
var i;
for (i in currentAdventure.users) {
if (currentAdventure.users[i].username == username) {
return true;
}
}
return false;
};
/**
* @function adventureUsersListJoin
* @param {Array} list
* @returns {string}
*/
function adventureUsersListJoin(list) {
var temp = [],
i;
for (i in list) {
temp.push($.username.resolve(list[i].username));
}
return temp.join(', ');
};
/**
* @function calculateResult
*/
function calculateResult() {
var i;
for (i in currentAdventure.users) {
if ($.randRange(0, 20) > 5) {
currentAdventure.survivors.push(currentAdventure.users[i]);
} else {
currentAdventure.caught.push(currentAdventure.users[i]);
}
}
};
/**
* @function replaceTags
* @param {string} line
* @returns {string}
*/
function replaceTags(line) {
if (line.indexOf('(caught)') > -1) {
if (currentAdventure.caught.length > 0) {
return line.replace('(caught)', adventureUsersListJoin(currentAdventure.caught));
} else {
return '';
}
}
if (line.indexOf('(survivors)') > -1) {
if (currentAdventure.survivors.length > 0) {
return line.replace('(survivors)', adventureUsersListJoin(currentAdventure.survivors));
} else {
return '';
}
}
return line
};
/**
* @function inviteTamagotchi
* @param {string} username
* @param {Number} bet
*/
function inviteTamagotchi(username, bet) {
if ($.bot.isModuleEnabled('./games/tamagotchi.js')) {
//noinspection JSUnresolvedVariable,JSUnresolvedFunction
var userTG = $.tamagotchi.getByOwner(username);
if (userTG) {
//noinspection JSUnresolvedFunction
if (userTG.isHappy()) {
//noinspection JSUnresolvedFunction
userTG
.incrFunLevel(tgFunIncr)
.incrExpLevel(tgExpIncr)
.decrFoodLevel(tgFoodDecr)
.save();
$.say($.lang.get('adventuresystem.tamagotchijoined', userTG.name));
currentAdventure.users.push({
username: userTG.name,
tgOwner: username,
bet: (bet / 2),
});
} else {
//noinspection JSUnresolvedFunction
userTG.sayFunLevel();
}
}
}
};
/**
* @function startHeist
* @param {string} username
*/
function startHeist(username) {
currentAdventure.gameState = 1;
var t = setTimeout(function() {
runStory();
}, joinTime * 1e3);
$.say($.lang.get('adventuresystem.start.success', $.resolveRank(username), $.pointNameMultiple));
};
/**
* @function joinHeist
* @param {string} username
* @param {Number} bet
* @returns {boolean}
*/
function joinHeist(username, bet) {
if (currentAdventure.gameState > 1) {
if (!warningMessage) return;
$.say($.whisperPrefix(username) + $.lang.get('adventuresystem.join.notpossible'));
return;
}
if (checkUserAlreadyJoined(username)) {
if (!warningMessage) return;
$.say($.whisperPrefix(username) + $.lang.get('adventuresystem.alreadyjoined'));
return;
}
if (bet > $.getUserPoints(username)) {
if (!warningMessage) return;
$.say($.whisperPrefix(username) + $.lang.get('adventuresystem.join.needpoints', $.getPointsString(bet), $.getPointsString($.getUserPoints(username))));
return;
}
if (bet < minBet) {
if (!warningMessage) return;
$.say($.whisperPrefix(username) + $.lang.get('adventuresystem.join.bettoolow', $.getPointsString(bet), $.getPointsString(minBet)));
return;
}
if (bet > maxBet) {
if (!warningMessage) return;
$.say($.whisperPrefix(username) + $.lang.get('adventuresystem.join.bettoohigh', $.getPointsString(bet), $.getPointsString(maxBet)));
return;
}
if (currentAdventure.gameState == 0) {
startHeist(username);
} else {
if (enterMessage) {
$.say($.whisperPrefix(username) + $.lang.get('adventuresystem.join.success', $.getPointsString(bet)));
}
}
currentAdventure.users.push({
username: username,
bet: parseInt(bet),
});
$.inidb.decr('points', username, bet);
inviteTamagotchi(username, bet);
return true;
};
/**
* @function runStory
*/
function runStory() {
var progress = 0,
temp = [],
story,
line,
t;
currentAdventure.gameState = 2;
calculateResult();
for (var i in stories) {
if (stories[i].game != null) {
if (($.twitchcache.getGameTitle() + '').toLowerCase() == stories[i].game.toLowerCase()) {
//$.consoleLn('gamespec::' + stories[i].title);
temp.push({title: stories[i].title, lines: stories[i].lines});
}
} else {
//$.consoleLn('normal::' + stories[i].title);
temp.push({title: stories[i].title, lines: stories[i].lines});
}
}
do {
story = $.randElement(temp);
} while (story == lastStory);
$.say($.lang.get('adventuresystem.runstory', story.title, currentAdventure.users.length));
t = setInterval(function() {
if (progress < story.lines.length) {
line = replaceTags(story.lines[progress]);
if (line != '') {
$.say(line.replace(/\(game\)/g, $.twitchcache.getGameTitle() + ''));
}
} else {
endHeist();
clearInterval(t);
}
progress++;
}, 5e3);
};
/**
* @function endHeist
*/
function endHeist() {
var i, pay, username, maxlength = 0;
var temp = [];
for (i in currentAdventure.survivors) {
if (currentAdventure.survivors[i].tgOwner) {
currentAdventure.survivors[i].username = currentAdventure.survivors[i].tgOwner;
}
pay = (currentAdventure.survivors[i].bet * (gainPercent / 100));
$.inidb.incr('adventurePayouts', currentAdventure.survivors[i].username, pay);
$.inidb.incr('adventurePayoutsTEMP', currentAdventure.survivors[i].username, pay);
$.inidb.incr('points', currentAdventure.survivors[i].username, currentAdventure.survivors[i].bet + pay);
}
for (i in currentAdventure.survivors) {
username = currentAdventure.survivors[i].username;
maxlength += username.length();
temp.push($.username.resolve(username) + ' (+' + $.getPointsString($.inidb.get('adventurePayoutsTEMP', currentAdventure.survivors[i].username)) + ')');
}
if (temp.length == 0) {
$.say($.lang.get('adventuresystem.completed.no.win'));
} else if (((maxlength + 14) + $.channelName.length) > 512) {
$.say($.lang.get('adventuresystem.completed.win.total', currentAdventure.survivors.length, currentAdventure.caught.length)); //in case too many people enter.
} else {
$.say($.lang.get('adventuresystem.completed', temp.join(', ')));
}
clearCurrentAdventure();
temp = "";
$.coolDown.set('adventure', false, coolDown, false);
};
/**
* @function clearCurrentAdventure
*/
function clearCurrentAdventure() {
currentAdventure = {
gameState: 0,
users: [],
tgOwners: [],
survivors: [],
caught: [],
}
$.inidb.RemoveFile('adventurePayoutsTEMP');
};
/**
* @event command
*/
$.bind('command', function(event) {
var sender = event.getSender().toLowerCase(),
command = event.getCommand(),
args = event.getArgs(),
action = args[0],
actionArg1 = args[1],
actionArg2 = args[2];
/**
* @commandpath adventure - Adventure command for starting, checking or setting options
* @commandpath adventure [amount] - Start/join an adventure
*/
if (command.equalsIgnoreCase('adventure')) {
if (!action) {
$.say($.whisperPrefix(sender) + $.lang.get('adventuresystem.adventure.usage', $.pointNameMultiple));
return;
}
if (!isNaN(parseInt(action))) {
joinHeist(sender, parseInt(action));
return;
}
/**
* @commandpath adventure top5 - Announce the top 5 adventurers in the chat (most points gained)
*/
if (action.equalsIgnoreCase('top5')) {
top5();
}
/**
* @commandpath adventure set - Base command for controlling the adventure settings
*/
if (action.equalsIgnoreCase('set')) {
if (actionArg1 === undefined || actionArg2 === undefined) {
$.say($.whisperPrefix(sender) + $.lang.get('adventuresystem.set.usage'));
return;
}
/**
* @commandpath adventure set jointime [seconds] - Set the join time
*/
if (actionArg1.equalsIgnoreCase('joinTime')) {
if (isNaN(parseInt(actionArg2))) {
$.say($.whisperPrefix(sender) + $.lang.get('adventuresystem.set.usage'));
return;
}
joinTime = parseInt(actionArg2);
$.inidb.set('adventureSettings', 'joinTime', parseInt(actionArg2));
}
/**
* @commandpath adventure set cooldown [seconds] - Set cooldown time
*/
if (actionArg1.equalsIgnoreCase('coolDown')) {
if (isNaN(parseInt(actionArg2))) {
$.say($.whisperPrefix(sender) + $.lang.get('adventuresystem.set.usage'));
return;
}
coolDown = parseInt(actionArg2);
$.inidb.set('adventureSettings', 'coolDown', parseInt(actionArg2));
}
/**
* @commandpath adventure set gainpercent [value] - Set the gain percent value
*/
if (actionArg1.equalsIgnoreCase('gainPercent')) {
if (isNaN(parseInt(actionArg2))) {
$.say($.whisperPrefix(sender) + $.lang.get('adventuresystem.set.usage'));
return;
}
gainPercent = parseInt(actionArg2);
$.inidb.set('adventureSettings', 'gainPercent', parseInt(actionArg2));
}
/**
* @commandpath adventure set minbet [value] - Set the minimum bet
*/
if (actionArg1.equalsIgnoreCase('minBet')) {
if (isNaN(parseInt(actionArg2))) {
$.say($.whisperPrefix(sender) + $.lang.get('adventuresystem.set.usage'));
return;
}
minBet = parseInt(actionArg2);
$.inidb.set('adventureSettings', 'minBet', parseInt(actionArg2));
}
/**
* @commandpath adventure set maxbet [value] - Set the maximum bet
*/
if (actionArg1.equalsIgnoreCase('maxBet')) {
if (isNaN(parseInt(actionArg2))) {
$.say($.whisperPrefix(sender) + $.lang.get('adventuresystem.set.usage'));
return;
}
maxBet = parseInt(actionArg2);
$.inidb.set('adventureSettings', 'maxBet', parseInt(actionArg2));
}
/**
* @commandpath adventure set warningmessages [true / false] - Sets the per-user warning messages
*/
if (actionArg1.equalsIgnoreCase('warningmessages')) {
if (args[2].equalsIgnoreCase('true')) warningMessage = true, actionArg2 = $.lang.get('common.enabled');
if (args[2].equalsIgnoreCase('false')) warningMessage = false, actionArg2 = $.lang.get('common.disabled');
$.inidb.set('adventureSettings', 'warningMessage', warningMessage);
}
/**
* @commandpath adventure set entrymessages [true / false] - Sets the per-user entry messages
*/
if (actionArg1.equalsIgnoreCase('entrymessages')) {
if (args[2].equalsIgnoreCase('true')) enterMessage = true, actionArg2 = $.lang.get('common.enabled');
if (args[2].equalsIgnoreCase('false')) enterMessage = false, actionArg2 = $.lang.get('common.disabled');
$.inidb.set('adventureSettings', 'enterMessage', enterMessage);
}
$.say($.whisperPrefix(sender) + $.lang.get('adventuresystem.set.success', actionArg1, actionArg2));
}
}
});
/**
* @event initReady
*/
$.bind('initReady', function() {
if ($.bot.isModuleEnabled('./games/adventureSystem.js')) {
clearCurrentAdventure();
if (!moduleLoaded) {
loadStories();
moduleLoaded = true;
}
$.registerChatCommand('./games/adventureSystem.js', 'adventure', 7);
$.registerChatSubcommand('adventure', 'set', 1);
}
});
/**
* Warn the user if the points system is disabled and this is enabled.
*/
if ($.bot.isModuleEnabled('./games/adventureSystem.js') && !$.bot.isModuleEnabled('./systems/pointSystem.js')) {
$.log.warn("Disabled. ./systems/pointSystem.js is not enabled.");
}
$.reloadAdventure = reloadAdventure;
})();
| MrAdder/PhantomBot | javascript-source/games/adventureSystem.js | JavaScript | gpl-3.0 | 18,976 |
/*
Copyright 2011 Emilis Dambauskas
This file is part of ObjectFS-core package.
ObjectFS-core 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.
ObjectFS-core 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 ObjectFS-core. If not, see <http://www.gnu.org/licenses/>.
*/
/*
Command-line input handler for objectfs-core/ofs-pkg module.
*/
// Requirements:
var ofs_pkg = require("./ofs-pkg");
// Exports:
export(
"main",
"showHelp",
"showVersion",
"showError",
"search",
"show",
"install",
"remove",
"update",
"upgrade");
// --- Main: -----------------------------------------------------------------
if (require.main === module) {
main(system.args);
}
/**
*
*/
function main(args) {
var script_path = args.shift();
if (args.length === 0) {
showHelp();
} else {
var cmd = args.shift();
switch (cmd) {
// Shell option passed to RingoJS:
case "-i":
if (args.length) {
args.unshift(script_path);
main(args);
}
print("ObjectFS (RingoJS) shell.");
break;
case "-h":
showHelp();
break;
case "-v":
showVersion();
break;
case "search":
for each (var item in search(args)) {
print(item.name, "\t\t", item.description);
}
break;
case "show":
print(JSON.stringify(show(args)));
break;
case "install":
return install(args);
break;
case "remove":
return remove(args);
break;
case "update":
return update(args);
break;
case "upgrade":
return upgrade(args);
break;
default:
showError("Unknown command '" + cmd + "'", args);
}
}
}
// --- Helpers: --------------------------------------------------------------
/**
*
*/
function showHelp() {
print("Usage: ofs-pkg [OPTIONS] [COMMAND [ARGUMENTS]]");
print("\nOptions:");
print(" -h Show this help");
print(" -v Print version number and exit");
print("\nCommands:");
print(" search Show package list.");
print(" search PATTERN Show packages containing string in names and descriptions");
print(" show PKGNAME Show information about the package");
print(" install PKGNAME [PKGNAME2...] Install package(s)");
print(" remove PKGNAME [PKGNAME2...] Remove package(s)");
print(" update [PKGNAME [PKGNAME2..]] Update package(s)");
print(" upgrade [PKGNAME [PKGNAME2..]] Upgrade package(s)");
print("");
}
/**
*
*/
function showVersion() {
print("ObjectFS Package manager DEVELOPMENT VERSION");
}
/**
*
*/
function showError(msg, args) {
print("ERROR:", msg);
}
//--- Commands: --------------------------------------------------------------
/**
*
*/
function search(args) {
return ofs_pkg.search(args[0]);
}
/**
*
*/
function show(args) {
return ofs_pkg.show(args[0]);
}
/**
*
*/
function install(args) {
return ofs_pkg.install(args);
}
/**
*
*/
function remove(args) {
return ofs_pkg.remove(args);
}
/**
*
*/
function update(args) {
return ofs_pkg.update(args);
}
/**
*
*/
function upgrade(args) {
return ofs_pkg.upgrade(args);
}
| emilis/objectfs-core | lib/run-ofs-pkg.js | JavaScript | gpl-3.0 | 4,007 |
(function(a){a.commands.bold={exec:function(b,c){return a.commands.formatInline.exec(b,c,"b")},state:function(b,c){return a.commands.formatInline.state(b,c,"b")},value:function(){}}})(wysihtml5);
| floss-bush/adsh | plugins/Neatline/views/shared/javascripts/libraries/wysihtml5/src/commands/bold.js | JavaScript | gpl-3.0 | 196 |
var random = require('randomstring');
var fs = require('fs');
var randomString = random.generate(10);
fs.appendFile('docs/sw.js', '// ' + randomString, (err) => {
if (err) throw err;
console.log('New service worker created!');
});
| Heydon/beadz-drum-machine | cachebust-sw.js | JavaScript | gpl-3.0 | 237 |
InsiderApp.factory('$localstorage', function () {
if (typeof (Storage) == "undefined") {
console.log("browser does not support Web Storage...");
}
return {
set: function (key, value) {
localStorage[key] = value;
},
get: function (key, defaultValue) {
return localStorage[key] || defaultValue;
},
setObject: function (key, value) {
localStorage[key] = JSON.stringify(value);
},
getObject: function (key) {
return JSON.parse(localStorage[key] || '{}');
}
}
}); | AlbertHambardzumyan/NTNU | Sentiment Analysis & Recommender System Application/front/js/app/services/storage.js | JavaScript | gpl-3.0 | 594 |
function ConferenceViews(){
// todo build classroom model
}
| omnipotentuser/openstream | app/assets/js/conference/views.js | JavaScript | gpl-3.0 | 64 |
import React, { Fragment, useState, useEffect } from 'react';
import { FaTrophy } from 'react-icons/fa';
import _ from 'lodash';
import Button from './Button';
import DashboardPanel from './DashboardPanel';
import DashboardPanelEmpty from './DashboardPanelEmpty';
import DashboardTournament from './DashboardTournament';
import EmptyTournaments from './EmptyTournaments';
import Skeleton from './Skeleton';
const DashboardTournaments = ({
fetching,
loaded,
tournaments: tournamentsProp,
}) => {
const [tournaments, setTournaments] = useState([]);
const empty = _.isEmpty(tournaments);
useEffect(() => {
setTournaments(tournamentsProp.data);
}, [tournamentsProp]);
return (
<DashboardPanel title="Tournaments" icon={<FaTrophy />}>
{fetching && <Skeleton type="tournament" count={6} />}
{!fetching && empty && (
<DashboardPanelEmpty
image={<EmptyTournaments />}
title="Uh-oh.. No tourneys to watch"
subtitle={
<Fragment>
Follow your favorite teams and games
<br />
to catch the latest tournaments
</Fragment>
}
action={{ href: '/games', title: 'Add Games' }}
/>
)}
{loaded && !empty && (
<Fragment>
{tournaments.map(tournament => (
<DashboardTournament
tournament={tournament}
key={tournament.id}
setTournaments={setTournaments}
/>
))}
<Button
variant="full"
style={{ height: 64, fontSize: 16 }}
href="/tournaments"
>
View All Tournaments
</Button>
</Fragment>
)}
</DashboardPanel>
);
};
export default DashboardTournaments;
| turntwogg/final-round | components/DashboardTournaments.js | JavaScript | gpl-3.0 | 1,800 |
/*
* Simple Gmail Notes
* https://github.com/walty8
* Copyright (C) 2015 Walty Yeung <walty8@gmail.com>
*/
/*** call back implementation for content-common.js ***/
sendBackgroundMessage = function(message) {
browser.runtime.sendMessage(message, function(response){
debugLog("Message response", response);
});
}
setupBackgroundEventsListener = function(callback) {
browser.runtime.onMessage.addListener(
function(request, sender, sendResponse) {
callback(request);
}
)
}
var isDebugCache = null
isDebug = function(callback){
if(isDebugCache === null)
isDebugCache = browser.runtime.getManifest().version == "0.0.1";
return isDebugCache;
}
var extensionID = browser.runtime.id;
getIconBaseUrl = function(){
return browser.extension.getURL("image");
}
function addScript(scriptPath){
var j = document.createElement('script');
j.src = browser.extension.getURL(scriptPath);
j.async = false;
j.defer = false;
(document.head || document.documentElement).appendChild(j);
}
/*** end of callback implementation ***/
//initalization
/*
document.addEventListener('DOMContentLoaded',
function(){
appendDebugInfo("DOMContentLoaded");
fireContentLoadedEvent();
},
false
);
*/
$(document).ready(function(){
appendDebugInfo("documentReady");
fireContentLoadedEvent();
})
| walty8/simple-gmail-notes.firefox-web-extension | content.js | JavaScript | gpl-3.0 | 1,427 |
'use strict';
import gulp from 'gulp';
import uglify from 'gulp-uglify';
import closure from 'gulp-closure';
import sass from 'gulp-sass';
import cssnano from 'gulp-cssnano';
import rename from 'gulp-rename';
import concat from 'gulp-concat';
import cache from 'gulp-cache';
import imagemin from 'gulp-imagemin';
import htmlmin from 'gulp-htmlmin';
import sourcemaps from 'gulp-sourcemaps';
import gIf from 'gulp-if';
import manifest from 'gulp-manifest';
import swig from 'gulp-swig';
import browserSync from 'browser-sync';
import transform from 'vinyl-transform';
import source from 'vinyl-source-stream';
import buffer from 'vinyl-buffer';
import browserify from 'browserify';
import babelify from 'babelify';
import riotify from 'riotify';
import del from 'del';
import rs from 'run-sequence';
const SRC_ROOT_DIR = 'src/';
const SRC_APP_DIR = SRC_ROOT_DIR + 'app/';
const SRC_APP_ENTRY = SRC_APP_DIR + 'app.js';
const SRC_LIB_DIR = SRC_ROOT_DIR + 'lib/';
const SRC_TAGS_DIR = SRC_ROOT_DIR + 'tags/';
const SRC_STYLES_DIR = SRC_ROOT_DIR + 'styles/';
const SRC_STYLES_ENTRY = SRC_STYLES_DIR + 'app.scss';
const SRC_IMAGES_DIR = SRC_ROOT_DIR + 'images/';
const DIST_ROOT_DIR = './dist/'
const DIST_IMAGES_DIR = DIST_ROOT_DIR + 'images/';
const DIST_BUNDLE = 'app.min.js';
const DIST_HTML_MANIFEST_FILENAME = 'app.manifest';
const WEB_PORT = 9000;
const MANIFEST = {
name: 'Web app starter',
short_name: 'WAS',
description: 'Starter kit for riot based webapp',
manifest_json_filename: 'manifest.json',
manifest_webapp_filename: 'manifest.webapp',
apple_touch_icon: {
src: 'images/icons/touch/apple-touch-icon-152x152.png',
size: '152',
sizes: '152x152',
type: 'image/png'
},
chrome_touch_icon: {
src: 'images/icons/touch/chrome-touch-icon-192x192.png',
size: '192',
sizes: '192x192',
type: 'image/png'
},
ms_touch_icon: {
src: 'images/icons/touch/ms-touch-icon-144x144.png',
size: '144',
sizes: '144x144',
type: 'image/png'
},
icons: [{
src: 'images/icons/touch/icon-128x128.png',
size: '128',
sizes: '128x128',
type: 'image/png'
}],
start_url: '.',
display: 'standalone',
background_color: '#000000',
theme_color: '#000000'
}
let dev = true;
let bs = browserSync.create();
function errorHandler(error) {
console.log(error);
}
gulp.task('clean', () => {
return del([DIST_ROOT_DIR]);
});
gulp.task('root', () => {
return gulp.src([
SRC_ROOT_DIR + '*',
'!' + SRC_ROOT_DIR + '*.swi',
'!' + SRC_APP_DIR,
'!' + SRC_LIB_DIR,
'!' + SRC_TAGS_DIR,
'!' + SRC_STYLES_DIR,
'!' + SRC_IMAGES_DIR,
])
.pipe(gulp.dest(DIST_ROOT_DIR));
});
gulp.task('index', () => {
return gulp.src(SRC_ROOT_DIR + 'index.html.swi')
.pipe(swig({data: MANIFEST}))
.pipe(rename('index.html'))
//.pipe(htmlmin({collapseWhitespace: true}))
.pipe(gulp.dest(DIST_ROOT_DIR));
});
gulp.task('webapp-manifests', () => {
return gulp.src([
SRC_ROOT_DIR + MANIFEST.manifest_webapp_filename + '.swi',
SRC_ROOT_DIR + MANIFEST.manifest_json_filename + '.swi'
])
.pipe(swig({data: MANIFEST}))
.pipe(rename((path) => {
path.extname = '';
}))
.pipe(gulp.dest(DIST_ROOT_DIR));
})
gulp.task('images', () => {
return gulp.src(SRC_IMAGES_DIR + '**/*.{png,jpg,svg}')
.pipe(cache(imagemin({
progressive: true,
interlaced: true
})))
.pipe(gulp.dest(DIST_IMAGES_DIR));
});
gulp.task('styles', (cb) => {
return gulp.src(SRC_STYLES_ENTRY)
.pipe(gIf(dev, sourcemaps.init()))
.pipe(sass())
.pipe(rename((path) => {
path.extname = '.min.css';
}))
.pipe(cssnano({autoprefixer: {browsers: 'last 2 versions', add: true}}))
.pipe(gIf(dev, sourcemaps.write('./')))
.pipe(gulp.dest(DIST_ROOT_DIR));
});
gulp.task('browserify', () => {
let b = browserify({
entries: [SRC_APP_ENTRY],
debug: dev,
});
b.transform(babelify);
b.transform(riotify);
return b.bundle().on('error', errorHandler)
.pipe(source(DIST_BUNDLE))
.pipe(buffer())
.pipe(gIf(dev, sourcemaps.init({loadMaps: true})))
.pipe(closure())
.pipe(gIf(dev, sourcemaps.write('./')))
.pipe(gulp.dest(DIST_ROOT_DIR));
});
gulp.task('bundle', (cb) => {
rs('clean', ['root', 'index', 'webapp-manifests', 'images', 'styles', 'browserify'], cb);
});
gulp.task('serve', () => {
bs.init({
server: {
baseDir: DIST_ROOT_DIR
},
port: WEB_PORT,
})
});
gulp.task('reload', () => {
return bs.reload();
})
gulp.task('watch-index', (cb) => {
rs('index', 'reload', cb);
});
gulp.task('watch-images', (cb) => {
rs('images', 'reload', cb);
});
gulp.task('watch-styles', (cb) => {
rs('styles', 'reload', cb);
});
gulp.task('watch-browserify',(cb) => {
rs('browserify', 'reload', cb);
});
gulp.task('watch', () => {
gulp.watch([SRC_ROOT_DIR + 'index.html.swi'], ['watch-index']);
gulp.watch([SRC_IMAGES_DIR + '**/*.{png,jpg,svg}'], ['watch-images']);
gulp.watch([SRC_STYLES_DIR + '**/*.scss'], ['watch-styles']);
gulp.watch([SRC_APP_DIR + '**/*.{js,tag}', SRC_LIB_DIR + '**/*.js'], ['watch-browserify']);
});
gulp.task('html-manifest', () => {
return gulp.src(DIST_ROOT_DIR + '**/*')
.pipe(manifest({
hash: true,
preferOnline: true,
network: ['*'],
filename: DIST_HTML_MANIFEST_FILENAME,
exclude: DIST_HTML_MANIFEST_FILENAME,
timestamp: true
}))
.pipe(gulp.dest('dist'));
});
gulp.task('dev', (cb) => {
rs('bundle', cb);
});
gulp.task('serve-dev', (cb) => {
rs('dev', 'serve', 'watch', cb);
});
gulp.task('dist', () => {
dev = false;
rs('bundle', 'manifest');
});
gulp.task('serve-dist', () => {
dev = false;
rs('bundle', 'html-manifest', 'serve');
});
gulp.task('default', ['serve-dev']);
| kgeorgy/webapp-starter | gulpfile.babel.js | JavaScript | gpl-3.0 | 5,794 |
// Developed originally By Steve Faulkner 2003/2004
// steven.faulkner@nils.org.au
// modified by jim thatcher jim@jimthatcher.com 2005
// modified by Susanne Taylor 2010-11
function startFrames(myDocument){
//Instead of window. for global
//we use aA. so that we don't have
//variables that might get mixed in
//with site-level js
var aA = [];
// keep track of alt tags for each frame
aA.frames = [];
//counting variables
aA.cth=0; // number of table headers
aA.csu=0; // number of summaries
aA.cro=0; // number of roles found JT
aA.ccap=0; // number of captions
aA.cother=0; // number of id, header or scope attributes
//for id of added spans
//so we can removed them
aA.idi=0;
//for frames outside domain
//so we can report them
aA.framemsg='';
aA.fi=0;
//recursive through frames
aA = checkFrames(myDocument,aA);
//reporting
provideMessage(aA);
}
function checkFrames(myDocument,aA){
//run tables check for current document which might
//have tables or (i)frames or both
aA = DataTables(myDocument,aA);
//run checkFrames for each frame's document if there
//are any frames
var frametypes=new Array('frame','iframe');
for (var x=0;x<frametypes.length;x++) {
var myframes=myDocument.getElementsByTagName(frametypes[x]);
for (var y=0;y<myframes.length;y++) {
try {
//alert('in try');
checkFrames(myframes[y].contentWindow.document,aA);
} catch(e) {
//errors are stored in aA too
aA.framemsg=aA.framemsg + '\n' + myframes[y].src;
aA.fi=aA.fi + 1;
}
}
}
return aA;
}
function DataTables(myDocument, aA){
var cta = 0;
//create object to check the length of properties array
var jt_generic_obj = myDocument.createElement("var");
var jt_ie7 = false;
if (jt_generic_obj.attributes.length > 0) {
jt_ie7 = true;
}
//remove anything added last time this favelet ran
var myExpress1 = /tablesAdded.*/;
var addedElements = new Array('span','br');
// divlive and div don't contain divs!
for (var g=0;g<addedElements.length;g++) {
var divLive=myDocument.getElementsByTagName(addedElements[g]);
//static (divs won't change - don't use divLive while editing page)
var divs = [];
for (var i=0; i<divLive.length;i++) {
divs[i] = divLive[i];
}
for (var s=0;s<divs.length;s++) {
if (((jt_ie7 && divs[s].attributes && divs[s].attributes.id.specified) || (!(jt_ie7) && divs[s].hasAttribute('id'))) && myExpress1.test(divs[s].getAttribute('id'))) {
divs[s].parentNode.removeChild(divs[s]);
}
}
}
var t=myDocument.getElementsByTagName('table');
//var c=new Array('#df0000', '#000080', '#007c00', '#bb00af', '#a8590e')
var c=new Array('#000099');
var cx=0;
var s=myDocument.getElementsByTagName('th');
var u=myDocument.getElementsByTagName('td');
var cap=myDocument.getElementsByTagName('caption');
// if tables are found ...
if (t.length!==0) {
// create template span element that holds the messages
var messpan = myDocument.createElement('span');
// default is navy
messpan.style.color="navy";
messpan.style.fontFamily="arial,sans-serif";
messpan.style.fontSize="x-small";
messpan.style.fontWeight="bold";
messpan.style.backgroundColor="#ffefd5";
messpan.style.padding="1px";
messpan.style.border="1px solid navy";
var str, cx;
cx=-1;
// COUNT the tables
cta=cta+t.length;
// DECORATE the tables. COUNT summaries.
for (var i=0;i<t.length;i++) { // mark out tables
str='';
cx=(cx+1)%5;
// alert(t[i].hasAttribute('summary'));
if ((jt_ie7 && t[i].attributes.summary.specified) || (!(jt_ie7) && t[i].hasAttribute('summary'))) {
str=' summary=\"'+t[i].summary+'\"';
aA.csu++;
}
// JT added for role - suspect role.specified not valid in ie7
// alert(t[i].hasAttribute('role'));
if ((jt_ie7 && t[i].attributes.role.specified) || (!(jt_ie7) && t[i].hasAttribute('role'))) {
str=str+' role=\"'+t[i].getAttribute('role')+'\"';
aA.cro++;
}
// label table
var tableinfo = messpan.cloneNode(true);
tableinfo.id="tablesAdded" + (aA.idi++);
tableinfo.appendChild(myDocument.createTextNode('[table'+str+']'));
tableinfo.style.color=c[cx];
// put break just before table
var tbr = myDocument.createElement('br');
tbr.id="tablesAdded" + (aA.idi++);
t[i].parentNode.insertBefore(tbr,t[i]);
// put info between table and break
t[i].parentNode.insertBefore(tableinfo,t[i]);
// outline table
void(t[i].style.border='2px dashed navy');
t[i].outerHTML = t[i].outerHTML + '<span style=\'padding:1px;border:1px solid navy;color:navy;background-color:#ffefd5; font-family:arial,sans-serif; font-size:x-small; font-weight:bold \'>[/table]</span>';
}
// COUNT the captions
aA.ccap=aA.ccap+cap.length;
// DECORATE the captions
// **** Cannot modify outerHTML of caption.
for (var i=0;i<cap.length;i++) { // mark out captions
var capBefore = messpan.cloneNode(true);
capBefore.id="tablesAdded" + (aA.idi++);
var capAfter = messpan.cloneNode(true);
capAfter.id="tablesAdded" + (aA.idi++);
//capBefore.style.fontWeight="bold";
//capAfter.style.fontWeight="bold";
capBefore.appendChild(document.createTextNode('[caption]'));
capAfter.appendChild(document.createTextNode('[/caption]'));
// insertBefore the first item in the caption
if (cap[i].childNodes.length>0) {
cap[i].insertBefore(capBefore,cap[i].childNodes[0]);
} else {
cap[i].appendChild(capBefore);
}
// append to the list of items in the caption
cap[i].appendChild(capAfter);
void(cap[i].style.border='2px dashed #000000');
}
// COUNT the table headers
aA.cth=aA.cth+s.length;
// DECORATE the table headers. COUNT attributes.
for (var i=0;i<s.length;i++) {
str='';
//TH's scope, id, headers, axis
if ((jt_ie7 && s[i].attributes.scope.specified) || (!(jt_ie7) && s[i].hasAttribute('scope'))) {
str=' scope=\"'+s[i].scope+'\"';
aA.cother++;
}
if ((jt_ie7 && s[i].attributes.id.specified) || (!(jt_ie7) && s[i].hasAttribute('id'))) {
str=str+' id=\"'+s[i].id+'\"';
aA.cother++;
}
if ((jt_ie7 && s[i].attributes.headers.specified) || (!(jt_ie7) && s[i].hasAttribute('headers'))) {
str=str+' headers=\"'+s[i].headers+'\"';
aA.cother++;
}
if ((jt_ie7 && s[i].attributes.axis.specified) || (!(jt_ie7) && s[i].hasAttribute('axis'))) {
str=str+' axis=\"'+s[i].axis+'\"';
aA.cother++;
}
var THinfo = messpan.cloneNode(true);
THinfo.id="tablesAdded" + (aA.idi++);
THinfo.appendChild(document.createTextNode('[th'+str+']'));
// put br just before th contents
var thbr = myDocument.createElement('br');
thbr.id="tablesAdded" + (aA.idi++);
if (s[i].childNodes.length>0) {
s[i].insertBefore(thbr,s[i].childNodes[0]);
} else {
s[i].appendChild(thbr);
}
// now we know it isn't empty!
// put label just before first item in th (which is now br)
s[i].insertBefore(THinfo,s[i].childNodes[0]);
void(s[i].style.border='1px dotted #d2691e');
}
// DECORATE td cells. COUNT attributes.
for (var i=0;i<u.length;i++) {
str='';
//TD's scope, id, headers, axis
if ((jt_ie7 && u[i].attributes.scope.specified) || (!(jt_ie7) && u[i].hasAttribute('scope'))) {
str=' scope=\"'+u[i].scope+'\"';
aA.cother++;
}
if ((jt_ie7 && u[i].attributes.id.specified) || (!(jt_ie7) && u[i].hasAttribute('id'))) {
str=str+' id=\"'+u[i].id+'\"';
aA.cother++;
}
if ((jt_ie7 && u[i].attributes.headers.specified) || (!(jt_ie7) && u[i].hasAttribute('headers'))) {
str=str+' headers=\"'+u[i].headers+'\"';
aA.cother++;
}
if ((jt_ie7 && u[i].attributes.axis.specified) || (!(jt_ie7) && u[i].hasAttribute('axis'))) {
str=str+' axis=\"'+u[i].axis+'\"';
aA.cother++;
}
// only write to td cell if the cell has attributes
//if (str!='') {
var TDinfo = messpan.cloneNode(true);
TDinfo.id="tablesAdded" + (aA.idi++);
TDinfo.appendChild(document.createTextNode('[td'+str+']'));
// put br just before th contents
var tdbr = myDocument.createElement('br');
tdbr.id="tablesAdded" + (aA.idi++);
if (u[i].childNodes.length>0) {
u[i].insertBefore(tdbr,u[i].childNodes[0]);
} else {
u[i].appendChild(tdbr);
}
// now we know it isn't empty!
// put label just before first item in td (which is now br)
u[i].insertBefore(TDinfo,u[i].childNodes[0]);
void(u[i].style.border='1px dotted #d2691e');
//}
}
}
var oFrame = {src:myDocument.location, cta:cta};
aA.frames.push(oFrame);
//Return argument array
return aA;
}
function provideMessage(aA) {
var msg = '';
var noTblsFound = 'No table elements found';
for (var i = 0; i < aA.frames.length; i++) {
if (aA.frames[i].cta === 0) {
if (aA.frames.length == 1) {
msg += noTblsFound;
} else {
if (i>0 && msg !== '') { msg += '\n\n'; }
msg += aA.frames[i].src + '\n' + noTblsFound;
}
}
}
// standard
if (msg !== '') { alert(msg); }
}
startFrames(document);
//1-7-2011
// Added Frame Traversal
//1-8-2011
// How things are added to the page updated
// to work on more browsers
// Colors updated for contrast
// Clear old added elements second time favelet runs
// Dashed td outlines changed to dotted TD outlines
| Section508Coordinators/a11ybookmarklets | DataTables.js | JavaScript | gpl-3.0 | 11,113 |
$(document).ready(function() {
$("#add-car-submit").click(function() {
var carAddForm = {}
carAddForm["model"] = $("#car-model-input").val();
carAddForm["description"] = $("#car-description-input").val();
carAddForm["carMake"] = $("#car-make-select").val();
$.ajax({
type : "POST",
contentType : "application/json",
url : "/car/add",
data : JSON.stringify(carAddForm),
dataType : 'json',
timeout : 100000,
success : function(data) {
console.log("SUCCESS: ", data);
display(data);
},
error : function(e) {
console.log("ERROR: ", e);
display(e);
},
done : function(e) {
console.log("DONE");
}
});
});
}); | neptunezxn/spring-boot-demo | src/main/resources/static/js/add-car.js | JavaScript | gpl-3.0 | 853 |
angular.module('retro').service('Party', ($q, Battle) => {
const defer = $q.defer();
let party = '';
let socketRef = null;
const update = (newParty) => {
if(party) {
party.updateChannel.unsubscribe();
party.updateChannel.unwatch();
socketRef.unsubscribe(`party:${party._id}`);
party.battleChannel.unsubscribe();
party.battleChannel.unwatch();
socketRef.unsubscribe(`party:${party._id}:battle`);
if(!newParty) {
party.updateChannel.destroy();
party.battleChannel.destroy();
}
}
party = newParty;
if(party) {
party.updateChannel = socketRef.subscribe(`party:${party._id}`);
party.battleChannel = socketRef.subscribe(`party:${party._id}:battle`);
party.battleChannel.watch(Battle.set);
}
defer.notify(party);
};
return {
observer: defer.promise,
apply: () => {
defer.notify(party);
},
setSocket: (socket) => socketRef = socket,
set: update,
get: () => party
};
}); | reactive-retro/retro-app | src/js/services/containers/party.js | JavaScript | gpl-3.0 | 1,171 |
var assert = require('assert');
var expect = require('chai').expect;
var plugin = require('./vpcNetworkLogging');
const createCache = (err, data, adata) => {
return {
metrics: {
list: {
'global': {
err: err,
data: data
}
}
},
alertPolicies: {
list: {
'global': {
err: err,
data: adata
}
}
}
}
};
describe('vpcNetworkLogging', function () {
describe('run', function () {
it('should give passing result if no metrics are found', function (done) {
const callback = (err, results) => {
expect(results.length).to.be.above(0);
expect(results[0].status).to.equal(2);
expect(results[0].message).to.include('No log metrics found');
expect(results[0].region).to.equal('global');
done()
};
const cache = createCache(
null,
[],
[]
);
plugin.run(cache, {}, callback);
});
it('should give passing result if no alert policies are found', function (done) {
const callback = (err, results) => {
expect(results.length).to.be.above(0);
expect(results[0].status).to.equal(2);
expect(results[0].message).to.include('No log alert policies found');
expect(results[0].region).to.equal('global');
done()
};
const cache = createCache(
null,
['data'],
[]
);
plugin.run(cache, {}, callback);
});
it('should give passing result if log alert for vpc network changes are enabled', function (done) {
const callback = (err, results) => {
expect(results.length).to.be.above(0);
expect(results[0].status).to.equal(0);
expect(results[0].message).to.include('Log alert for VPC network changes is enabled');
expect(results[0].region).to.equal('global');
done()
};
const cache = createCache(
null,
[
{
"name": "vpcNetworkLogging",
"description": "Ensure log metric filter and alerts exists for Project Ownership assignments/changes",
"filter": "resource.type=gce_network AND jsonPayload.event_subtype=\"compute.networks.insert\" OR jsonPayload.event_subtype=\"compute.networks.patch\" OR jsonPayload.event_subtype=\"compute.networks.delete\" OR jsonPayload.event_subtype=\"compute.networks.removePeering\" OR jsonPayload.event_subtype=\"compute.networks.addPeering\"",
"metricDescriptor": {
"name": "projects/rosy-red-12345/metricDescriptors/logging.googleapis.com/user/vpcNetworkLogging",
"metricKind": "DELTA",
"valueType": "INT64",
"unit": "1",
"description": "Ensure log metric filter and alerts exists for Project Ownership assignments/changes",
"type": "logging.googleapis.com/user/vpcNetworkLogging"
},
"createTime": "2019-11-07T02:11:39.940887528Z",
"updateTime": "2019-11-07T19:19:18.101740507Z"
},
{
"name": "test1",
"filter": "resource.type=\"audited_resource\"\n",
"metricDescriptor": {
"name": "projects/rosy-red-12345/metricDescriptors/logging.googleapis.com/user/test1",
"metricKind": "DELTA",
"valueType": "DISTRIBUTION",
"type": "logging.googleapis.com/user/test1"
},
"valueExtractor": "EXTRACT(protoPayload.authorizationInfo.permission)",
"bucketOptions": {
"exponentialBuckets": {
"numFiniteBuckets": 64,
"growthFactor": 2,
"scale": 0.01
}
},
"createTime": "2019-11-07T01:58:47.997858699Z",
"updateTime": "2019-11-07T01:58:47.997858699Z"
}
],
[
{
"name": "projects/rosy-red-12345/alertPolicies/16634295467069924965",
"displayName": "Threshold = user/",
"combiner": "OR",
"creationRecord": {
"mutateTime": "2019-11-07T19:07:11.377731588Z",
"mutatedBy": "giovanni@cloudsploit.com"
},
"mutationRecord": {
"mutateTime": "2019-11-07T19:07:11.377731588Z",
"mutatedBy": "giovanni@cloudsploit.com"
},
"conditions": [
{
"conditionThreshold": {
"filter": "metric.type=\"logging.googleapis.com/user/vpcNetworkLogging\" resource.type=\"metric\"",
"comparison": "COMPARISON_GT",
"thresholdValue": 0.001,
"duration": "60s",
"trigger": {
"count": 1
},
"aggregations": [
{
"alignmentPeriod": "60s",
"perSeriesAligner": "ALIGN_RATE"
}
]
},
"displayName": "logging/user/vpcNetworkLogging",
"name": "projects/rosy-red-12345/alertPolicies/16634295467069924965/conditions/16634295467069924590"
}
],
"enabled": true
}
]
);
plugin.run(cache, {}, callback);
});
it('should give passing result if log alert for vpc network changes are not enabled', function (done) {
const callback = (err, results) => {
expect(results.length).to.be.above(0);
expect(results[0].status).to.equal(2);
expect(results[0].message).to.include('Log metric for VPC network changes not found');
expect(results[0].region).to.equal('global');
done()
};
const cache = createCache(
null,
[
{
"name": "ProjectOwnershipAssignmentsChanges",
"description": "Ensure log metric filter and alerts exists for Project Ownership assignments/changes",
"filter": "(protoPayload.serviceName=\"cloudresourcemanager.googleapis.com\") AND (ProjectOwnership OR projectOwnerInvitee) OR (protoPayload.serviceData.policyDelta.bindingDeltas.action=\"REMOVE\" AND protoPayload.serviceData.policyDelta.bindingDeltas.role=\"roles/owner\") OR (protoPayload.serviceData.policyDelta.bindingDeltas.action=\"ADD\" AND protoPayload.serviceData.policyDelta.bindingDeltas.role=\"roles/owner\")",
"metricDescriptor": {
"name": "projects/rosy-red-12345/metricDescriptors/logging.googleapis.com/user/ProjectOwnershipAssignmentsChanges",
"metricKind": "DELTA",
"valueType": "INT64",
"unit": "1",
"description": "Ensure log metric filter and alerts exists for Project Ownership assignments/changes",
"type": "logging.googleapis.com/user/ProjectOwnershipAssignmentsChanges"
},
"createTime": "2019-11-07T02:11:39.940887528Z",
"updateTime": "2019-11-07T19:19:18.101740507Z"
},
{
"name": "test1",
"filter": "resource.type=\"audited_resource\"\n",
"metricDescriptor": {
"name": "projects/rosy-red-12345/metricDescriptors/logging.googleapis.com/user/test1",
"metricKind": "DELTA",
"valueType": "DISTRIBUTION",
"type": "logging.googleapis.com/user/test1"
},
"valueExtractor": "EXTRACT(protoPayload.authorizationInfo.permission)",
"bucketOptions": {
"exponentialBuckets": {
"numFiniteBuckets": 64,
"growthFactor": 2,
"scale": 0.01
}
},
"createTime": "2019-11-07T01:58:47.997858699Z",
"updateTime": "2019-11-07T01:58:47.997858699Z"
}
],
[
{
"name": "projects/rosy-red-12345/alertPolicies/16634295467069924965",
"displayName": "Threshold = user/",
"combiner": "OR",
"creationRecord": {
"mutateTime": "2019-11-07T19:07:11.377731588Z",
"mutatedBy": "giovanni@cloudsploit.com"
},
"mutationRecord": {
"mutateTime": "2019-11-07T19:07:11.377731588Z",
"mutatedBy": "giovanni@cloudsploit.com"
},
"conditions": [
{
"conditionThreshold": {
"filter": "metric.type=\"logging.googleapis.com/user/loggingChanges\" resource.type=\"metric\"",
"comparison": "COMPARISON_GT",
"thresholdValue": 0.001,
"duration": "60s",
"trigger": {
"count": 1
},
"aggregations": [
{
"alignmentPeriod": "60s",
"perSeriesAligner": "ALIGN_RATE"
}
]
},
"displayName": "logging/user/ProjectOwnershipAssignmentsChanges",
"name": "projects/rosy-red-12345/alertPolicies/16634295467069924965/conditions/16634295467069924590"
}
],
"enabled": true
}
]
);
plugin.run(cache, {}, callback);
})
})
});
| cloudsploit/scans | plugins/google/logging/vpcNetworkLogging.spec.js | JavaScript | gpl-3.0 | 11,901 |
var $$ = mdui.JQ;
var site_url = 'http://iptance.local.host/';//改成
var clipboard = new Clipboard('#copy');
clipboard.on('success', function(e) {
mdui.snackbar({
message: '复制成功!'
});
});
$$('#send_qq').on('click', function(e) {
if ($$("#jump_url").val() == "") {
mdui.dialog({
title: '提示',
content: '你没有填写 <u>跳转链接</u>,本站默认填写了 <u>跳转链接</u>,如果你修改了,请刷新本页面以恢复默认值。',
buttons: [{
text: '确认'
}]
});
return false;
} else if ($$("#image_url").val() == "") {
mdui.dialog({
title: '提示',
content: '你没有填写 <u>图片链接</u>,本站默认填写了 <u>图片链接</u>,如果你修改了,请刷新本页面以恢复默认值。',
buttons: [{
text: '确认'
}]
});
return false;
} else if ($$("#card_title").val() == "") {
mdui.dialog({
title: '提示',
content: '你没有填写 <u>卡片标题</u>,本站默认填写了 <u>卡片标题</u>,如果你修改了,请刷新本页面以恢复默认值。',
buttons: [{
text: '确认'
}]
});
return false;
} else if ($$("#card_summary").val() == "") {
mdui.dialog({
title: '提示',
content: '你没有填写 <u>卡片 摘要</u>,本站默认填写了 <u>卡片 摘要</u>,如果你修改了,请刷新本页面以恢复默认值。',
buttons: [{
text: '确认'
}]
});
return false;
}
var ts = new Date().getTime().toString();
var tokens = CryptoJS.MD5(ts);
if (check_devices_type() == 'phone') {
var image_url = base64_encode(site_url+"share.php?token="+tokens+"&image_url="+base64_encode($$("#image_url").val())+"&share_user_ip="+client_ip+"&share_time="+share_time+"&share_type=mobile");
var tance_api = "mqqapi://share/to_fri?file_type=news&src_type=web&version=1&generalpastboard=1&file_type=news&share_id=1105471055&url=" + base64_encode($$("#jump_url").val()) + "&image_url=" + image_url +"&title=" + base64_encode($$("#card_title").val()) + "&description=" +base64_encode($$("#card_title").val()) +"&callback_type=scheme&thirdAppDisplayName=UVE=&app_name=UVE=&cflag=0&shareType=0";
} else {
var image_url = base64_encode(site_url+"share.php?token="+tokens+"&image_url="+base64_encode($$("#image_url").val())+"&share_user_ip="+client_ip+"&share_time="+share_time+"&share_type=mobile");
var tance_api = 'http://connect.qq.com/widget/shareqq/index.html?site=&title=' + $$("#card_title").val() + '&summary=' + $$("#card_summary").val() + '&pics='+image_url+'&url=' + $$("#jump_url").val();
console.log(tance_api);
}
console.log(image_url);
if (check_devices_type() == 'phone') {
window.open(tance_api);
mdui.dialog({
title: '<h3>Token 生成成功![手机]</h3>',
content: '<div class="mdui-typo"><b>你的 Token 是:<code id="copy" class="mdui-btn" mdui-tooltip="{content: \'点击复制 Token\', position: \'top\'}" data-clipboard-text="' + tokens + '">'+ tokens +'</code></b></div>',
buttons: [{
text: 'Close'
}]
});
} else {
window.open(tance_api);
mdui.dialog({
title: '<h3>Token 生成成功![电脑]</h3>',
content: '<div class="mdui-typo"><b>你的 Token 是:<code id="copy" class="mdui-btn" mdui-tooltip="{content: \'点击复制 Token\', position: \'top\'}" data-clipboard-text="' + tokens + '">'+ tokens +'</code></b></div>',
buttons: [{
text: 'Close'
}]
});
}
});
function url_encode(str) {
return encodeURI(str);
}
function url_decode(str) {
return decodeURI(str);
}
function md5(str) {
return CryptoJS.MD5(str).toString(CryptoJS.enc.Hex);
}
function sha1(str) {
return CryptoJS.SHA1(str).toString(CryptoJS.enc.Hex);
}
function sha256(str) {
return CryptoJS.SHA256(str).toString(CryptoJS.enc.Hex);
}
function aes_encode(str, key) {
return CryptoJS.AES.encrypt(str, key)
}
function aes_decode(str, key) {
return CryptoJS.AES.decrypt(str, key)
}
function base64_encode(str) {
return CryptoJS.enc.Base64.stringify(CryptoJS.enc.Utf8.parse(str));
}
function base64_decode(str) {
var parsedWordArray = CryptoJS.enc.Base64.parse(str);
return parsedWordArray.toString(CryptoJS.enc.Utf8);
}
function check_devices_type() {
var sUserAgent = navigator.userAgent.toLowerCase();
var bIsIpad = sUserAgent.match(/ipad/i) == "ipad";
var bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os";
var bIsMidp = sUserAgent.match(/midp/i) == "midp";
var bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4";
var bIsUc = sUserAgent.match(/ucweb/i) == "ucweb";
var bIsAndroid = sUserAgent.match(/android/i) == "android";
var bIsCE = sUserAgent.match(/windows ce/i) == "windows ce";
var bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile";
if (bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM) {
return 'phone'
} else {
return 'pc';
}
}
function query_ip_location(ip){
window.open('https://ip.nowtool.cn/ip-'+ip+'.html');
}
function request_ip_query(ip) {
$.ajax({
method: 'get',
url: 'https://ip.nowtool.cn/api.php?do=ipbach&ip='+ip,
dataType: 'json',
cache: false,
success: function (data) {
console.log(data);
console.log(data.data);
console.log(data.data.location);
mdui.dialog({
title: 'IP 归属地查询',
content: data.data.location,
modal: true,
buttons: [{text: 'Close'}]
});
},
error: function(){
$("#loadgif").hide();
console.log('请求错误\n\n');
}
})
}
| PrintNow/QQipTance | assets/js/javascript.js | JavaScript | gpl-3.0 | 5,460 |
/*
* This file is part of FamilyDAM Project.
*
* The FamilyDAM Project 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.
*
* The FamilyDAM Project 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 the FamilyDAM Project. If not, see <http://www.gnu.org/licenses/>.
*/
// Karma E2E configuration
// base path, that will be used to resolve files and exclude
basePath = '';
// list of files / patterns to load in the browser
files = [
ANGULAR_SCENARIO,
ANGULAR_SCENARIO_ADAPTER,
'test/e2e/**/*.js'
];
// list of files to exclude
exclude = [];
// test results reporter to use
// possible values: dots || progress || growl
reporters = ['progress'];
// web server port
port = 8080;
// cli runner port
runnerPort = 9100;
// enable / disable colors in the output (reporters and logs)
colors = true;
// level of logging
// possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG
logLevel = LOG_INFO;
// enable / disable watching file and executing tests whenever any file changes
autoWatch = false;
// Start these browsers, currently available:
// - Chrome
// - ChromeCanary
// - Firefox
// - Opera
// - Safari (only Mac)
// - PhantomJS
// - IE (only Windows)
browsers = ['Chrome'];
// If browser does not capture in given timeout [ms], kill it
captureTimeout = 5000;
// Continuous Integration mode
// if true, it capture browsers, run tests and exit
singleRun = false;
| mnimer/FamilyDAM | bundles/dashboard-bundle/dashboard-client/karma-e2e.conf.js | JavaScript | gpl-3.0 | 1,901 |
/*
* This file is part of the AuScope Virtual Rock Lab (VRL) project.
* Copyright (c) 2010 The University of Queensland, ESSCC
*
* Licensed under the terms of the GNU Lesser General Public License.
*/
Ext.namespace('VRL.SubmitJobDialog');
VRL.SubmitJobDialog = {
// Store for ESyS-Particle versions available on the Grid
versionsStore: new Ext.data.JsonStore({
url: VRL.JobManager.controllerURL,
baseParams: { 'action': 'listVersions' },
root: 'versions',
fields: [ { name: 'value', type: 'string' } ]
}),
// Store for sites with ESyS-Particle installations (with specific version)
sitesStore: new Ext.data.JsonStore({
url: VRL.JobManager.controllerURL,
baseParams: { 'action': 'listSites' },
root: 'sites',
fields: [ { name: 'value', type: 'string' } ]
}),
// Store for queue names at a specific site
queuesStore: new Ext.data.JsonStore({
url: VRL.JobManager.controllerURL,
baseParams: { 'action': 'listSiteQueues' },
root: 'queues',
fields: [ { name: 'value', type: 'string' } ]
}),
show: function(job, callback) {
var jobSubmitForm = new Ext.FormPanel({
bodyStyle: 'padding:10px;',
id: 'submit-form',
frame: true,
defaults: { anchor: '100%' },
labelWidth: 140,
monitorValid: true,
items: [{
xtype: 'combo',
id: 'versions-combo',
name: 'version',
editable: false,
allowBlank: false,
store: this.versionsStore,
triggerAction: 'all',
displayField: 'value',
fieldLabel: 'ESyS-Particle Version',
emptyText: 'Select a version...'
}, {
xtype: 'combo',
id: 'sites-combo',
name: 'site',
disabled: true,
editable: false,
allowBlank: false,
store: this.sitesStore,
triggerAction: 'all',
displayField: 'value',
fieldLabel: 'Site',
emptyText: 'Select a site...'
}, {
xtype: 'combo',
id: 'queues-combo',
name: 'queue',
disabled: true,
editable: false,
allowBlank: false,
store: this.queuesStore,
triggerAction: 'all',
displayField: 'value',
fieldLabel: 'Queue on Site',
emptyText: 'Select a job queue...'
}, {
xtype: 'numberfield',
name: 'walltime',
fieldLabel: 'Max Walltime (mins)',
allowBlank: false,
allowDecimals: false,
allowNegative: false,
minValue: 1,
value: job.walltime
}, {
xtype: 'numberfield',
name: 'memory',
fieldLabel: 'Max Memory (MB)',
allowBlank: false,
allowDecimals: false,
allowNegative: false,
minValue: 1,
value: job.memory
}, {
xtype: 'numberfield',
name: 'numprocs',
fieldLabel: 'Number of MPI procs',
allowBlank: false,
allowDecimals: false,
allowNegative: false,
minValue: 1,
value: job.numProcs
}, {
xtype: 'hidden',
name: 'job',
value: job.id
}]
});
this.versionsStore.on({'exception': VRL.onLoadException});
this.sitesStore.on({'exception': VRL.onLoadException});
this.queuesStore.on({'exception': VRL.onLoadException});
Ext.getCmp('versions-combo').on('select',
function(combo, record, index) {
var sitesCombo = Ext.getCmp('sites-combo');
this.sitesStore.baseParams.version = record.get('value');
this.sitesStore.reload();
sitesCombo.enable();
sitesCombo.reset();
var queuesCombo = Ext.getCmp('queues-combo');
this.queuesStore.baseParams.version = record.get('value');
queuesCombo.disable();
queuesCombo.reset();
},
this
);
Ext.getCmp('sites-combo').on('select',
function(combo, record, index) {
var queuesCombo = Ext.getCmp('queues-combo');
this.queuesStore.baseParams.site = record.get('value');
this.queuesStore.reload();
queuesCombo.enable();
queuesCombo.reset();
},
this
);
// prefill form if possible
if (!Ext.isEmpty(job.version)) {
var versionsCombo = Ext.getCmp('versions-combo');
var sitesCombo = Ext.getCmp('sites-combo');
var queuesCombo = Ext.getCmp('queues-combo');
var onLoadQueues = function(r, opts, success) {
if (this.queuesStore.find('value', job.queue) >= 0) {
queuesCombo.setValue(job.queue);
}
}
var onLoadSites = function(r, opts, success) {
if (this.sitesStore.find('value', job.site) >= 0) {
sitesCombo.setValue(job.site);
this.queuesStore.baseParams.site = job.site;
queuesCombo.enable();
if (!Ext.isEmpty(job.queue)) {
var options = {
callback: onLoadQueues,
scope: this
};
this.queuesStore.reload(options);
} else {
this.queuesStore.reload();
}
}
}
var onLoadVersions = function(r, opts, success) {
if (this.versionsStore.find('value', job.version) >= 0) {
versionsCombo.setValue(job.version);
sitesCombo.enable();
this.sitesStore.baseParams.version = job.version;
this.queuesStore.baseParams.version = job.version;
if (!Ext.isEmpty(job.site)) {
var options = {
callback: onLoadSites,
scope: this
};
this.sitesStore.reload(options);
} else {
this.sitesStore.reload();
}
}
}
var options = {
callback: onLoadVersions,
scope: this
};
this.versionsStore.reload(options);
}
var submitBtnHandler = function() {
var me = this;
var onSubmitJobSuccess = function(response, request) {
VRL.hideProgressDlg();
Ext.getCmp('submit-win').show();
if (VRL.decodeResponse(response)) {
if (Ext.isFunction(callback)) {
Ext.getCmp('submit-win').on({'close': callback});
}
Ext.getCmp('submit-win').close();
}
}
var onSubmitJobFailure = function(response, options) {
VRL.hideProgressDlg();
Ext.getCmp('submit-win').show();
VRL.showMessage('Could not submit job! Status: '
+ response.status + ' (' + response.statusText + ')');
}
if (!jobSubmitForm.getForm().isValid()) {
VRL.showMessage('Please correct the marked form fields.', 'w');
return false;
}
// send details to server to submit the job
var values = jobSubmitForm.getForm().getFieldValues();
Ext.getCmp('submit-win').hide();
VRL.doRequest(VRL.JobManager.controllerURL,
'submitJob', values, onSubmitJobSuccess, onSubmitJobFailure);
};
var w = new Ext.Window({
id: 'submit-win',
title: 'Submit '+job.name,
iconCls: 'go-icon',
modal: true,
layout: 'fit',
closable: false,
resizable: false,
width: 400,
height: 260,
buttons: [{
text: 'Cancel',
handler: function() {
Ext.getCmp('submit-win').close();
}
}, {
text: 'Submit',
handler: submitBtnHandler,
scope: this
}],
items: [ jobSubmitForm ]
});
w.show();
}
}
| AuScope/VirtualRockLab | src/main/webapp/js/SubmitJobDialog.js | JavaScript | gpl-3.0 | 8,133 |
(function ($) {
$(document).ready(function () {
$('textarea.autogrow, textarea#post_content').autogrow({
onInitialize: true
});
$('.ap-categories-list li .ap-icon-arrow-down').on('click', function (e) {
e.preventDefault();
$(this).parent().next().slideToggle(200);
});
$('.ap-radio-btn').on('click', function () {
$(this).toggleClass('active');
});
$('.bootstrap-tagsinput > input').on('keyup', function (event) {
$(this).css(width, 'auto');
});
$('.ap-label-form-item').on('click', function (e) {
e.preventDefault();
$(this).toggleClass('active');
var hidden = $(this).find('input[type="hidden"]');
hidden.val(hidden.val() == '' ? $(this).data('label') : '');
});
});
$('[ap-loadmore]').on('click', function (e) {
e.preventDefault();
var self = this;
var args = JSON.parse($(this).attr('ap-loadmore'));
args.action = 'ap_ajax';
if (typeof args.ap_ajax_action === 'undefined')
args.ap_ajax_action = 'bp_loadmore';
AnsPress.showLoading(this);
AnsPress.ajax({
data: args,
success: function (data) {
AnsPress.hideLoading(self);
console.log(data.element);
if (data.success) {
$(data.element).append(data.html);
$(self).attr('ap-loadmore', JSON.stringify(data.args));
if (!data.args.current) {
$(self).hide();
}
}
}
});
});
})(jQuery);
| anspress/anspress | templates/js/theme.js | JavaScript | gpl-3.0 | 1,727 |
// NanoBaseCallbacks is where the base callbacks (common to all templates) are stored
NanoBaseCallbacks = function ()
{
// _canClick is used to disable clicks for a short period after each click (to avoid mis-clicks)
var _canClick = true;
var _baseBeforeUpdateCallbacks = {}
var _baseAfterUpdateCallbacks = {
// this callback is triggered after new data is processed
// it updates the status/visibility icon and adds click event handling to buttons/links
status: function (updateData) {
var uiStatusClass;
if (updateData['config']['status'] == 2)
{
uiStatusClass = 'icon24 uiStatusGood';
$('.linkActive').removeClass('inactive');
}
else if (updateData['config']['status'] == 1)
{
uiStatusClass = 'icon24 uiStatusAverage';
$('.linkActive').addClass('inactive');
}
else
{
uiStatusClass = 'icon24 uiStatusBad'
$('.linkActive').addClass('inactive');
}
$('#uiStatusIcon').attr('class', uiStatusClass);
$('.linkActive').stopTime('linkPending');
$('.linkActive').removeClass('linkPending');
$('.linkActive')
.off('click')
.on('click', function (event) {
event.preventDefault();
var href = $(this).data('href');
if (href != null && _canClick)
{
_canClick = false;
$('body').oneTime(300, 'enableClick', function () {
_canClick = true;
});
if (updateData['config']['status'] == 2)
{
$(this).oneTime(300, 'linkPending', function () {
$(this).addClass('linkPending');
});
}
window.location.href = href;
}
});
return updateData;
},
nanomap: function (updateData) {
$('.mapIcon')
.off('mouseenter mouseleave')
.on('mouseenter',
function (event) {
var self = this;
$('#uiMapTooltip')
.html($(this).children('.tooltip').html())
.show()
.stopTime()
.oneTime(5000, 'hideTooltip', function () {
$(this).fadeOut(500);
});
}
);
$('.zoomLink')
.off('click')
.on('click', function (event) {
event.preventDefault();
var zoomLevel = $(this).data('zoomLevel');
var uiMapObject = $('#uiMap');
var uiMapWidth = uiMapObject.width() * zoomLevel;
var uiMapHeight = uiMapObject.height() * zoomLevel;
uiMapObject.css({
zoom: zoomLevel,
left: '50%',
top: '50%',
marginLeft: '-' + Math.floor(uiMapWidth / 2) + 'px',
marginTop: '-' + Math.floor(uiMapHeight / 2) + 'px'
});
});
$('#uiMapImage').attr('src', 'minimap_' + updateData['config']['mapZLevel'] + '.png');
return updateData;
}
};
return {
addCallbacks: function () {
NanoStateManager.addBeforeUpdateCallbacks(_baseBeforeUpdateCallbacks);
NanoStateManager.addAfterUpdateCallbacks(_baseAfterUpdateCallbacks);
},
removeCallbacks: function () {
for (var callbackKey in _baseBeforeUpdateCallbacks)
{
if (_baseBeforeUpdateCallbacks.hasOwnProperty(callbackKey))
{
NanoStateManager.removeBeforeUpdateCallback(callbackKey);
}
}
for (var callbackKey in _baseAfterUpdateCallbacks)
{
if (_baseAfterUpdateCallbacks.hasOwnProperty(callbackKey))
{
NanoStateManager.removeAfterUpdateCallback(callbackKey);
}
}
}
};
} ();
| ak72ti/Whynot | nano/js/nano_base_callbacks.js | JavaScript | gpl-3.0 | 4,255 |
// Copyright 2014-2015, University of Colorado Boulder
/**
* Copied from fractions-intro, should be factored out//TODO
*
* @author Chris Malley (PixelZoom, Inc.)
* @author Sam Reid
*/
define( function( require ) {
'use strict';
// modules
var inherit = require( 'PHET_CORE/inherit' );
var seasons = require( 'SEASONS/seasons' );
var SimpleDragHandler = require( 'SCENERY/input/SimpleDragHandler' );
var Vector2 = require( 'DOT/Vector2' );
function NodeDragHandler( node, options ) {
options = _.extend( {
startDrag: function() {},
drag: function() {},
endDrag: function() { /* do nothing */ } // use this to do things at the end of dragging, like 'snapping'
}, options );
var startOffset; // where the drag started, relative to the Movable's origin, in parent view coordinates
SimpleDragHandler.call( this, {
allowTouchSnag: true,
// note where the drag started
start: function( event ) {
startOffset = event.currentTarget.globalToParentPoint( event.pointer.point ).minusXY( node.x, node.y );
options.startDrag();
},
// change the location, adjust for starting offset, constrain to drag bounds
drag: function( event ) {
var parentPoint = event.currentTarget.globalToParentPoint( event.pointer.point ).minus( startOffset );
var location = parentPoint;
var constrainedLocation = constrainBounds( location, options.dragBounds );
node.setTranslation( constrainedLocation );
options.drag( event );
},
end: function( event ) {
options.endDrag( event );
}
} );
}
seasons.register( 'NodeDragHandler', NodeDragHandler );
inherit( SimpleDragHandler, NodeDragHandler );
/**
* Constrains a point to some bounds.
* @param {Vector2} point
* @param {Bounds2} bounds
*/
var constrainBounds = function( point, bounds ) {
if ( _.isUndefined( bounds ) || bounds.containsCoordinates( point.x, point.y ) ) {
return point;
}
else {
var xConstrained = Math.max( Math.min( point.x, bounds.maxX ), bounds.x );
var yConstrained = Math.max( Math.min( point.y, bounds.maxY ), bounds.y );
return new Vector2( xConstrained, yConstrained );
}
};
return NodeDragHandler;
} ); | phetsims/seasons | js/intensity/view/NodeDragHandler.js | JavaScript | gpl-3.0 | 2,301 |
var mongoose = require('mongoose')
var Setting = require('./models/setting').Model
var SettingsManager = function(){
this.ManualOverrideKey = 'manualOverride'
this.MosquittoUser = 'mosquittoUser'
this.MosquittoPassword = 'mosquittoPassword'
this.ApiToken = 'apiToken'
this.ApiEnabled = 'api_enabled'
this.AnonymousDashboardAccess = 'anonymous_dashboard_access'
}
SettingsManager.prototype.setValue = function(key, value, callback) {
Setting.findOne({settingName:key}, function(err, setting) {
if(setting) {
setting.settingValue = value
setting.save(callback)
} else {
var newSetting = new Setting()
newSetting.settingName = key
newSetting.settingValue = value
newSetting.save(function(err, savedSetting){
callback(err, savedSetting)
})
}
})
}
SettingsManager.prototype.getValue = function(key, defaultValue, callback) {
Setting.findOne({settingName: key}, function(err, setting){
if (setting) {
callback(setting.settingValue)
} else {
callback(defaultValue)
}
})
}
module.exports = new SettingsManager()
| OpenHAS/Server | OpenHASWeb/dao/settings_manager.js | JavaScript | gpl-3.0 | 1,118 |
import { enable } from 'actions/pick';
import store from 'store';
navigator.mozSetMessageHandler('activity', request => {
if (request.source.name === 'pick') {
store.dispatch(enable(request));
}
});
| mdibaiee/Hawk | src/js/activities.js | JavaScript | gpl-3.0 | 208 |
import ApiCall from './ApiBase.js';
export function getEntities() {
return ApiCall("/api/v1/entities", "GET");
}
export function getInstancesOf(name) {
return ApiCall("/api/v1/" + name, "GET");
} | WernerLDev/ScalaPlayCMS | app/assets/core/javascripts/api/EntityApi.js | JavaScript | gpl-3.0 | 205 |
"use strict";
(function() {
angular.module("firebotApp")
.component("keyCapture", {
bindings: {
keyCode: "="
},
template: `
<div class="hotkey-capture" ng-class="{ 'capturing': $ctrl.isCapturingKey }">
<span class="hotkey-display grayscale" ng-click="$ctrl.startKeyCapture()">
<span ng-if="$ctrl.keyDisplay == null || $ctrl.keyDisplay === ''" class="muted" style="font-weight: 500;">
{{ $ctrl.isCapturingKey ? 'Press a key...' : 'No key set.' }}
</span>
<span>{{$ctrl.keyDisplay}}</span>
</span>
<button ng-click="$ctrl.startKeyCapture()" class="btn" ng-class="$ctrl.isCapturingKey ? 'btn-danger' : 'btn-default'">{{$ctrl.isCapturingKey ? 'Stop recording' : 'Record'}}</button>
<span class="clickable" style="margin-left: 10px;" uib-tooltip="Clear current key" tooltip-append-to-body="true" ng-click="$ctrl.clearKey()" ng-show="!$ctrl.isCapturingKey && $ctrl.keyDisplay != null && $ctrl.keyDisplay.length > 0"><i class="far fa-times-circle"></i></span>
</div>
`,
controller: function(keyHelper, logger) {
let $ctrl = this;
$ctrl.keyDisplay = null;
$ctrl.isCapturingKey = false;
$ctrl.clearKey = function() {
$ctrl.keyDisplay = "";
$ctrl.keyCode = undefined;
};
$ctrl.$onInit = function() {
if ($ctrl.keyCode != null) {
let keyName = keyHelper.getKeyboardKeyName($ctrl.keyCode);
if (keyName != null && keyName.length > 0) {
$ctrl.keyDisplay = keyName;
} else {
$ctrl.keyCode = undefined;
}
}
};
const keyDownListener = function(event) {
if (!$ctrl.isCapturingKey) return;
if (event.keyCode == null) return;
let keyName = keyHelper.getKeyboardKeyName(event.keyCode);
//if key name is empty we dont support this keycode
if (keyName != null && keyName.length > 0) {
$ctrl.keyDisplay = keyName;
$ctrl.keyCode = event.keyCode;
}
event.stopPropagation();
event.stopImmediatePropagation();
event.preventDefault();
};
const clickListener = function() {
if ($ctrl.isCapturingKey) {
event.stopPropagation();
event.stopImmediatePropagation();
event.preventDefault();
}
$ctrl.stopKeyCapture();
};
$ctrl.startKeyCapture = function() {
if ($ctrl.isCapturingKey) return;
$ctrl.isCapturingKey = true;
logger.info("Starting key capture...");
window.addEventListener("keydown", keyDownListener, true);
window.addEventListener("click", clickListener, true);
};
$ctrl.stopKeyCapture = function() {
logger.info("Stopping key recording");
if ($ctrl.isCapturingKey) {
$ctrl.isCapturingKey = false;
}
window.removeEventListener("keydown", keyDownListener, true);
window.removeEventListener("click", clickListener, true);
};
}
});
}());
| Firebottle/Firebot | gui/app/directives/misc/keyCatpure.js | JavaScript | gpl-3.0 | 3,936 |
var compressor = require('node-minify');
var async = require('async');
var args = process.argv.slice(2);
var fs = require('fs');
var latestBuild = function(exitCb, errorSensitive, testType) {
if(typeof errorSensitive == 'undefined') {
errorSensitive = false;
}
if(typeof testType == 'undefined') {
testType = 0;
}
var finish = [null, null, null];
console.log('Starting assets build for CSS, JS libraries and JS app...');
if(errorSensitive) {
console.log('NOTICE: Build is error sensitive!');
}
async.parallel([function(cb) {
var start = process.hrtime();
if(testType != 0 && testType != 2) {
console.log('> Skipping JavaScript build');
return cb();
}
compressor.minify({
compressor: 'yui-js',
input: 'public/js/*.js',
output: 'public/build.js',
tempPath: '/tmp/',
callback: function(err, min) {
if(err) {
console.error(err);
if(errorSensitive) {
console.error('> Unable to build JavaScripts.');
return exitCb(1);
}
}
finish[0] = (process.hrtime(start)[1] / 1000000).toFixed(3);
if(errorSensitive) {
console.log('> Built JavaScripts in ' + finish[0] + 'ms');
}
return cb();
}
});
}, function(cb) {
var start = process.hrtime();
if(testType != 0 && testType != 2) {
console.log('> Skipping library JavaScript build');
return cb();
}
compressor.minify({
compressor: 'yui-js',
input: 'public/js/lib/*.js',
output: 'public/lib-build.js',
tempPath: '/tmp/',
callback: function(err, min) {
if(err) {
console.error(err);
if(errorSensitive) {
console.error('> Unable to build library JavaScripts.');
return exitCb(2);
}
}
finish[3] = (process.hrtime(start)[1] / 1000000).toFixed(3);
if(errorSensitive) {
console.log('> Built library JavaScripts in ' + finish[3] + 'ms');
}
return cb();
}
});
}, function(cb) {
var start = process.hrtime();
if(testType != 0 && testType != 1) {
console.log('> Skipping CSS build');
return cb();
}
compressor.minify({
compressor: 'yui-css',
input: 'public/css/*.css',
output: 'public/build.css',
tempPath: '/tmp/',
callback: function(err, min) {
if(err) {
console.error(err);
if(errorSensitive) {
console.error('> Unable to build CSS.');
return exitCb(3);
}
}
finish[1] = (process.hrtime(start)[1] / 1000000).toFixed(3);
if(errorSensitive) {
console.log('> Built CSS in ' + finish[1] + 'ms');
}
return cb();
}
});
}], function() {
if(!errorSensitive) {
console.log('Assets build completed, JS took ' + finish[0] + 'ms, JS libraries took ' + finish[3] + 'ms and CSS took ' + finish[1] + 'ms');
}
return exitCb(0);
});
};
module.exports.latestBuild = latestBuild;
if(args.length == 1 && args[0] == '--both') {
latestBuild(function() {
process.exit(0);
});
}
if(args.length == 1 && args[0] == '--both-test') {
latestBuild(function(exitCode) {
console.info('> Assets build status: ' + (exitCode == 0 ? 'OK' : 'FAIL (' + exitCode + ')'));
process.exit(exitCode);
}, true);
}
if(args.length == 1 && args[0] == '--css-test') {
latestBuild(function(exitCode) {
console.info('> Assets build status: ' + (exitCode == 0 ? 'OK' : 'FAIL (' + exitCode + ')'));
process.exit(exitCode);
}, true, 1);
}
if(args.length == 1 && args[0] == '--js-test') {
latestBuild(function(exitCode) {
console.info('> Assets build status: ' + (exitCode == 0 ? 'OK' : 'FAIL (' + exitCode + ')'));
process.exit(exitCode);
}, true, 2);
}
| njb-said/asset-build-template | assets.js | JavaScript | gpl-3.0 | 4,532 |
var searchData=
[
['id',['id',['../class_replicate_null_model_test_thread.html#a542cbb1366981485d28f921c4b7068c5',1,'ReplicateNullModelTestThread::id()'],['../class_replicate_relabeler.html#abd19c7fbc081fc3aab03375061223a39',1,'ReplicateRelabeler::id()']]],
['initialize',['initialize',['../class_m_t_rand.html#a9b9a20998f5c805af6301ce5c37dcfc3',1,'MTRand']]],
['initprogress',['initProgress',['../class_replicate_null_model_test.html#aab56c48368832f9c6184900b4781e80c',1,'ReplicateNullModelTest']]],
['initrelabeler',['initRelabeler',['../class_landscape_mapper.html#a16e19d3e82612da50cd3bb3a2983c3f2',1,'LandscapeMapper']]],
['insert',['insert',['../class_locality_list.html#a600fc59a44e6be7db7f307908e67450b',1,'LocalityList']]],
['isnodatavaluevalid',['isNoDataValueValid',['../class_raster.html#ae8c40b065037e02be573405796e4fb7b',1,'Raster']]],
['isthreshholdapplied',['isThreshholdApplied',['../class_raster_model.html#a53cbdb7698403522dbb2acdd43403ac2',1,'RasterModel']]],
['isvalid',['isValid',['../class_raster.html#a7e50d8c25e0d3e2f814945662b1d9a61',1,'Raster::isValid()'],['../class_raster_model.html#a54f5896de7b913ed14c388a6b4ab80a3',1,'RasterModel::isValid()'],['../class_replicate_template.html#a49b23dc3f89cca9aa331bb09baef222d',1,'ReplicateTemplate::isValid()']]]
];
| persts/ReplicateNullModel | html/search/functions_8.js | JavaScript | gpl-3.0 | 1,300 |
function playSound(e) {
const audio = document.querySelector(`audio[data-key="${e.keyCode}"]`);
const key = document.querySelector(`.key[data-key="${e.keyCode}"]`);
if (!audio) {
return; // stop the function from running all together
};
audio.currentTime = 0; // rewind to the start
audio.play();
key.classList.add('playing');
};
function removeTransition(e) {
if (e.propertyName !== 'transform') {
return; // skip it if it's not a transform
};
this.classList.remove('playing');
};
const keys = document.querySelectorAll('.key');
keys.forEach(key => key.addEventListener('transitionend', removeTransition));
window.addEventListener('keydown', playSound); | magdalenajadach/JavaScript-30day-challenge | day1/app.js | JavaScript | gpl-3.0 | 724 |
import { Harbors } from '..';
import { Lanes } from '../../lanes';
import {
LatestShipment,
} from '../../shipments';
Meteor.publish('Harbors', function () {
return Harbors.find();
});
const not_found = (err) => {
console.error(err);
return 404;
};
Meteor.methods({
'Harbors#update': async function update_harbor (lane, values) {
try {
let harbor = Harbors.findOne(lane.type);
let success = H.harbors[lane.type].update(lane, values);
if (success) {
harbor.lanes = harbor.lanes || {};
harbor.lanes[lane._id] = {
manifest: values,
};
await Harbors.update(harbor._id, harbor);
lane = await Meteor.call('Harbors#render_work_preview', lane, values);
lane.minimum_complete = success;
}
if (success && lane.rendered_work_preview && !lane.last_shipment) {
lane.last_shipment = {
actual: 'Never',
start: '',
shipment_count: 0,
salvage_runs: 0,
};
LatestShipment.upsert(
lane._id,
{shipment: lane.last_shipment}
);
}
Lanes.update(lane._id, lane);
return { lane, success };
}
catch (err) {
console.error(err);
throw err;
}
},
'Harbors#render_input': async function render_input (lane, manifest) {
const $newLaneName = 'New';
if (lane.name == $newLaneName || !lane.type) return false;
try {
lane.rendered_input = H.harbors[lane.type].render_input(manifest, lane);
lane.rendered_work_preview = await H
.harbors
[lane.type]
.render_work_preview(manifest, lane)
;
Lanes.update(lane._id, {$set:{
rendered_input: lane.rendered_input,
rendered_work_preview: lane.rendered_work_preview,
}});
return lane;
}
// Have the harbors been loaded successfully?
// The #render_input method is required.
catch (err) { return not_found(err); }
},
'Harbors#render_work_preview': async function render_work_preview (
lane, manifest
) {
if (! H.harbors[lane.type]) return 404;
try {
lane.rendered_work_preview = await H
.harbors
[lane.type]
.render_work_preview(manifest, lane)
;
Lanes.update(lane._id, {$set: {
rendered_work_preview: lane.rendered_work_preview
}});
return lane;
}
catch (err) { return not_found(err); }
},
'Harbors#get_constraints': (name) => {
const key = `constraints.${name}`;
const constraints = {
global: [],
[name]: [],
};
Harbors.find({ $or: [
{ 'constraints.global': { $exists: true } },
{ [key]: { $exists: true } },
] }).forEach((doc) => {
if (doc.constraints.global)
constraints.global = constraints.global.concat(doc.constraints.global);
if (doc.constraints[name])
constraints[name] = constraints[name].concat(doc.constraints[name]);
});
return constraints;
},
});
| StrictlySkyler/harbormaster | imports/api/harbors/server/index.js | JavaScript | gpl-3.0 | 3,013 |
(function() {
'use strict';
angular
.module('app.viewToDo')
.filter('isDone', filter);
function filter() {
return filterFilter;
function filterFilter(item) {
return item.done===false;
}
}
})();
| NelsonMaty/AgileHubClase3 | app/viewToDo/isDone.filter.js | JavaScript | gpl-3.0 | 265 |
(function() {
'use strict';
angular
.module('projects')
.controller('ListProjectsCtrl', ListCtrl)
.controller('ShowProjectCtrl', ShowCtrl);
ListCtrl.$inject = ['$scope', 'dtlProject', '$ionicPopup', 'alert', 'dtlVolunteer'];
ShowCtrl.$inject = ['$scope', 'dtlProject', 'dtlVolunteer', '$stateParams', '$ionicModal',
'alert', '$state', '$ionicHistory', '$sce', 'loader', 'goBackState',
'$ionicPlatform', '$cordovaSocialSharing', 'shareProjectConfig'];
function ListCtrl($scope, dtlProject, $ionicPopup, alert, dtlVolunteer) {
var page = 0;
var status = null;
var suscribed = false;
$scope.projects = [];
$scope.moreProjectsCanBeLoaded = true;
$scope.isAuthenticated = dtlVolunteer.isAuthenticated;
$scope.filters = {};
$scope.filters.status = status;
$scope.filters.suscribed = suscribed;
$scope.showFilters = function() {
$ionicPopup.show({
templateUrl: 'app/projects/templates/filters.html',
okText: 'Filtrar',
cancelText: 'Cancelar',
scope: $scope,
cssClass: 'projects-filters-popup',
buttons: [{
text: 'Cancelar',
type: 'button-default',
onTap: function() {
$scope.filters.status = status;
$scope.filters.suscribed = suscribed;
}
}, {
text: 'Aplicar',
type: 'button-positive',
onTap: function() {
status = $scope.filters.status;
suscribed = $scope.filters.suscribed;
$scope.refresh();
}
}]
});
};
$scope.loadMore = function() {
$scope.loading = true;
findProjects()
.then(function(projects) {
$scope.projects = $scope.projects.concat(projects);
})
.catch(function() {
alert.error();
})
.finally(function() {
$scope.$broadcast('scroll.infiniteScrollComplete');
$scope.loading = false;
});
};
$scope.refresh = function() {
page = 0;
findProjects()
.then(function(projects) {
$scope.projects = projects;
})
.catch(function() {
alert.error();
})
.finally(function() {
$scope.$broadcast('scroll.refreshComplete');
});
};
function findProjects() {
var finder;
var where = status && { status: status } || {};
if (suscribed)
finder = dtlVolunteer.getProjects(where, { page: page });
else
finder = dtlProject.find(where, { page: page });
return finder
.then(function(projects) {
if (projects.length > 0) {
page++;
$scope.moreProjectsCanBeLoaded = true;
return projects;
} else {
$scope.moreProjectsCanBeLoaded = false;
return [];
}
})
.catch(function(e) {
$scope.moreProjectsCanBeLoaded = false;
throw e;
});
}
}
function ShowCtrl($scope, dtlProject, dtlVolunteer, $stateParams, $ionicModal, alert,
$state, $ionicHistory, $sce, loader, goBackState, $ionicPlatform, $socialSharing, shareProjectConfig) {
var projectId = $stateParams.id;
$scope.project = {};
$scope.subscriptionData = {};
function init() {
loader.show();
dtlProject.findById(projectId, 'gallery')
.then(function(project) {
$scope.project = project;
return dtlVolunteer.isSubscribed(projectId)
.then(function() {
$scope.project.isSubscribed = true;
})
.catch(function() {});
})
.catch(function() {
$ionicHistory.nextViewOptions({
historyRoot: true
});
$state.go('^.list');
alert.error();
})
.finally(function() {
loader.hide();
});
$ionicModal.fromTemplateUrl('app/projects/templates/gallery.html', {
scope: $scope,
animation: 'slide-in-up'
}).then(function(modal) {
$scope.galleryModal = modal;
});
$ionicModal.fromTemplateUrl('app/projects/templates/subscription.html', {
scope: $scope,
animation: 'slide-in-up'
}).then(function(modal) {
$scope.subscriptionModal = modal;
});
}
$scope.subscribe = function() {
loader.show();
dtlVolunteer.subscribe($scope.project.id, $scope.subscriptionData)
.then(function() {
$scope.project.isSubscribed = true;
$scope.closeSubscriptionModal();
alert.info('project.suscribed', 10000);
})
.catch(function() {
alert.error();
})
.finally(function() {
loader.hide();
});
};
$scope.unsubscribe = function() {
alert.confirm('project.confirmUnsubscription')
.then(function(confirm) {
if (confirm === true) {
loader.show();
return dtlVolunteer.unsubscribe($scope.project.id)
.then(function() {
$scope.project.isSubscribed = false;
loader.hide();
});
}
})
.catch(function() {
alert.error();
});
};
$scope.openSubscriptionModal = function() {
if (dtlVolunteer.isAuthenticated()) {
$scope.subscriptionData = {};
$scope.subscriptionModal.show();
} else {
goBackState.save('app.projects.show', { id: projectId });
$state.go('app.myaccount');
}
};
$scope.closeSubscriptionModal = function() {
$scope.subscriptionModal.hide();
};
$scope.openGalleryModal = function() {
$scope.galleryModal.show();
};
$scope.closeGalleryModal = function() {
$scope.galleryModal.hide();
};
$scope.$on('$destroy', function() {
$scope.subscriptionModal.remove();
$scope.galleryModal.remove();
});
$scope.displaySafeHtml = function(html){
return $sce.trustAsHtml(html);
};
$scope.share = function() {
var message = shareProjectConfig.message;
var subject = shareProjectConfig.subject;
var link = shareProjectConfig.link.replace("{projectId}", projectId);
$ionicPlatform.ready(function() {
$socialSharing
.share(message, subject, null, link)
.catch(function(err) {
alert.error(err);
});
});
};
init();
}
})();
| pablo-archenti/dtl-app | www/app/projects/projects.controller.js | JavaScript | gpl-3.0 | 8,072 |
/**
*
*/
Ext.define('RODAdmin.view.studies.CBEditor.studyadd.sProposal', {
extend : 'Ext.panel.Panel',
alias : 'widget.sproposal',
autoScroll: true,
title : 'Study Proposal',
items : [
{
xtype : 'form',
itemId : 'sproposalform',
bodyPadding : 5,
items : [
{
xtype: 'fieldset',
collapsible: true,
layout : {
type : 'hbox'
},
title: 'Date Information',
items: [
{
xtype : 'datefield',
fieldLabel : 'Start Date',
name : 'sdate',
itemId : 'startdate',
value : '',
flex : 1,
padding : '5'
},
{
xtype : 'datefield',
fieldLabel : 'End Date',
name : 'edate',
itemId : 'enddate',
value : '',
flex : 1,
padding : '5'
}
]
},
{
xtype: 'fieldset',
title: 'Principal Investigators',
collapsible: true,
itemId: 'prinvfs',
items: [
{
xtype: 'grid',
itemId: 'prinvdisplay',
store: 'studies.CBEditor.PrincipalInv',
columns : [{
itemId : 'status',
text : 'Status',
sortable : true,
flex: 1,
dataIndex : 'status'
},{
itemId : 'type',
text : 'Type',
sortable : true,
flex: 1,
dataIndex : 'type'
},{
itemId : 'name',
text : 'Name',
sortable : true,
flex: 2,
dataIndex : 'selectedname'
},
{
xtype : 'actioncolumn',
width : 30,
sortable : false,
menuDisabled : true,
itemId : 'actionpinvresp',
items : [{
icon : 'images/delete.gif',
tooltip : 'Delete Plant',
scope : this,
handler : function(view, rowIndex, colIndex,item, e, record, row) {
var mygrid = view.up('grid');
mygrid.fireEvent('deleteRecord',mygrid,record,rowIndex,row);
}
}]
}
]
},
{
xtype:'button',
itemId: 'addpinv',
text: 'Add Principal Investigator'
}
]
},{
xtype: 'fieldset',
itemId: 'genprops',
collapsible: true,
layout : {
type : 'anchor'
},
items:[
{
xtype : 'combo',
fieldLabel : 'Original language',
itemId : 'genlanguage',
name : 'lang',
valueField : 'indice',
valueNotFoundText : 'Language not found',
store : 'common.Language',
displayField : 'nameSelf',
autoSelect : true,
forceSelection : true,
anchor : '100%'
},
{
xtype : 'textareafield',
fieldLabel : 'Study Title',
itemId : 'studytitle',
name : 'studytitle',
allowBlank : false,
anchor:'98%',
value : ''
},
{
xtype : 'textareafield',
fieldLabel : 'Alternative title',
itemId : 'altitle',
allowBlank : false,
anchor:'98%',
name : 'altitle',
value : ''
},
{
xtype : 'textareafield',
fieldLabel : 'Study abstract',
itemId : 'stabstract',
name : 'stabstract',
height: 50,
anchor:'98%',
value : ''
},
{
xtype : 'textareafield',
fieldLabel : 'Weighting',
itemId : 'weighting',
name : 'weighting',
anchor:'98%',
height: 30,
value : ''
},
{
xtype : 'textareafield',
fieldLabel : 'Unit analysis',
itemId : 'analysisunit',
name : 'analysisunit',
anchor:'98%',
height: 30,
value : ''
},
{
xtype : 'textareafield',
fieldLabel : 'Universe',
itemId : 'universe',
name : 'universe',
anchor:'98%',
height: 30,
value : ''
},
{
xtype : 'textareafield',
fieldLabel : 'Geographic coverage',
itemId : 'geocoverage',
name : 'geocoverage',
anchor:'98%',
height: 50,
value : ''
},
{
xtype : 'textareafield',
fieldLabel : 'Geographic unit',
itemId : 'geounit',
name : 'geounit',
height: 50,
anchor:'98%',
value : ''
},
{
xtype : 'textareafield',
fieldLabel : 'Research instrument',
itemId : 'resinstrument',
name : 'resinstrument',
height: 50,
anchor:'98%',
value : ''
}
]
}]
} ]
});
| cosminrentea/roda | src/main/webapp/RODAdmin/app/view/studies/CBEditor/studyadd/sProposal.js | JavaScript | gpl-3.0 | 8,156 |
Ext.define('PMDMeta.store.datacite.FundingReference', {
extend: 'Ext.data.Store',
model: 'PMDMeta.model.datacite.FundingReference',
storeId: 'DataCiteFundingReference',
proxy:{
type: 'memory',
reader:{
type: 'xml',
record: 'fundingReference',
rootProperty: 'resource'
}
},
asXML: function (){
var ret="";
var result="";
this.each(function(data){
ret+=data.asXML();
});
if (ret.length>0)
result="<fundingReferences>"+ret+"</fundingReferences>";
return result;
}
});
| ulbricht/pmdmeta | app/store/datacite/FundingReference.js | JavaScript | gpl-3.0 | 704 |
'use strict';
angular.module('snakeeyesApp')
.controller('ResetFinishController', function ($scope, $stateParams, $timeout, Auth) {
$scope.keyMissing = $stateParams.key === undefined;
$scope.doNotMatch = null;
$scope.resetAccount = {};
$timeout(function (){angular.element('[ng-model="resetAccount.password"]').focus();});
$scope.finishReset = function() {
if ($scope.resetAccount.password !== $scope.confirmPassword) {
$scope.doNotMatch = 'ERROR';
} else {
Auth.resetPasswordFinish({key: $stateParams.key, newPassword: $scope.resetAccount.password}).then(function () {
$scope.success = 'OK';
}).catch(function (response) {
$scope.success = null;
$scope.error = 'ERROR';
});
}
};
});
| capaximperii/LocaLoca | snakeeyes/templates/scripts/app/account/reset/finish/reset.finish.controller.js | JavaScript | gpl-3.0 | 906 |
var searchData=
[
['o',['o',['../classBGLmodels_1_1calcuBmumu.html#a77834dd2775d7653f02d6067c6587533',1,'BGLmodels::calcuBmumu::o()'],['../classcalcuba.html#ae51563e8ba917980a5601ca076f448da',1,'calcuba::o()'],['../classcalcuex.html#ac59e1c48543b43de37c44e46a4e6a3b3',1,'calcuex::o()']]],
['observable',['observable',['../classobservable.html',1,'observable'],['../classobservable.html#a110f9ae99ece3dcab7684dd48cfcbf1a',1,'observable::observable()']]],
['obsvalue',['obsvalue',['../classBGLmodels_1_1calcuBmumu.html#a268942ac564d432e89c71254452cedbc',1,'BGLmodels::calcuBmumu']]],
['operator_28_29',['operator()',['../classBGLmodels_1_1calcuOblique.html#a29ce5a5891bcbd50f58958a15596f7f7',1,'BGLmodels::calcuOblique::operator()()'],['../classBGLmodels_1_1calcubtosgamma2.html#a0ddca50a2df2db45b7d83730b8ff785b',1,'BGLmodels::calcubtosgamma2::operator()()'],['../classBGLmodels_1_1calcuBmumu.html#aac2b8cd4637348df63464ef8f86fcdd6',1,'BGLmodels::calcuBmumu::operator()()'],['../classcalcu.html#aab7908fcdde2f03b10d0962269f49f42',1,'calcu::operator()()'],['../classcalcuba.html#a335018e9c31957034ce719ac59a7f9ee',1,'calcuba::operator()()'],['../classcalcuex.html#a318684b907ce68ce6bda78a466d449d8',1,'calcuex::operator()()']]],
['operator_2a',['operator*',['../classmeasure.html#a7712123bbf8798d699632a1d0f6cee9c',1,'measure::operator*()'],['../namespacestd.html#a92fd2128f54c622cac57dc90a9a7bad1',1,'std::operator*()']]],
['operator_2b',['operator+',['../namespacestd.html#a35a9ba1caf479440351b76360862dcab',1,'std']]],
['operator_2f',['operator/',['../classmeasure.html#ab91d0b37d04ce96ca4f34b5c2858308a',1,'measure']]]
];
| leonardopedro/flavour | docs/search/all_e.js | JavaScript | gpl-3.0 | 1,638 |
var class_array =
[
[ "addAt", "class_array.html#a1afdbcfdc764a8c4f1d844e6aa1ce05e", null ],
[ "addAtEnd", "class_array.html#aea2bcb46d72d1d5192114ae3bedca917", null ],
[ "firstElement", "class_array.html#ab9f9b172613ba77ea4dd19a797b2ff8b", null ],
[ "indexLastElement", "class_array.html#a52d154878577a86cabd64332441fe249", null ],
[ "lastElement", "class_array.html#a4bdf95622b9e951da2d311c6f294dc22", null ],
[ "removeLast", "class_array.html#a4bf4bae5767b7e50259ba59650306ac1", null ]
]; | kevin-barbier/js-bricks | doc/html/class_array.js | JavaScript | gpl-3.0 | 515 |
var searchData=
[
['calcexp',['calcExp',['../classenemies_1_1Enemy.html#a32e1351fdc82bd5193eacbcd553f48c0',1,'enemies::Enemy']]],
['calcgold',['calcGold',['../classenemies_1_1Enemy.html#a289577dde02ce055d318935dc3095e99',1,'enemies::Enemy']]],
['cancel',['Cancel',['../classgui_1_1Menu.html#a11aef8ceb9da73f637311681d681dcff',1,'gui.Menu.Cancel()'],['../classgui_1_1MainMenu.html#a3035a4a23d82ec8de6691d104bfe6db8',1,'gui.MainMenu.Cancel()'],['../classgui_1_1PauseMenu.html#ac975584badf30d5e8a10d0b43894bd1f',1,'gui.PauseMenu.Cancel()'],['../classgui_1_1ShopBuyMenu.html#a813f67bdb1db9366a02eb39b95819cdd',1,'gui.ShopBuyMenu.Cancel()'],['../classgui_1_1ShopSellMenu.html#a0e66be2b9c6054b3470e580fe1a65f06',1,'gui.ShopSellMenu.Cancel()']]],
['charactercreator',['CharacterCreator',['../classgui_1_1CharacterCreator.html',1,'gui']]],
['clearobjects',['clearObjects',['../classgraphics_1_1GraphicsEngine.html#a556534d190147072b2dc6448eff6e08b',1,'graphics::GraphicsEngine']]],
['closed',['closed',['../classgui_1_1Menu.html#a46ec69e40651da6bfafee27d93aec57a',1,'gui::Menu']]],
['color',['Color',['../namespacegui.html#ac3da6e6428ac198381827c7c31e7e3d8',1,'gui']]],
['colorbold',['ColorBold',['../namespacegui.html#a38b4f88d04836af34807652633d4031c',1,'gui']]],
['colordark',['ColorDark',['../namespacegui.html#a022fe54661a1a062c9be6051fe558642',1,'gui']]],
['colordisable',['ColorDisable',['../namespacegui.html#a48e72bb8e1e56db254d5ad4dd55ac28a',1,'gui']]],
['colorfont',['ColorFont',['../namespacegui.html#a823f9f4d7ac76693097d157b9af35567',1,'gui']]],
['colorsel',['ColorSel',['../namespacegui.html#a8ddb491c06d31ee537d727d769a7d021',1,'gui']]],
['composite',['composite',['../classgraphics_1_1GraphicsEngine.html#a4d25982e13f3eb5e819eeb271326031c',1,'graphics.GraphicsEngine.composite()'],['../classgraphics_1_1BattleGraphicsEngine.html#a8a1a8a07a44a2d6b5d040dc220d86d97',1,'graphics.BattleGraphicsEngine.composite()']]],
['constructanimations',['constructAnimations',['../classplayer_1_1Player.html#a5d346b56a05beb26a955b707f98a536f',1,'player::Player']]],
['constructbattleanimations',['constructBattleAnimations',['../classplayer_1_1Player.html#a59c762e04689a9c0af7715e44fbe6ac6',1,'player::Player']]],
['cont',['Cont',['../classgui_1_1Dialog.html#ab3e9ba9adc5ac91d89cfe04f1f743667',1,'gui::Dialog']]],
['convooptions',['convoOptions',['../classgui_1_1Dialog.html#a1a0d82e230ead3b743c64560c96fff23',1,'gui::Dialog']]],
['convotext',['convoText',['../classgui_1_1Dialog.html#a3c6b2f24520b38d2422f14c3a4bec5de',1,'gui::Dialog']]],
['copy',['copy',['../classgraphics_1_1ScaledScreen.html#a20d62582aa80aa8ccfccc3e85990a811',1,'graphics::ScaledScreen']]],
['creator',['Creator',['../namespaceplayer.html#af32f6c877eebd5f5d56e7cb4ec7c4fa3',1,'player']]]
];
| markbreynolds/ARPGEngine | docs/html/search/all_3.js | JavaScript | gpl-3.0 | 2,795 |
import { TabNavigator } from 'react-navigation';
import NavTabBarTop from '../../Nav/NavTabBarTop';
import { MatchList, Table, PlayerStatsList } from '../../components';
import Routes from '../../config/routes';
import S from '../../lib/strings';
export default TabNavigator(
{
[Routes.TAB_LEAGUE_MATCHES]: {
screen: MatchList.Selectable,
navigationOptions: { title: S.MATCHES },
},
[Routes.TAB_TABLE]: {
screen: Table,
navigationOptions: { title: S.TABLE },
},
[Routes.TAB_PLAYER_STATS]: {
screen: PlayerStatsList,
navigationOptions: { title: S.STATISTICS },
},
},
{
...NavTabBarTop,
initialRouteName: Routes.TAB_TABLE,
},
);
| arnef/ligatool-hamburg | app/routes/League/index.js | JavaScript | gpl-3.0 | 705 |
define([
'Atem-Errors/errors'
, 'Atem-CPS-Toolkit/dataTransformationCaches/_DataTransformationCache'
, 'Atem-Pen-Case/pens/RecordingAndComparingPointPen'
, 'Atem-Pen-Case/pens/TransformPointPen'
, 'Atem-Pen-Case/pens/PointToSegmentPen'
, 'Atem-MOM/rendering/basics'
], function(
errors
, Parent
, RecordingAndComparingPointPen
, TransformPointPen
, PointToSegmentPen
, renderingBasics
) {
"use strict";
var ValueError = errors.Value
, KeyError = errors.Key
, applyGlyph = renderingBasics.applyGlyph
;
/**
* The methods of renderer should have the signature: (momGlyph, pointPen);
* The results of rendering are cached in a RecordingAndComparingPointPen
*
* Note that `glyph` and `component` are not rendered by renderer
* even if renderer defines them
*
* var item = myDrawPointsProvider.get(momNode [, callback, firstArgOfCallback])
* var pointPen = MyCoolPointPen()
*
* item.value.drawPoints(pointPen);
*
* // When the path changes callback will be called:
* callback(firstArgOfCallback, _channel, eventData);
* // you can ignore _channel, eventData is probably always: {type: 'points-changed'}
* // so when this event fires it's good when you have `item` around
* // the you can draw it again
* item.value.drawPoints(pointPen);
*
* // when done, do this:
* item.destroy()
*/
function DrawPointsProvider(renderer) {
Parent.call(this);
this._renderer = renderer;
this._schedulingTimeout = 5;
}
var _p = DrawPointsProvider.prototype = Object.create(Parent.prototype);
_p.constructor = DrawPointsProvider;
_p.supports = function(type) {
return type === 'glyph' || type === 'component' || type in this._renderer;
};
_p._drawPointsGlyphChild = function (item, pen) {
item.recorder.drawPoints(pen);
};
_p._drawPointsComponent = function (item, pen) {
var tPen = new TransformPointPen(pen, item.transformation);
item.subscription.value.drawPoints(tPen);
};
_p._drawPointsGlyph = function (item, pen) {
var subscriptions = item.subscriptions
, i, l
;
for(i=0,l=subscriptions.length;i<l;i++)
subscriptions[i].value.drawPoints(pen);
};
/**
* Used for both glyph and component, because they use this service
* recursiveley.
*/
_p._childUpdated = function(item, _channel, _eventData) {
//jshint unused:vars
item.childUpdated = true;
this._requestUpdate(item.mom);
};
_p._revokeItems = function(items) {
var i,l;
for(i=0,l=items.length;i<l;i++)
items[i].destroy();
};
_p._componentUpdate = function(item) {
var oldTransformation = item.transformation
, changed, componentGlyph
;
item.transformation = item.mom.getComputedStyle().get( 'transformation' );
// If child updated this changed in any case
changed = item.childUpdated
|| !oldTransformation // only initially
|| !item.transformation.cmp(oldTransformation);
// reset the flag
item.childUpdated = false;
// Currently we won't get noticed when baseGlyphName changed.
// Another case woll be when componentGlyph ccan cease to
// exist, which is leagal for a component, to reference a
// non existant glyph.
if(item.glyphName !== item.mom.baseGlyphName) {
// so this happens yet only initially once
item.glyphName = item.mom.baseGlyphName;
changed = true;
if(item.subscription)
item.subscription.destroy();
item.subscription = null;
// may not exist (that's legal in UFO)
componentGlyph = item.mom.master.query('glyph#' + item.glyphName);
if(componentGlyph) {
item.subscription = this.get(componentGlyph, [this, '_childUpdated'], item);
}
}
if(changed)
return {type: 'points-changed'};
};
_p._glyphUpdate = function(item) {
// If a child updated this changed in any case
var changed = item.childUpdated;
item.childUpdated = false;
// No need to update on glyph "CPS-change", because
// all the influences that change outlines are covered by the
// child element listeners. The glyph itself does not draw
// anything to the canvas.
if(changed)
return {type: 'points-changed'};
};
_p._glyphChildUpdate = function(item) {
var oldCommands = item.recorder ? item.recorder.getCommands() : false
, rollbackRecorder = item.recorder
;
item.recorder = new RecordingAndComparingPointPen(oldCommands || []);
try {
// duck typing a "glyph" for the standard drawing function
// NOTE: if item.mom.type is not registered there,
// nothing will be drawn!
// drawPoints ...
applyGlyph(this._renderer, {children: [item.mom]}, item.recorder);
}
catch(e) {
// FIXME:
console.warn('Drawing MOM Node', item.mom.particulars, 'failed with ' + e, e.stack);
if(e instanceof KeyError)
console.info('KeyError means usually that a property definition in the CPS is missing');
console.info('The user should get informed by the UI!');
// attempt to fail gracefully
item.recorder = rollbackRecorder || new RecordingAndComparingPointPen([]);
item.recorder.changed = false;
}
if(item.recorder.changed || !oldCommands)
// if not this.recorder.changed we still want to create
// the event if this was the first run of update. This means
// the item is 'empty' To enable proper initialization.
return {type: 'points-changed'};
};
_p._initComponent = function(item) {
item.glyphName = null;
item.subscription = null;
item.transformation = null;
item.childUpdated = false;
item.drawPointsExport = this._drawPointsComponent.bind(this, item);
item.update = this._componentUpdate.bind(this, item);
};
_p._initGlyph = function(item) {
var children = item.mom.children
, child, i, l
, subscription, subscriptions
;
item.subscriptions = subscriptions = [];
item.childUpdated = false;
// TODO: (when we do MOM manipulation)
// ComponentGlyph.on('mom-change') ... is not yet available.
// Things that don't happen yet but will happen in the future:
// Need to update if glyph ceases to exist.
// Need to update if glyph changes it's contents,
// i.e. more or less penstrokes etc.
for(i=0,l=children.length;i<l;i++) {
child = children[i];
if(!this.supports(child.type))
continue;
subscription = this.get(child, [this, '_childUpdated'], item);
item.subscriptions.push(subscription);
}
item.drawPointsExport = this._drawPointsGlyph.bind(this, item);
item.update = this._glyphUpdate.bind(this, item);
};
_p._initGlyphChild = function(item) {
item.recorder = null;
item.drawPointsExport = this._drawPointsGlyphChild.bind(this, item);
item.update = this._glyphChildUpdate.bind(this, item);
};
/**
* Return an object with one public method `update` which is called
* when the momNode triggers its "CPS-change" event.
*/
_p._itemFactory = function (momNode) {
if(!this.supports(momNode.type))
throw new ValueError('Node type not supported :' + momNode);
var item = {
mom: momNode
, drawPointsExport: null
, update: null
};
if(momNode.type === 'glyph')
this._initGlyph(item);
else if(momNode.type === 'component')
this._initComponent(item);
else
this._initGlyphChild(item);
// initialize
item.update();
return item;
};
/**
* Clean up all the state that _itemFactory or the operation of the item created.
* The item will be deleted and not be called again;
*/
_p._destroyItem = function (item) {
if(item.subscription)
item.subscription.destroy();
if(item.subscriptions)
this._revokeItems(item.subscriptions);
// nothing else to do: the MOM Node subscription will be
// destroyed by the super class
};
/**
* Return an object upon which a user of this service will base it's operation;
* see _p.get
*/
_p._getUserItem = function(item) {
// we really need only this method to be exported
return {
drawPoints: item.drawPointsExport
};
};
return DrawPointsProvider;
});
| graphicore/Atem-MOM-Toolkit | lib/dataTransformationCaches/DrawPointsProvider.js | JavaScript | gpl-3.0 | 9,113 |
(function(d3custom, $, undefined) {
d3custom.run = function() {
var objTypes = [];
var data_test = [[850,740,500,400,600,720],[830,650,500,600,720,580]];
var data = d3custom.data;
//check if we have values to work with
if(!data || !data.elements) {
$("#viz").prepend($('<div class="alert">No matching data found. Please check your filter setting.</div>'));
return;
}
var days = [],
hours = [],
counter = 0,
daysMin = 0,
daysMax = 0,
hoursMin = 0,
hoursMax = 0;
//Seperating days per week and hours per day results and calculating Min and Max Values for domain setup
$.each(data.elements, function(i,v) {
// if(counter<28){
console.log("DaysMin: "+daysMin+" DaysMax: "+daysMax+ " UW: "+v.upperWhisker+ " LW: "+v.lowerWhisker);
// "+" Prefix on strings make JS recognize them as numbers
if(v.lowerWhisker){
if(+v.lowerWhisker < +daysMin) daysMin = v.lowerWhisker;
} else v.lowerWhisker = 0;
if(v.upperWhisker){
if(+v.upperWhisker > +daysMax) daysMax = v.upperWhisker;
} else v.upperWhisker = 0;
if(!v.lowerQuartil) v.lowerQuartil=0;
if(!v.upperQuartil) v.upperQuartil=0;
if(!v.median) v.median=0;
days.push(v);
//} else {
// "+" Prefix on strings make JS recognize them as numbers
// if(v.lowerWhisker){
// if(+v.lowerWhisker < +hoursMin) hoursMin = v.lowerWhisker;
// } else v.lowerWhisker=0;
// if(v.upperWhisker) {
// if(+v.upperWhisker > +hoursMax) hoursMax = v.upperWhisker;
// } else v.upperWhisker=0;
// if(!v.lowerQuartil) v.lowerQuartil=0;
// if(!v.upperQuartil) v.upperQuartil=0;
// if(!v.median) v.median=0;
// hours.push(v);
// }
counter++;
});
console.log("DaysMin: "+daysMin+" DaysMax: "+daysMax);
var margin = {top: 30, right: 50, bottom: 20, left: 50},
w = 120 - margin.left - margin.right,
h = 500 - margin.top - margin.bottom;
var min = daysMin,
max = daysMax;
if(min == 0 && max == 0) {
$("#viz").prepend($('<div class="alert">No matching data found. Please check your filter setting.</div>'));
return;
}
var vis = d3.box()
.whiskers(iqr(1.5))
.width(w)
.height(h);
vis.domain([min, max]);
var svg = d3.select("#viz").selectAll("svg")
.data(days, function(d, i) { console.log("Name: "+d.name+" UW: "+d.upperWhisker); return d;} );
var svgBox = svg.enter().append("svg")
.attr("class", "box")
.attr("width", w + margin.left + margin.right)
.attr("height", h + margin.bottom + margin.top)
svgBox.append("text")
.attr("class","days")
.attr("x", 0 )
.attr("y", 0)
.attr("transform", "translate(" + (margin.left-8) + "," + 10 + ")")
.text(function(d) {return d.name.toUpperCase();});
svgBox.append("g")
.attr("transform", "translate(" + margin.left + "," + margin.top + ")")
.call(vis);
// d3.select("button").on("click", function() {
// svg.data(hours).call(vis.duration(1000)); // TODO automatic transitions
// svg.selectAll(".days")
// .remove();
// svgBox.append("text")
// .attr("class","hours")
// .attr("x", 0 )
// .attr("y", 0)
// .attr("transform", "translate(" + (margin.left-8) + "," + 10 + ")")
// .text(function(d) {return d.name+":00 h";});
// });
// Returns a function to compute the interquartile range.
function iqr(k) {
return function(d, i) {
var q1 = d.quartiles[0],
q3 = d.quartiles[2],
iqr = (q3 - q1) * k,
i = -1,
j = d.length;
while (d[++i] < q1 - iqr);
while (d[--j] > q3 + iqr);
return [i, j];
};
}
};
})(window.d3custom = window.d3custom || {}, jQuery);
$(document).ready(window.d3custom.run);
| LemoProject/Lemo-Application-Server | src/main/resources/de/lemo/apps/js/d3/backup/d3_custom_BoxPlot.js | JavaScript | gpl-3.0 | 3,914 |
var app = angular.module('app', ['ngRoute']);
var percent=0;
app.controller('suggestionController', function($scope) {
$scope.todos = [
{text:"todo1"},
{text:"todo2"},
{text:"todo3"}
];
});
function getPercent (percentage){
alert(percentage);
percent=percentage;
}
app.controller('percentageController', function($scope) {
$scope.cent = [
{text:"wutup"}
];
});
| unbrace3/Mori | Web/app.js | JavaScript | gpl-3.0 | 420 |
(function ($) {
$.extend($.summernote.lang, {
'nb-NO': {
font: {
bold: 'Fet',
italic: 'Kursiv',
underline: 'Understrek',
clear: 'Fjern formatering',
height: 'Linjehøyde',
name: 'Skrifttype',
strikethrough: 'Gjennomstrek',
size: 'Skriftstørrelse'
},
image: {
image: 'Bilde',
insert: 'Sett inn bilde',
resizeFull: 'Sett full størrelse',
resizeHalf: 'Sett halv størrelse',
resizeQuarter: 'Sett kvart størrelse',
floatLeft: 'Flyt til venstre',
floatRight: 'Flyt til høyre',
floatNone: 'Fjern flyt',
dragImageHere: 'Dra et bilde hit',
selectFromFiles: 'Velg fra filer',
url: 'Bilde-URL',
remove: 'Fjern bilde'
},
video: {
video: 'Video',
videoLink: 'Videolenke',
insert: 'Sett inn video',
url: 'Video-URL',
providers: '(YouTube, Vimeo, Vine, Instagram, DailyMotion eller Youku)'
},
link: {
link: 'Lenke',
insert: 'Sett inn lenke',
unlink: 'Fjern lenke',
edit: 'Rediger',
textToDisplay: 'Visningstekst',
url: 'Til hvilken URL skal denne lenken peke?',
openInNewWindow: 'Åpne i nytt vindu'
},
table: {
table: 'Tabell'
},
hr: {
insert: 'Sett inn horisontal linje'
},
style: {
style: 'Stil',
normal: 'Normal',
blockquote: 'Sitat',
pre: 'Kode',
h1: 'Overskrift 1',
h2: 'Overskrift 2',
h6: 'Overskrift 3',
h4: 'Overskrift 4',
h5: 'Overskrift 5',
h6: 'Overskrift 6'
},
lists: {
unordered: 'Punktliste',
ordered: 'Nummerert liste'
},
options: {
help: 'Hjelp',
fullscreen: 'Fullskjerm',
codeview: 'HTML-visning'
},
paragraph: {
paragraph: 'Avsnitt',
outdent: 'Tilbakerykk',
indent: 'Innrykk',
left: 'Venstrejustert',
center: 'Midtstilt',
right: 'Høyrejustert',
justify: 'Blokkjustert'
},
color: {
recent: 'Nylig valgt farge',
more: 'Flere farger',
background: 'Bakgrunnsfarge',
foreground: 'Skriftfarge',
transparent: 'Gjennomsiktig',
setTransparent: 'Sett gjennomsiktig',
reset: 'Nullstill',
resetToDefault: 'Nullstill til standard'
},
shortcut: {
shortcuts: 'Hurtigtaster',
close: 'Lukk',
textFormatting: 'Tekstformatering',
action: 'Handling',
paragraphFormatting: 'Avsnittsformatering',
documentStyle: 'Dokumentstil'
},
history: {
undo: 'Angre',
redo: 'Gjør om'
}
}
});
})(jQuery);
| taylorsuccessor/baghli | admin/view/javascript/summernote/lang/summernote-nb-NO.js | JavaScript | gpl-3.0 | 2,825 |
var threads = angular.module("threads", ["ngRoute", "ngAnimate"]);
threads.config(function ($routeProvider) {
$routeProvider.when("/thread/:id?/:lower?/:upper?", {
templateUrl: "thread.html", controller: "ThreadController"
})
.otherwise({
redirectTo: "/thread/0"
});
});
threads.filter('order', function () {
return function (posts) {
if (posts.length > 1 && posts[1].thread === 0) {
return posts.sort(function (a, b) { return new Date(b.update) - new Date(a.update) });
}
return posts;
};
});
threads.controller("ThreadController", function ($http, $scope, $location, $routeParams, $interval) {
$scope.addThread = function (post) {
$http.post(mount + $location.path(), post).then(function (response) {
if (response.data.id) {
$scope.posts.push(response.data);
}
$scope.post.title = $scope.post.text = $scope.post.image = "";
}, function (response) {
console.log("Bad Request");
});
}
$scope.getThread = function () {
$http.get(mount + $location.path() + "/" + $scope.posts.length).then(function (response) {
$scope.posts = $scope.posts.concat(response.data.thread);
}, function (response) {
console.log("Error");
});
}
var mount = "/api";
var update = $interval($scope.getThread, 5000);
$scope.$on('$destroy', function () { $interval.cancel(update) });
$scope.inThread = $routeParams.id > 0;
$scope.posts = [];
$scope.getThread();
}); | vukicevic/threads | static/threads-client.js | JavaScript | gpl-3.0 | 1,474 |
var searchData=
[
['enums',['Enums',['../namespacevcvj_1_1_models_1_1_enums.html',1,'vcvj::Models']]],
['exceptions',['Exceptions',['../namespacevcvj_1_1_exceptions.html',1,'vcvj']]],
['grammatical_5fcomponents',['Grammatical_Components',['../namespacevcvj_1_1_models_1_1_grammatical___components.html',1,'vcvj::Models']]],
['grammatical_5fsubcomponents',['Grammatical_Subcomponents',['../namespacevcvj_1_1_models_1_1_grammatical___subcomponents.html',1,'vcvj::Models']]],
['models',['Models',['../namespacevcvj_1_1_models.html',1,'vcvj']]],
['parsers',['Parsers',['../namespacevcvj_1_1_parsers.html',1,'vcvj']]],
['vcvj',['vcvj',['../namespacevcvj.html',1,'']]]
];
| alexqfredrickson/vcvj | docs/html/search/namespaces_0.js | JavaScript | gpl-3.0 | 680 |
"use strict";
var Mutate = window.Mutate || {};
Mutate.GameManager = {
Player: new Mutate.Player(),
currentRound: 0,
maxRounds: 31,
onLoose: new Phaser.Signal(),
onWin: new Phaser.Signal(),
getTheCarHarry: function() {
this.currentRound ++;
Mutate.GameManager.Player.clampStats();
if (Mutate.GameManager.Player.life <= 0)
{
this.onLoose.dispatch("death");
return;
}
if (Mutate.GameManager.Player.tryMutate())
{
this.onWin.dispatch("win");
return;
}
if (this.currentRound > this.maxRounds)
{
this.onLoose.dispatch("old");
return;
}
},
restart: function() {
this.Player = new Mutate.Player();
this.currentRound = 0;
Mutate.game.state.start('Map');
}
} | klausklapper/Teenage-Mutant-Super-Hero | src/gameManager.js | JavaScript | gpl-3.0 | 749 |
// ==UserScript==
// @name IAMS PGI attempt
// @namespace shahid_IAMS
// @description only for PGI exams, attempt all
// @include http://iamsonline.in/pgiftsstart.aspx?sid=*
// @version 1.1b
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js
// @grant none
// @downloadURL https://drmdshahid.github.io/IAMSqa/downloads/IAMS-PGI-attempt.user.js
// @updateURL https://drmdshahid.github.io/IAMSqa/downloads/IAMS-PGI-attempt.meta.js
// @icon https://drmdshahid.github.io/assets/danger-32.png
// ==/UserScript==
/*
------
this is to attempt all the questions in pgi test. so as to get access to their explanations.
How?
new design loads all the questions but displays one at a time and hides others.
u may need to first unhide all.
*/
function fill(n){
var title=n;
/*
var chkt = "0";
if (title >= 11) chkt = (title-1).toString();
else chkt += (title-1).toString();*/
n =parseInt(n)-1;
chkt =(n<10 ? '0':'') + n.toString();
//adding 0 pad to one digit number as string
//var divid = '#dlQuestionList_ctl' + chkt + '_div'; ///not needed
var spanel = "span.chk[title='" + title + "']";
//each option is contained here -internal script considers attempt only when this is clicked
var chkid = '#dlQuestionList_ctl' + chkt + '_chk1';
///_chk1 is 1st, _chk2 is 2nd option & so on. -checking it true is not necessory
var subid = '#dlQuestionList_ctl' + chkt + '_btnSubmit';
///the save&next btn for each question
document.querySelector(spanel).click();
//yes! only first occurance is selected. querySelectorAll returns list
//document.querySelector(chkid).checked = true; ///not needed auto checked by above
document.querySelector(subid).click();
console.log(title+' is marked');
}
////user interface, by adding buttons...
var btn = document.createElement('input');
btn.type='button';
btn.value = 'Attempt';
//btn.className = 'btn btn-round';
document.querySelector('ul.navbar-nav').appendChild(btn);
var allbtn = document.createElement('input');
allbtn.type='button';
allbtn.value = 'Attempt all';
document.querySelector('ul.navbar-nav').appendChild(allbtn);
var show = document.createElement('input');
show.type='button';
show.value = 'Unhide all';
document.querySelector('ul.navbar-nav').appendChild(show);
var endbtn = document.createElement('input');
endbtn.type='button';
endbtn.value = 'End';
document.querySelector('ul.navbar-nav').appendChild(endbtn);
//assigning actions
btn.onclick = one;
allbtn.onclick=all;
show.onclick=unhide;
endbtn.onclick=end;
//console.log('ready');
////attempt a specific question
function one(){
var qno = window.prompt('Enter Question number:', 3);
fill(qno);
/*if(qno == null) return;//fill(qno);
//console.log(qno+'marked');
var chkt = "0";
if (title >= 11) chkt = (qno-1).toString();
else chkt += (qno-1).toString();
var chkbox = document.querySelector('#dlQuestionList_ctl' + chkt + '_pnlCheckBox');
var options= chkbox.getElementsByTagName('input').length;
var ans='';
for(;options>0;options--)ans+='T';
console.log(ans);
postans(qno,ans);*/
}
//// attempt all!
function all(){
var i=0;
var task = setInterval(
function(){ fill(++i);
/*console.log(i);*/
if(i==248)clearInterval(task); //to safely stop at q248
}, 500);
}
function unhide(){
// can run this at last....
// adding a style element to head
// this is by selecting elements whose id starts with 'dlQuestionList_ctl'
//
var sty = document.createElement("STYLE");
var t = document.createTextNode("div[id^='dlQuestionList_ctl'] {display: block !important;}");
sty.appendChild(t);
document.head.appendChild(sty);
}
function end(){
if (confirm('Sure to End the Test?'))document.querySelector('#btnEndTest').click();
}
/*
function postans(quesid,userans){
$.ajax({
type: "POST",
url: "pgiftsstart.aspx/GreenSubmit",
data: "{QuesID: " + quesid + ", UserAnswer:'" + userans + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(response) {
console.log('posted:'+quesid+' --'+response);
},
failure: function(response) {
console.log('FAILED!:'+quesid+' --'+response);
}
});
}*/
| drmdshahid/IAMSqa | downloads/IAMS-PGI-attempt.user.js | JavaScript | gpl-3.0 | 4,372 |
var group__VF6xx =
[
[ "CCM", "group__ccm__file.html", "group__ccm__file" ],
[ "GPIO", "group__VF6xx__gpio.html", "group__VF6xx__gpio" ],
[ "IOMUX-Control", "group__VF6xx__iomuxc.html", "group__VF6xx__iomuxc" ],
[ "UART", "group__VF6xx__uart.html", "group__VF6xx__uart" ]
]; | Aghosh993/TARS_codebase | libopencm3/doc/vf6xx/html/group__VF6xx.js | JavaScript | gpl-3.0 | 290 |
/** Amazing Slider - Responsive jQuery Slider and Image Scroller
* Copyright 2013 Magic Hills Pty Ltd All Rights Reserved
* * Version 1.7
*/
(function($){$.fn.html5lightbox=function(options){var inst=this;inst.options=jQuery.extend({autoplay:true,html5player:true,overlaybgcolor:"#000000",overlayopacity:0.9,bgcolor:"#ffffff",bordersize:8,barheight:36,loadingwidth:64,loadingheight:64,resizespeed:400,fadespeed:400,skinfolder:"skins/",loadingimage:"lightbox-loading.gif",nextimage:"lightbox-next.png",previmage:"lightbox-prev.png",closeimage:"lightbox-close.png",playvideoimage:"lightbox-playvideo.png",titlecss:"{color:#333333; font-size:16px; font-family:Armata,sans-serif,Arial; overflow:hidden; white-space:nowrap;}",
errorwidth:280,errorheight:48,errorcss:"{text-align:center; color:#ff0000; font-size:14px; font-family:Arial, sans-serif;}",supportesckey:true,supportarrowkeys:true,version:"1.8",stamp:false,freemark:"html5box.com",freelink:"http://html5box.com/",watermark:"",watermarklink:""},options);if(typeof html5lightbox_options!="undefined"&&html5lightbox_options)jQuery.extend(inst.options,html5lightbox_options);inst.options.htmlfolder=window.location.href.substr(0,window.location.href.lastIndexOf("/")+1);if(inst.options.skinfolder.charAt(0)!=
"/"&&inst.options.skinfolder.substring(0,5)!="http:"&&inst.options.skinfolder.substring(0,6)!="https:")inst.options.skinfolder=inst.options.jsfolder+inst.options.skinfolder;inst.options.types=["IMAGE","FLASH","VIDEO","YOUTUBE","VIMEO","PDF","MP3","WEB"];inst.elemArray=new Array;inst.options.curElem=-1;inst.options.flashInstalled=false;try{if(new ActiveXObject("ShockwaveFlash.ShockwaveFlash"))inst.options.flashInstalled=true}catch(e){if(navigator.mimeTypes["application/x-shockwave-flash"])inst.options.flashInstalled=
true}inst.options.html5VideoSupported=!!document.createElement("video").canPlayType;inst.options.isChrome=navigator.userAgent.match(/Chrome/i)!=null;inst.options.isFirefox=navigator.userAgent.match(/Firefox/i)!=null;inst.options.isOpera=navigator.userAgent.match(/Opera/i)!=null;inst.options.isSafari=navigator.userAgent.match(/Safari/i)!=null;inst.options.isIE=navigator.userAgent.match(/MSIE/i)!=null&&!inst.options.isOpera;inst.options.isIE9=inst.options.isIE&&inst.options.html5VideoSupported;inst.options.isIE678=
inst.options.isIE&&!inst.options.isIE9;inst.options.isIE6=navigator.userAgent.match(/MSIE 6/i)!=null&&!inst.options.isOpera;inst.options.isAndroid=navigator.userAgent.match(/Android/i)!=null;inst.options.isIPad=navigator.userAgent.match(/iPad/i)!=null;inst.options.isIPhone=navigator.userAgent.match(/iPod/i)!=null||navigator.userAgent.match(/iPhone/i)!=null;inst.options.isMobile=inst.options.isAndroid||inst.options.isIPad||inst.options.isIPhone;inst.options.isIOSLess5=inst.options.isIPad&&inst.options.isIPhone&&
(navigator.userAgent.match(/OS 4/i)!=null||navigator.userAgent.match(/OS 3/i)!=null);inst.options.supportCSSPositionFixed=!inst.options.isIE6&&!inst.options.isIOSLess5;inst.options.resizeTimeout=-1;var inst=this;inst.init=function(){inst.showing=false;inst.readData();inst.createMarkup();inst.supportKeyboard()};var ELEM_TYPE=0,ELEM_HREF=1,ELEM_TITLE=2,ELEM_GROUP=3,ELEM_WIDTH=4,ELEM_HEIGHT=5,ELEM_HREF_WEBM=6,ELEM_HREF_OGG=7;inst.readData=function(){inst.each(function(){if(this.nodeName.toLowerCase()!=
"a")return;var $this=$(this);var fileType=inst.checkType($this.attr("href"));if(fileType<0)return;inst.elemArray.push(new Array(fileType,$this.attr("href"),$this.attr("title"),$this.data("group"),$this.data("width"),$this.data("height"),$this.data("webm"),$this.data("ogg")))})};inst.createMarkup=function(){var fontRef=("https:"==document.location.protocol?"https":"http")+"://fonts.googleapis.com/css?family=Armata";var fontLink=document.createElement("link");fontLink.setAttribute("rel","stylesheet");
fontLink.setAttribute("type","text/css");fontLink.setAttribute("href",fontRef);document.getElementsByTagName("head")[0].appendChild(fontLink);var styleCss="#html5-text "+inst.options.titlecss;styleCss+=".html5-error "+inst.options.errorcss;$("head").append("<style type='text/css'>"+styleCss+"</style>");inst.$lightbox=jQuery("<div id='html5-lightbox' style='display:none;top:0px;left:0px;width:100%;height:100%;z-index:9999999;'>"+"<div id='html5-lightbox-overlay' style='display:block;position:absolute;top:0px;left:0px;width:100%;height:100%;background-color:"+
inst.options.overlaybgcolor+";opacity:"+inst.options.overlayopacity+";filter:alpha(opacity="+Math.round(inst.options.overlayopacity*100)+");'></div>"+"<div id='html5-lightbox-box' style='display:block;position:relative;margin:0px auto;overflow:hidden;'>"+"<div id='html5-elem-box' style='display:block;position:relative;margin:0px auto;text-align:center;'>"+"<div id='html5-elem-wrap' style='display:block;position:relative;margin:0px auto;text-align:center;background-color:"+inst.options.bgcolor+";'>"+
"<div id='html5-loading' style='display:none;position:absolute;top:0px;left:0px;text-align:center;width:100%;height:100%;background:url(\""+inst.options.skinfolder+inst.options.loadingimage+"\") no-repeat center center;'></div>"+"<div id='html5-error' class='html5-error' style='display:none;position:absolute;padding:"+inst.options.bordersize+"px;text-align:center;width:"+inst.options.errorwidth+"px;height:"+inst.options.errorheight+"px;'>"+"The requested content cannot be loaded.<br />Please try again later."+
"</div>"+"<div id='html5-image' style='display:none;position:absolute;top:0px;left:0px;padding:"+inst.options.bordersize+"px;text-align:center;'></div>"+"</div>"+"<div id='html5-next' style='display:none;cursor:pointer;position:absolute;right:"+inst.options.bordersize+"px;top:40%;'><img src='"+inst.options.skinfolder+inst.options.nextimage+"'></div>"+"<div id='html5-prev' style='display:none;cursor:pointer;position:absolute;left:"+inst.options.bordersize+"px;top:40%;'><img src='"+inst.options.skinfolder+
inst.options.previmage+"'></div>"+"</div>"+"<div id='html5-elem-data-box' style='display:none;position:relative;width:100%;margin:0px auto;height:"+inst.options.barheight+"px;background-color:"+inst.options.bgcolor+";'>"+"<div id='html5-text' style='display:block;float:left;overflow:hidden;margin-left:"+inst.options.bordersize+"px;'></div>"+"<div id='html5-close' style='display:block;cursor:pointer;float:right;margin-right:"+inst.options.bordersize+"px;'><img src='"+inst.options.skinfolder+inst.options.closeimage+
"'></div>"+"</div>"+"<div id='html5-watermark' style='display:none;position:absolute;left:"+String(inst.options.bordersize+2)+"px;top:"+String(inst.options.bordersize+2)+"px;'></div>"+"</div>"+"</div>");inst.$lightbox.css({position:inst.options.supportCSSPositionFixed?"fixed":"absolute"});inst.$lightbox.appendTo("body");inst.$lightboxBox=$("#html5-lightbox-box",inst.$lightbox);inst.$elem=$("#html5-elem-box",inst.$lightbox);inst.$elemWrap=$("#html5-elem-wrap",inst.$lightbox);inst.$loading=$("#html5-loading",
inst.$lightbox);inst.$error=$("#html5-error",inst.$lightbox);inst.$image=$("#html5-image",inst.$lightbox);inst.$elemData=$("#html5-elem-data-box",inst.$lightbox);inst.$text=$("#html5-text",inst.$lightbox);inst.$next=$("#html5-next",inst.$lightbox);inst.$prev=$("#html5-prev",inst.$lightbox);inst.$close=$("#html5-close",inst.$lightbox);inst.$watermark=$("#html5-watermark",inst.$lightbox);if(inst.options.stamp)inst.$watermark.html("<a href='"+inst.options.freelink+"' style='text-decoration:none;'><div style='display:block;width:120px;height:20px;text-align:center;border-radius:5px;-moz-border-radius:5px;-webkit-border-radius:5px;filter:alpha(opacity=60);opacity:0.6;background-color:#333333;color:#ffffff;font:12px Armata,sans-serif,Arial;'><div style='line-height:20px;'>"+
inst.options.freemark+"</div></div></a>");else if(inst.options.watermark){var html="<img src='"+inst.options.watermark+"' style='border:none;' />";if(inst.options.watermarklink)html="<a href='"+inst.options.watermarklink+"' target='_blank'>"+html+"</a>";inst.$watermark.html(html)}$("#html5-lightbox-overlay",inst.$lightbox).click(inst.finish);inst.$close.click(inst.finish);inst.$next.click(function(){inst.gotoSlide(-1)});inst.$prev.click(function(){inst.gotoSlide(-2)});$(window).resize(function(){if(!inst.options.isMobile){clearTimeout(inst.options.resizeTimeout);
inst.options.resizeTimeout=setTimeout(function(){inst.resizeWindow()},500)}});$(window).scroll(function(){inst.scrollBox()});$(window).bind("orientationchange",function(e){if(inst.options.isMobile)inst.resizeWindow()});inst.enableSwipe()};inst.calcNextPrevElem=function(){inst.options.nextElem=-1;inst.options.prevElem=-1;var j,curGroup=inst.elemArray[inst.options.curElem][ELEM_GROUP];if(curGroup!=undefined&&curGroup!=null){for(j=inst.options.curElem+1;j<inst.elemArray.length;j++)if(inst.elemArray[j][ELEM_GROUP]==
curGroup){inst.options.nextElem=j;break}if(inst.options.nextElem<0)for(j=0;j<inst.options.curElem;j++)if(inst.elemArray[j][ELEM_GROUP]==curGroup){inst.options.nextElem=j;break}if(inst.options.nextElem>=0){for(j=inst.options.curElem-1;j>=0;j--)if(inst.elemArray[j][ELEM_GROUP]==curGroup){inst.options.prevElem=j;break}if(inst.options.prevElem<0)for(j=inst.elemArray.length-1;j>inst.options.curElem;j--)if(inst.elemArray[j][ELEM_GROUP]==curGroup){inst.options.prevElem=j;break}}}};inst.clickHandler=function(){if(inst.elemArray.length<=
0)return true;var $this=$(this);inst.hideObjects();for(var i=0;i<inst.elemArray.length;i++)if(inst.elemArray[i][ELEM_HREF]==$this.attr("href"))break;if(i==inst.elemArray.length)return true;inst.options.curElem=i;inst.options.nextElem=-1;inst.options.prevElem=-1;inst.calcNextPrevElem();inst.$next.hide();inst.$prev.hide();inst.reset();inst.$lightbox.show();if(!inst.options.supportCSSPositionFixed)inst.$lightbox.css("top",$(window).scrollTop());var boxW=inst.options.loadingwidth+2*inst.options.bordersize;
var boxH=inst.options.loadingheight+2*inst.options.bordersize;var boxT=Math.round($(window).height()/2-(boxH+inst.options.barheight)/2);inst.$lightboxBox.css({"margin-top":boxT,"width":boxW,"height":boxH});inst.$elemWrap.css({"width":boxW,"height":boxH});inst.loadCurElem();return false};inst.loadElem=function(elem){inst.showing=true;inst.$elem.unbind("mouseenter").unbind("mouseleave").unbind("mousemove");inst.$next.hide();inst.$prev.hide();inst.$loading.show();switch(elem[ELEM_TYPE]){case 0:var imgLoader=
new Image;$(imgLoader).load(function(){inst.showImage(elem,imgLoader.width,imgLoader.height)});$(imgLoader).error(function(){inst.showError()});imgLoader.src=elem[ELEM_HREF];break;case 1:inst.showSWF(elem);break;case 2:inst.showVideo(elem);break;case 3:case 4:inst.showYoutubeVimeo(elem);break;case 5:inst.showPDF(elem);break;case 6:inst.showMP3(elem);break;case 7:inst.showWeb(elem);break}};inst.loadCurElem=function(){inst.loadElem(inst.elemArray[inst.options.curElem])};inst.showError=function(){inst.$loading.hide();
inst.resizeLightbox(inst.options.errorwidth,inst.options.errorheight,true,function(){inst.$error.show();inst.$elem.fadeIn(inst.options.fadespeed,function(){inst.showData()})})};inst.calcTextWidth=function(objW){var textW=objW-36;if(inst.options.prevElem>0||inst.options.nextElem>0)textW-=36;return textW};inst.showImage=function(elem,imgW,imgH){var elemW,elemH;if(elem[ELEM_WIDTH])elemW=elem[ELEM_WIDTH];else{elemW=imgW;elem[ELEM_WIDTH]=imgW}if(elem[ELEM_HEIGHT])elemH=elem[ELEM_HEIGHT];else{elemH=imgH;
elem[ELEM_HEIGHT]=imgH}var sizeObj=inst.calcElemSize({w:elemW,h:elemH});inst.resizeLightbox(sizeObj.w,sizeObj.h,true,function(){inst.$text.css({width:inst.calcTextWidth(sizeObj.w)});inst.$text.html(elem[ELEM_TITLE]);inst.$image.show().css({width:sizeObj.w,height:sizeObj.h});inst.$image.html("<img src='"+elem[ELEM_HREF]+"' width='"+sizeObj.w+"' height='"+sizeObj.h+"' />");inst.$elem.fadeIn(inst.options.fadespeed,function(){inst.showData()})})};inst.showSWF=function(elem){var dataW=elem[ELEM_WIDTH]?
elem[ELEM_WIDTH]:480;var dataH=elem[ELEM_HEIGHT]?elem[ELEM_HEIGHT]:270;var sizeObj=inst.calcElemSize({w:dataW,h:dataH});dataW=sizeObj.w;dataH=sizeObj.h;inst.resizeLightbox(dataW,dataH,true,function(){inst.$text.css({width:inst.calcTextWidth(dataW)});inst.$text.html(elem[ELEM_TITLE]);inst.$image.html("<div id='html5lightbox-swf' style='display:block;width:"+dataW+"px;height:"+dataH+"px;'></div>").show();inst.embedFlash($("#html5lightbox-swf"),dataW,dataH,elem[ELEM_HREF],"window",{width:dataW,height:dataH});
inst.$elem.show();inst.showData()})};inst.showVideo=function(elem){var dataW=elem[ELEM_WIDTH]?elem[ELEM_WIDTH]:480;var dataH=elem[ELEM_HEIGHT]?elem[ELEM_HEIGHT]:270;var sizeObj=inst.calcElemSize({w:dataW,h:dataH});dataW=sizeObj.w;dataH=sizeObj.h;inst.resizeLightbox(dataW,dataH,true,function(){inst.$text.css({width:inst.calcTextWidth(dataW)});inst.$text.html(elem[ELEM_TITLE]);inst.$image.html("<div id='html5lightbox-video' style='display:block;width:"+dataW+"px;height:"+dataH+"px;'></div>").show();
var isHTML5=false;if(inst.options.isMobile)isHTML5=true;else if((inst.options.html5player||!inst.options.flashInstalled)&&inst.options.html5VideoSupported)if(!inst.options.isFirefox||inst.options.isFirefox&&(elem[ELEM_HREF_OGG]||elem[ELEM_HREF_WEBM]))isHTML5=true;if(isHTML5){var videoSrc=elem[ELEM_HREF];if(inst.options.isFirefox||!videoSrc)videoSrc=elem[ELEM_HREF_WEBM]?elem[ELEM_HREF_WEBM]:elem[ELEM_HREF_OGG];inst.embedHTML5Video($("#html5lightbox-video"),dataW,dataH,videoSrc,inst.options.autoplay)}else{var videoFile=
elem[ELEM_HREF];if(videoFile.charAt(0)!="/"&&videoFile.substring(0,5)!="http:"&&videoFile.substring(0,6)!="https:")videoFile=inst.options.htmlfolder+videoFile;inst.embedFlash($("#html5lightbox-video"),dataW,dataH,inst.options.jsfolder+"html5boxplayer.swf","transparent",{width:dataW,height:dataH,videofile:videoFile,autoplay:inst.options.autoplay?"1":"0",errorcss:".html5box-error"+inst.options.errorcss,id:0})}inst.$elem.show();inst.showData()})};inst.prepareYoutubeHref=function(href){var youtubeId=
"";var regExp=/^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\??v?=?))([^#\&\?]*).*/;var match=href.match(regExp);if(match&&match[7]&&match[7].length==11)youtubeId=match[7];return"http://www.youtube.com/embed/"+youtubeId};inst.showYoutubeVimeo=function(elem){var dataW=elem[ELEM_WIDTH]?elem[ELEM_WIDTH]:480;var dataH=elem[ELEM_HEIGHT]?elem[ELEM_HEIGHT]:270;var sizeObj=inst.calcElemSize({w:dataW,h:dataH});dataW=sizeObj.w;dataH=sizeObj.h;inst.resizeLightbox(dataW,dataH,true,function(){inst.$text.css({width:inst.calcTextWidth(dataW)});
inst.$text.html(elem[ELEM_TITLE]);inst.$image.html("<div id='html5lightbox-video' style='display:block;width:"+dataW+"px;height:"+dataH+"px;'></div>").show();var href=elem[ELEM_HREF];if(elem[ELEM_TYPE]==3)href=inst.prepareYoutubeHref(href);if(inst.options.autoplay)if(href.indexOf("?")<0)href+="?autoplay=1";else href+="&autoplay=1";if(elem[ELEM_TYPE]==3)if(href.indexOf("?")<0)href+="?wmode=transparent&rel=0";else href+="&wmode=transparent&rel=0";$("#html5lightbox-video").html("<iframe width='"+dataW+
"' height='"+dataH+"' src='"+href+"' frameborder='0' webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>");inst.$elem.show();inst.showData()})};inst.showPDF=function(elem){};inst.showMP3=function(elem){};inst.showWeb=function(elem){var dataW=elem[ELEM_WIDTH]?elem[ELEM_WIDTH]:$(window).width();var dataH=elem[ELEM_HEIGHT]?elem[ELEM_HEIGHT]:$(window).height();var sizeObj=inst.calcElemSize({w:dataW,h:dataH});dataW=sizeObj.w;dataH=sizeObj.h;inst.resizeLightbox(dataW,dataH,true,function(){inst.$text.css({width:inst.calcTextWidth(dataW)});
inst.$text.html(elem[ELEM_TITLE]);inst.$image.html("<div id='html5lightbox-web' style='display:block;width:"+dataW+"px;height:"+dataH+"px;'></div>").show();$("#html5lightbox-web").html("<iframe width='"+dataW+"' height='"+dataH+"' src='"+elem[ELEM_HREF]+"' frameborder='0'></iframe>");inst.$elem.show();inst.showData()})};inst.scrollBox=function(){if(!inst.options.supportCSSPositionFixed)inst.$lightbox.css("top",$(window).scrollTop())};inst.resizeWindow=function(){var boxT=Math.round($(window).height()/
2-(inst.$lightboxBox.height()+inst.options.barheight)/2);inst.$lightboxBox.animate({"margin-top":boxT},inst.options.resizespeed)};inst.calcElemSize=function(sizeObj){var h0=$(window).height()-inst.options.barheight-2*inst.options.bordersize;if(sizeObj.h>h0){sizeObj.w=Math.round(sizeObj.w*h0/sizeObj.h);sizeObj.h=h0}var w0=$(window).width()-2*inst.options.bordersize;if(sizeObj.w>w0){sizeObj.h=Math.round(sizeObj.h*w0/sizeObj.w);sizeObj.w=w0}return sizeObj};inst.showData=function(){inst.$elemData.show();
inst.$lightboxBox.animate({height:inst.$lightboxBox.height()+inst.options.barheight},{queue:true,duration:inst.options.resizespeed})};inst.resizeLightbox=function(elemW,elemH,bAnimate,onFinish){var speed=bAnimate?inst.options.resizespeed:0;var boxW=elemW+2*inst.options.bordersize;var boxH=elemH+2*inst.options.bordersize;var boxT=Math.round($(window).height()/2-(boxH+inst.options.barheight)/2);if(boxW==inst.$elemWrap.width()&&boxH==inst.$elemWrap.height())speed=0;inst.$loading.hide();inst.$watermark.hide();
inst.$elem.bind("mouseenter mousemove",function(){if(inst.options.prevElem>=0||inst.options.nextElem>=0){inst.$next.fadeIn();inst.$prev.fadeIn()}});inst.$elem.bind("mouseleave",function(){inst.$next.fadeOut();inst.$prev.fadeOut()});inst.$lightboxBox.animate({"margin-top":boxT},speed,function(){inst.$lightboxBox.css({"width":boxW,"height":boxH});inst.$elemWrap.animate({width:boxW},speed).animate({height:boxH},speed,function(){inst.$loading.show();inst.$watermark.show();onFinish()})})};inst.reset=function(){if(inst.options.stamp)inst.$watermark.hide();
inst.showing=false;inst.$image.empty();inst.$text.empty();inst.$error.hide();inst.$loading.hide();inst.$image.hide();inst.$elemData.hide()};inst.finish=function(){inst.reset();inst.$lightbox.hide();inst.showObjects()};inst.pauseSlide=function(){};inst.playSlide=function(){};inst.gotoSlide=function(slide){if(slide==-1){if(inst.options.nextElem<0)return;inst.options.curElem=inst.options.nextElem}else if(slide==-2){if(inst.options.prevElem<0)return;inst.options.curElem=inst.options.prevElem}inst.calcNextPrevElem();
inst.reset();inst.loadCurElem()};inst.supportKeyboard=function(){$(document).keyup(function(e){if(!inst.showing)return;if(inst.options.supportesckey&&e.keyCode==27)inst.finish();else if(inst.options.supportarrowkeys)if(e.keyCode==39)inst.gotoSlide(-1);else if(e.keyCode==37)inst.gotoSlide(-2)})};inst.enableSwipe=function(){inst.$elem.touchSwipe({preventWebBrowser:true,swipeLeft:function(){inst.gotoSlide(-1)},swipeRight:function(){inst.gotoSlide(-2)}})};inst.hideObjects=function(){$("select, embed, object").css({"visibility":"hidden"})};
inst.showObjects=function(){$("select, embed, object").css({"visibility":"visible"})};inst.embedHTML5Video=function($container,w,h,src,autoplay){$container.html("<div style='position:absolute;display:block;width:"+w+"px;height:"+h+"px;'><video width="+w+" height="+h+(autoplay?" autoplay":"")+" controls='controls' src='"+src+"'></div>");if(inst.options.isAndroid){var $play=$("<div style='position:absolute;display:block;cursor:pointer;width:"+w+"px;height:"+h+'px;background:url("'+inst.options.skinfolder+
inst.options.playvideoimage+"\") no-repeat center center;'></div>").appendTo($container);$play.unbind("click").click(function(){$("video",$(this).parent())[0].play()})}};inst.embedFlash=function($container,w,h,src,wmode,flashVars){if(inst.options.flashInstalled){var htmlOptions={pluginspage:"http://www.adobe.com/go/getflashplayer",quality:"high",allowFullScreen:"true",allowScriptAccess:"always",type:"application/x-shockwave-flash"};htmlOptions.width=w;htmlOptions.height=h;htmlOptions.src=src;htmlOptions.flashVars=
$.param(flashVars);htmlOptions.wmode=wmode;var htmlString="";for(var key in htmlOptions)htmlString+=key+"="+htmlOptions[key]+" ";$container.html("<embed "+htmlString+"/>")}else $container.html("<div class='html5lightbox-flash-error' style='display:block; position:relative;text-align:center; width:"+w+"px; left:0px; top:"+Math.round(h/2-10)+"px;'><div class='html5-error'><div>The required Adobe Flash Player plugin is not installed</div><br /><div style='display:block;position:relative;text-align:center;width:112px;height:33px;margin:0px auto;'><a href='http://www.adobe.com/go/getflashplayer'><img src='http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' width='112' height='33'></img></a></div></div>")};
inst.checkType=function(href){if(!href)return-1;if(href.match(/\.(jpg|gif|png|bmp|jpeg)(.*)?$/i))return 0;if(href.match(/[^\.]\.(swf)\s*$/i))return 1;if(href.match(/\.(flv|mp4|m4v|ogv|ogg|webm)(.*)?$/i))return 2;if(href.match(/\:\/\/.*(youtube\.com)/i)||href.match(/\:\/\/.*(youtu\.be)/i))return 3;if(href.match(/\:\/\/.*(vimeo\.com)/i))return 4;if(href.match(/[^\.]\.(pdf)\s*$/i))return 5;if(href.match(/[^\.]\.(mp3)\s*$/i))return 6;return 7};inst.showLightbox=function(type,href,title,width,height,webm,
ogg){inst.$next.hide();inst.$prev.hide();inst.reset();inst.$lightbox.show();if(!inst.options.supportCSSPositionFixed)inst.$lightbox.css("top",$(window).scrollTop());var boxW=inst.options.loadingwidth+2*inst.options.bordersize;var boxH=inst.options.loadingheight+2*inst.options.bordersize;var boxT=Math.round($(window).height()/2-(boxH+inst.options.barheight)/2);inst.$lightboxBox.css({"margin-top":boxT,"width":boxW,"height":boxH});inst.$elemWrap.css({"width":boxW,"height":boxH});inst.loadElem(new Array(type,
href,title,null,width,height,webm,ogg))};inst.addItem=function(href,title,group,width,height,webm,ogg){type=inst.checkType(href);inst.elemArray.push(new Array(type,href,title,group,width,height,webm,ogg))};inst.showItem=function(href){if(inst.elemArray.length<=0)return true;inst.hideObjects();for(var i=0;i<inst.elemArray.length;i++)if(inst.elemArray[i][ELEM_HREF]==href)break;if(i==inst.elemArray.length)return true;inst.options.curElem=i;inst.options.nextElem=-1;inst.options.prevElem=-1;inst.calcNextPrevElem();
inst.$next.hide();inst.$prev.hide();inst.reset();inst.$lightbox.show();if(!inst.options.supportCSSPositionFixed)inst.$lightbox.css("top",$(window).scrollTop());var boxW=inst.options.loadingwidth+2*inst.options.bordersize;var boxH=inst.options.loadingheight+2*inst.options.bordersize;var boxT=Math.round($(window).height()/2-(boxH+inst.options.barheight)/2);inst.$lightboxBox.css({"margin-top":boxT,"width":boxW,"height":boxH});inst.$elemWrap.css({"width":boxW,"height":boxH});inst.loadCurElem();return false};
inst.init();return inst.unbind("click").click(inst.clickHandler)}})(jQuery);
function ASTimer(timeout,callback,updatecallback){var updateinterval=50;var updateTimerId=null;var runningTime=0;var paused=false;var started=false;this.pause=function(){if(started){paused=true;clearInterval(updateTimerId)}};this.resume=function(){if(started&&paused){paused=false;updateTimerId=setInterval(function(){runningTime+=updateinterval;if(runningTime>timeout){clearInterval(updateTimerId);if(callback)callback()}if(updatecallback)updatecallback(runningTime/timeout)},updateinterval)}};this.stop=
function(){clearInterval(updateTimerId);if(updatecallback)updatecallback(-1);runningTime=0;paused=false;started=false};this.start=function(){runningTime=0;paused=false;started=true;updateTimerId=setInterval(function(){runningTime+=updateinterval;if(runningTime>timeout){clearInterval(updateTimerId);if(callback)callback()}if(updatecallback)updatecallback(runningTime/timeout)},updateinterval)}}
var ASPlatforms={flashInstalled:function(){var flashInstalled=false;try{if(new ActiveXObject("ShockwaveFlash.ShockwaveFlash"))flashInstalled=true}catch(e){if(navigator.mimeTypes["application/x-shockwave-flash"])flashInstalled=true}return flashInstalled},html5VideoSupported:function(){return!!document.createElement("video").canPlayType},isChrome:function(){return navigator.userAgent.match(/Chrome/i)!=null},isFirefox:function(){return navigator.userAgent.match(/Firefox/i)!=null},isOpera:function(){return navigator.userAgent.match(/Opera/i)!=
null},isSafari:function(){return navigator.userAgent.match(/Safari/i)!=null},isAndroid:function(){return navigator.userAgent.match(/Android/i)!=null},isIPad:function(){return navigator.userAgent.match(/iPad/i)!=null},isIPhone:function(){return navigator.userAgent.match(/iPod/i)!=null||navigator.userAgent.match(/iPhone/i)!=null},isIOS:function(){return this.isIPad()||this.isIPhone()},isIE9:function(){return navigator.userAgent.match(/MSIE/i)!=null&&this.html5VideoSupported()&&!this.isOpera()},isIE8:function(){return navigator.userAgent.match(/MSIE 8/i)!=
null&&!this.isOpera()},isIE7:function(){return navigator.userAgent.match(/MSIE 7/i)!=null&&!this.isOpera()},isIE6:function(){return navigator.userAgent.match(/MSIE 6/i)!=null&&!this.isOpera()},isIE678:function(){return this.isIE6()||this.isIE7()||this.isIE8()},css33dTransformSupported:function(){return!this.isIE6()&&!this.isIE7()&&!this.isIE8()&&!this.isIE9()&&!this.isOpera()},applyBrowserStyles:function(object,applyToValue){var ret={};for(var key in object){ret[key]=object[key];ret["-webkit-"+key]=
applyToValue?"-webkit-"+object[key]:object[key];ret["-moz-"+key]=applyToValue?"-moz-"+object[key]:object[key];ret["-ms-"+key]=applyToValue?"-ms-"+object[key]:object[key];ret["-o-"+key]=applyToValue?"-o-"+object[key]:object[key]}return ret}};
(function($){$.fn.amazingslider=function(options){var ELEM_ID=0,ELEM_SRC=1,ELEM_TITLE=2,ELEM_DESCRIPTION=3,ELEM_LINK=4,ELEM_TARGET=5,ELEM_VIDEO=6,ELEM_THUMBNAIL=7,ELEM_LIGHTBOX=8,ELEM_LIGHTBOXWIDTH=9,ELEM_LIGHTBOXHEIGHT=10;var TYPE_IMAGE=1,TYPE_SWF=2,TYPE_MP3=3,TYPE_PDF=4,TYPE_VIDEO_FLASH=5,TYPE_VIDEO_MP4=6,TYPE_VIDEO_OGG=7,TYPE_VIDEO_WEBM=8,TYPE_VIDEO_YOUTUBE=9,TYPE_VIDEO_VIMEO=10;var AmazingSlider=function(container,options,id){this.container=container;this.options=options;this.id=id;this.transitionTimeout=
null;this.arrowTimeout=null;this.lightboxArray=[];this.elemArray=[];this.container.children().hide();this.container.css({"display":"block","position":"relative"});this.initData(this.init)};AmazingSlider.prototype={initData:function(onSuccess){this.readTags();onSuccess(this)},readTags:function(){var instance=this;$(".amazingslider-slides",this.container).find("li").each(function(){var img=$("img",$(this));if(img.length>0){var dataSrc=img.data("src")&&img.data("src").length>0?img.data("src"):"";var src=
img.attr("src")&&img.attr("src").length>0?img.attr("src"):dataSrc;var title=img.attr("alt")&&img.attr("alt").length>0?img.attr("alt"):"";var description=img.data("description")&&img.data("description").length>0?img.data("description"):"";var link=img.parent()&&img.parent().is("a")?img.parent().attr("href"):"";var target=img.parent()&&img.parent().is("a")?img.parent().attr("target"):"";var lightbox=img.parent()&&img.parent().is("a")?img.parent().hasClass("html5lightbox"):false;var lightboxwidth=img.parent()&&
lightbox?img.parent().data("width"):0;var lightboxheight=img.parent()&&lightbox?img.parent().data("height"):0;var video=[];if($("video",$(this)).length>0)$("video",$(this)).each(function(){video.push({href:$(this).attr("src"),type:instance.checkVideoType($(this).attr("src"))})});var elem=new Array(instance.elemArray.length,src,title,description,link,target,video,"",lightbox,lightboxwidth,lightboxheight);instance.elemArray.push(elem);if(lightbox)instance.lightboxArray.push(elem)}});$(".amazingslider-thumbnails",
this.container).find("li").each(function(index){var img=$("img",$(this));if(img.length>0&&instance.elemArray.length>index){var dataSrc=img.data("src")&&img.data("src").length>0?img.data("src"):"";var src=img.attr("src")&&img.attr("src").length>0?img.attr("src"):dataSrc;instance.elemArray[index][ELEM_THUMBNAIL]=src}});if(this.options.shownumbering)for(var i=0;i<this.elemArray.length;i++){var prefix=this.options.numberingformat.replace("%NUM",i+1).replace("%TOTAL",this.elemArray.length);this.elemArray[i][ELEM_TITLE]=
prefix+this.elemArray[i][ELEM_TITLE]}},init:function(instance){if(instance.elemArray.length<=0)return;instance.isAnimating=false;instance.isPaused=!instance.options.autoplay;instance.tempPaused=false;instance.initVideoApi();instance.createMarkup();instance.createStyle();instance.createNav();instance.createArrows();instance.createBottomShadow();instance.createBackgroundImage();instance.createText();instance.createSliderTimeout();instance.createWatermark();instance.createRibbon();instance.createGoogleFonts();
instance.initHtml5Lightbox();instance.curElem=-1;instance.prevElem=-1;instance.nextElem=-1;instance.firstslide=true;instance.loopCount=0;instance.pauseCarousel=false;var firstSlide=0;var params=instance.getParams();var paramValue=parseInt(params["firstslideid"]);if(!isNaN(paramValue)&¶mValue>=1&¶mValue<=instance.elemArray.length)firstSlide=paramValue-1;else if(instance.options.randomplay)firstSlide=Math.floor(Math.random()*instance.elemArray.length);instance.slideRun(firstSlide)},getParams:function(){var result=
{};var params=window.location.search.substring(1).split("&");for(var i=0;i<params.length;i++){var value=params[i].split("=");if(value&&value.length==2)result[value[0].toLowerCase()]=unescape(value[1])}return result},initHtml5Lightbox:function(){var i;if(this.lightboxArray.length>0){var lightboxskinfolder=this.options.skinsfoldername.length>0?this.options.skinsfoldername+"/":"";this.html5Lightbox=$([]).html5lightbox({jsfolder:this.options.jsfolder,skinfolder:lightboxskinfolder});for(i=0;i<this.lightboxArray.length;i++)this.html5Lightbox.addItem(this.lightboxArray[i][ELEM_LINK],
this.lightboxArray[i][ELEM_TITLE],"amazingslider"+this.id,this.lightboxArray[i][ELEM_LIGHTBOXWIDTH],this.lightboxArray[i][ELEM_LIGHTBOXHEIGHT],null,null)}},createGoogleFonts:function(){if(this.options.previewmode)return;if(this.options.addgooglefonts&&this.options.googlefonts&&this.options.googlefonts.length>0){var fontRef="";var fontLink=document.createElement("link");fontLink.setAttribute("rel",
"stylesheet");fontLink.setAttribute("type","text/css");fontLink.setAttribute("href",fontRef);document.getElementsByTagName("head")[0].appendChild(fontLink)}},createRibbon:function(){if(!this.options.showribbon||this.options.ribbonimage.length<=0)return;$(".amazingslider-ribbon-"+this.id,this.container).html("<img src='"+this.options.skinsfolder+this.options.ribbonimage+"' style='border:none;' />")},createWatermark:function(){if(!this.options.showwatermark)return;if(this.options.watermarkstyle=="text"&&
this.options.watermarktext.length<=0)return;if(this.options.watermarkstyle=="image"&&this.options.watermarkimage.length<=0)return;var html="";if(this.options.watermarklink){html+="<a href='"+this.options.watermarklink+"' style='"+this.options.watermarklinkcss+"'";if(this.options.watermarktarget)html+=" target='"+this.options.watermarktarget+"'";html+=">"}if(this.options.watermarkstyle=="text")html+=this.options.watermarktext;else if(this.options.watermarkstyle=="image")html+="<img src='"+this.options.skinsfolder+
this.options.watermarkimage+"' style='border:none;' />";if(this.options.watermarklink)html+="</a>";$(".amazingslider-watermark-"+this.id,this.container).html(html)},initVideoApi:function(){var i,j,videos;var initYoutube=false,initVimeo=false;for(i=0;i<this.elemArray.length;i++){videos=this.elemArray[i][ELEM_VIDEO];for(j=0;j<videos.length;j++)if(videos[j].type==TYPE_VIDEO_YOUTUBE)initYoutube=true;else if(videos[j].type==TYPE_VIDEO_VIMEO)initVimeo=true}if(initYoutube){var tag=document.createElement("script");
tag.src=("https:"==document.location.protocol?"https":"http")+"://www.youtube.com/iframe_api";var firstScriptTag=document.getElementsByTagName("script")[0];firstScriptTag.parentNode.insertBefore(tag,firstScriptTag)}if(initVimeo){var tag=document.createElement("script");tag.src=this.options.jsfolder+"froogaloop2.min.js";var firstScriptTag=document.getElementsByTagName("script")[0];firstScriptTag.parentNode.insertBefore(tag,firstScriptTag)}},createSliderTimeout:function(){var instance=this;this.sliderTimeout=
new ASTimer(this.options.slideinterval,function(){instance.slideRun(-1)},this.options.showtimer?function(percent){instance.updateTimer(percent)}:null);if(instance.options.pauseonmouseover)$(".amazingslider-slider-"+this.id,this.container).hover(function(){if(!instance.isPaused)instance.sliderTimeout.pause()},function(){if(!instance.isPaused)instance.sliderTimeout.resume()});if(instance.options.showtimer)$(".amazingslider-timer-"+instance.id,instance.container).css({display:"block",position:"absolute",
left:"0px",top:instance.options.timerposition=="bottom"?"":"0px",bottom:instance.options.timerposition=="bottom"?"0px":"",width:"0%",height:instance.options.timerheight+"px","background-color":instance.options.timercolor,opacity:instance.options.timeropacity,filter:"alpha(opacity="+Math.round(100*instance.options.timeropacity)+")"})},updateTimer:function(percent){w=Math.round(percent*100)+1;if(w>100)w=100;if(w<0)w=0;$(".amazingslider-timer-"+this.id,this.container).css({width:w+"%"})},createMarkup:function(){this.$wrapper=
jQuery(""+"<div class='amazingslider-wrapper-"+this.id+"'>"+"<div class='amazingslider-background-image-"+this.id+"'></div>"+"<div class='amazingslider-bottom-shadow-"+this.id+"'></div>"+"<div class='amazingslider-slider-"+this.id+"'>"+"<div class='amazingslider-box-"+this.id+"'>"+"<div class='amazingslider-swipe-box-"+this.id+"'>"+"<div class='amazingslider-space-"+this.id+"'></div>"+"<div class='amazingslider-img-box-"+this.id+"'></div>"+"</div>"+"</div>"+"<div class='amazingslider-text-wrapper-"+
this.id+"'></div>"+"<div class='amazingslider-play-"+this.id+"'></div>"+"<div class='amazingslider-video-wrapper-"+this.id+"'></div>"+"<div class='amazingslider-ribbon-"+this.id+"'></div>"+"<div class='amazingslider-arrow-left-"+this.id+"'></div>"+"<div class='amazingslider-arrow-right-"+this.id+"'></div>"+"<div class='amazingslider-timer-"+this.id+"'></div>"+"<div class='amazingslider-watermark-"+this.id+"'></div>"+"</div>"+"<div class='amazingslider-nav-"+this.id+"'><div class='amazingslider-nav-container-"+
this.id+"'></div></div>"+"</div>");this.$wrapper.appendTo(this.container);var instance=this;if(this.options.enabletouchswipe)$(".amazingslider-swipe-box-"+this.id,this.container).touchSwipe({preventWebBrowser:false,swipeLeft:function(){instance.slideRun(-1)},swipeRight:function(){instance.slideRun(-2)}});$(".amazingslider-play-"+this.id,this.container).click(function(){instance.playVideo(true)})},playVideo:function(autoplay){var videos=this.elemArray[this.curElem][ELEM_VIDEO];if(videos.length<=0)return;
this.sliderTimeout.stop();this.tempPaused=true;var href=videos[0].href;var type=videos[0].type;if(type==TYPE_VIDEO_YOUTUBE)this.playYoutubeVideo(href,autoplay);else if(type==TYPE_VIDEO_VIMEO)this.playVimeoVideo(href,autoplay)},playVimeoVideo:function(href,autoplay){var $videoWrapper=$(".amazingslider-video-wrapper-"+this.id,this.container);$videoWrapper.css({display:"block",width:"100%",height:"100%"});if(this.options.previewmode){$videoWrapper.html("<div class='amazingslider-error-"+this.id+"'>To view Vimeo video, publish the slider then open it in your web browser</div>");
return}else{var src=href+(href.indexOf("?")<0?"?":"&")+"autoplay="+(autoplay?"1":"0")+"&api=1&player_id=amazingslider_vimeo_"+this.id;$videoWrapper.html("<iframe id='amazingslider_vimeo_"+this.id+"' width='"+this.options.width+"' height='"+this.options.height+"' src='"+src+"' frameborder='0' webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>");var vimeoIframe=$("#amazingslider_vimeo_"+this.id)[0];var vimeoPlayer=$f(vimeoIframe);var instance=this;vimeoPlayer.addEvent("ready",function(){vimeoPlayer.addEvent("finish",
function(id){instance.tempPaused=false;if(!instance.isPaused)instance.slideRun(-1)})})}},playYoutubeVideo:function(href,autoplay){var $videoWrapper=$(".amazingslider-video-wrapper-"+this.id,this.container);$videoWrapper.css({display:"block",width:"100%",height:"100%"});if(this.options.previewmode){$videoWrapper.html("<div class='amazingslider-error-"+this.id+"'>To view YouTube video, publish the slider then open it in your web browser</div>");return}var instance=this;if(!ASYouTubeIframeAPIReady){ASYouTubeTimeout+=
100;if(ASYouTubeTimeout<3E3){setTimeout(function(){instance.playYoutubeVideo(href,autoplay)},100);return}}if(ASYouTubeIframeAPIReady&&!ASPlatforms.isIE6()&&!ASPlatforms.isIE7()&&!ASPlatforms.isIOS()){$videoWrapper.html("<div id='amazingslider-video-"+this.id+"' style='display:block;'></div>");var id=href.match(/(\?v=|\/\d\/|\/embed\/|\/v\/|\.be\/)([a-zA-Z0-9\-\_]+)/)[2];new YT.Player("amazingslider-video-"+this.id,{width:instance.options.width,height:instance.options.height,videoId:id,playerVars:{"autoplay":1,
"rel":0,"autohide":1,"wmode":"transparent"},events:{"onReady":function(event){event.target.playVideo()},"onStateChange":function(event){if(event.data==YT.PlayerState.ENDED){instance.tempPaused=false;if(!instance.isPaused)instance.slideRun(-1)}}}})}else{var src=href+(href.indexOf("?")<0?"?":"&")+"autoplay=1&wmode=transparent&rel=0&autohide=1";$videoWrapper.html("<iframe width='"+instance.options.width+"' height='"+instance.options.height+"' src='"+src+"' frameborder='0' webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>")}},
checkVideoType:function(href){if(!href)return-1;if(href.match(/\.(flv)(.*)?$/i))return TYPE_VIDEO_FLASH;if(href.match(/\.(mp4|m4v)(.*)?$/i))return TYPE_VIDEO_MP4;if(href.match(/\.(ogv|ogg)(.*)?$/i))return TYPE_VIDEO_OGG;if(href.match(/\.(webm)(.*)?$/i))return TYPE_VIDEO_WEBM;if(href.match(/\:\/\/.*(youtube\.com)/i)||href.match(/\:\/\/.*(youtu\.be)/i))return TYPE_VIDEO_YOUTUBE;if(href.match(/\:\/\/.*(vimeo\.com)/i))return TYPE_VIDEO_VIMEO;return 0},createText:function(){if(this.options.textstyle==
"none")return;var instance=this;var $textWrapper=$(".amazingslider-text-wrapper-"+this.id,this.container);if(this.options.textstyle=="static"){$textWrapper.html("<div class='amazingslider-text-"+this.id+"'>"+"<div class='amazingslider-text-bg-"+this.id+"'></div>"+"<div class='amazingslider-title-"+this.id+"'></div>"+"<div class='amazingslider-description-"+this.id+"'></div>"+"</div>");$textWrapper.css({display:this.options.textautohide?"none":"block",overflow:"hidden",width:"100%",height:"auto",position:"absolute"});
if(this.options.textautohide)$(".amazingslider-slider-"+this.id,this.container).hover(function(){$(".amazingslider-text-wrapper-"+instance.id,instance.container).fadeIn()},function(){$(".amazingslider-text-wrapper-"+instance.id,instance.container).fadeOut()});switch(this.options.textpositionstatic){case "top":$textWrapper.css({left:"0px",top:"0px","margin-top":this.options.textpositionmarginstatic+"px"});break;case "bottom":$textWrapper.css({left:"0px",bottom:"0px","margin-bottom":this.options.textpositionmarginstatic+
"px"});break;case "topoutside":$textWrapper.css({left:"0px",bottom:"100%","margin-bottom":this.options.textpositionmarginstatic+"px"});break;case "bottomoutside":$textWrapper.css({left:"0px",top:"100%","margin-top":this.options.textpositionmarginstatic+"px"});break}}else{$textWrapper.html("<div class='amazingslider-text-holding-"+this.id+"' style='visibility:hidden;"+this.options.textcss+"'>"+"<div class='amazingslider-text-bg-"+this.id+"'></div>"+"<div class='amazingslider-title-"+this.id+"'></div>"+
"<div class='amazingslider-description-"+this.id+"'></div>"+"</div>"+"<div class='amazingslider-text-"+this.id+"' style='position:absolute;top:0%;left:0%;"+(ASPlatforms.isIE678()?"opacity:inherit;filter:inherit;":"")+"'>"+"<div class='amazingslider-text-bg-"+this.id+"'></div>"+"<div class='amazingslider-title-"+this.id+"'></div>"+"<div class='amazingslider-description-"+this.id+"'></div>"+"</div>");$textWrapper.css({display:"none",overflow:"hidden",position:"absolute"})}$("head").append("<style type='text/css'>"+
".amazingslider-text-"+this.id+" {"+this.options.textcss+"} "+".amazingslider-text-bg-"+this.id+" {"+this.options.textbgcss+"} "+".amazingslider-title-"+this.id+" {"+this.options.titlecss+"} "+".amazingslider-description-"+this.id+" {"+this.options.descriptioncss+"} "+"</style>");this.container.bind("amazingslider.switchtext",function(event,prev,cur){var $textWrapper=$(".amazingslider-text-wrapper-"+instance.id,instance.container);var $textBg=$(".amazingslider-text-bg-"+instance.id,instance.container);
var $title=$(".amazingslider-title-"+instance.id,instance.container);var $description=$(".amazingslider-description-"+instance.id,instance.container);if(instance.options.textstyle=="static"){$title.html(instance.elemArray[cur][ELEM_TITLE]);$description.html(instance.elemArray[cur][ELEM_DESCRIPTION]);if(!instance.elemArray[cur][ELEM_TITLE]&&!instance.elemArray[cur][ELEM_DESCRIPTION])$textBg.hide();else $textBg.show()}else if(instance.options.textstyle=="dynamic")if(!instance.elemArray[cur][ELEM_TITLE]&&
!instance.elemArray[cur][ELEM_DESCRIPTION])$textWrapper.fadeOut();else $textWrapper.fadeOut(function(){var pos="bottomleft";var positions=instance.options.textpositiondynamic;if(positions){positions=positions.split(",");pos=positions[Math.floor(Math.random()*positions.length)];pos=$.trim(pos.toLowerCase())}switch(pos){case "topleft":$textWrapper.css({left:"0px",right:"",top:"0px",bottom:""});$textWrapper.css({margin:instance.options.textpositionmargintop+"px "+instance.options.textpositionmarginleft+
"px"});break;case "topright":$textWrapper.css({left:"",right:"0px",top:"0px",bottom:""});$textWrapper.css({margin:instance.options.textpositionmargintop+"px "+instance.options.textpositionmarginright+"px"});break;case "bottomleft":$textWrapper.css({left:"0px",right:"",top:"",bottom:"0px"});$textWrapper.css({margin:instance.options.textpositionmarginbottom+"px "+instance.options.textpositionmarginleft+"px"});break;case "bottomright":$textWrapper.css({left:"",right:"0px",top:"",bottom:"0px"});$textWrapper.css({margin:instance.options.textpositionmarginbottom+
"px "+instance.options.textpositionmarginright+"px"});break}$title.html(instance.elemArray[cur][ELEM_TITLE]);$description.html(instance.elemArray[cur][ELEM_DESCRIPTION]);var effect=null;var effects=instance.options.texteffect;if(effects){effects=effects.split(",");effect=effects[Math.floor(Math.random()*effects.length)];effect=$.trim(effect.toLowerCase())}var $textBox=$(".amazingslider-text-"+instance.id,instance.container);switch(effect){case "fade":$textBox.hide();$textWrapper.show();$textBox.delay(500).fadeIn(instance.options.texteffectduration);
break;case "slide":$textBox.css({left:"-100%",opacity:0,display:"block"});$textWrapper.show();$textBox.delay(500).animate({left:"0%",opacity:1},instance.options.texteffectduration,instance.options.texteffecteasing);break;default:$textBox.delay(500).show()}})})},createStyle:function(){$(".amazingslider-space-"+this.id,this.container).html("<img style='width:100%;max-width:100%;' src='"+this.elemArray[0][ELEM_SRC]+"' />");if(this.options.isresponsive)this.container.css({"max-width":this.options.width,
"max-height":this.options.height});else this.container.css({"width":this.options.width,"height":this.options.height});var styleCss=".amazingslider-wrapper-"+this.id+" {display:block;position:relative;width:100%;height:auto;}";styleCss+=".amazingslider-slider-"+this.id+" {display:block;position:relative;left:0px;top:0px;width:100%;height:auto;";if(this.options.border>0)styleCss+="margin-left:-"+this.options.border+"px;border-width:"+this.options.border+"px;border-style:solid;border-color:"+this.options.bordercolor+
";";if(this.options.borderradius>0)styleCss+="border-radius:"+this.options.borderradius+"px;-moz-border-radius:"+this.options.borderradius+"px;-webkit-border-radius:"+this.options.borderradius+"px;";if(this.options.showshadow){var b="0px 0px "+this.options.shadowsize+"px "+this.options.shadowcolor;styleCss+="box-shadow:"+b+";-moz-box-shadow:"+b+";-webkit-box-shadow:"+b+";";if(ASPlatforms.isIE678()||ASPlatforms.isIE9)styleCss+="filter:progid:DXImageTransform.Microsoft.Shadow(color="+this.options.shadowcolor+
",direction=135,strength="+this.options.shadowsize+");"}styleCss+="}";styleCss+=".amazingslider-box-"+this.id+" {display:block;position:relative;left:0px;top:0px;width:100%;height:auto;}";styleCss+=".amazingslider-swipe-box-"+this.id+" {display:block;position:relative;left:0px;top:0px;width:100%;height:auto;}";styleCss+=".amazingslider-space-"+this.id+" {display:block;position:relative;left:0px;top:0px;width:100%;height:auto;visibility:hidden;line-height:0px;font-size:0px;}";styleCss+=".amazingslider-img-box-"+
this.id+" {display:block;position:absolute;left:0px;top:0px;width:100%;height:100%;}";styleCss+=".amazingslider-play-"+this.id+" {display:none;position:absolute;left:50%;top:50%;cursor:pointer;width:"+this.options.playvideoimagewidth+"px;height:"+this.options.playvideoimageheight+"px;margin-top:"+"-"+Math.round(this.options.playvideoimageheight/2)+"px;margin-left:"+"-"+Math.round(this.options.playvideoimagewidth/2)+"px; background:url('"+this.options.skinsfolder+this.options.playvideoimage+"') no-repeat left top;}";
styleCss+=".amazingslider-video-wrapper-"+this.id+" {display:none;position:absolute;left:0px;top:0px;background-color:#000;text-align:center;}";styleCss+=".amazingslider-error-"+this.id+" {display:block;position:relative;margin:0 auto;width:80%;top:50%;color:#fff;font:16px Arial,Tahoma,Helvetica,sans-serif;}";if(this.options.showwatermark)if(this.options.watermarkstyle=="text"&&this.options.watermarktext.length>0||this.options.watermarkstyle=="image"&&this.options.watermarkimage.length>0){styleCss+=
".amazingslider-watermark-"+this.id+" {"+this.options.watermarkpositioncss;if(this.options.watermarkstyle=="text"&&this.options.watermarktext.length>0)styleCss+=this.options.watermarktextcss;if(this.options.watermarklink)styleCss+="cursor:pointer;";styleCss+="}"}if(this.options.showribbon){styleCss+=".amazingslider-ribbon-"+this.id+" {display:block;position:absolute;";switch(this.options.ribbonposition){case "topleft":styleCss+="left:"+this.options.ribbonimagex+"px;top:"+this.options.ribbonimagey+
"px;";break;case "topright":styleCss+="right:"+this.options.ribbonimagex+"px;top:"+this.options.ribbonimagey+"px;";break;case "bottomleft":styleCss+="left:"+this.options.ribbonimagex+"px;bottom:"+this.options.ribbonimagey+"px;";break;case "bottomright":styleCss+="right:"+this.options.ribbonimagex+"px;bottom:"+this.options.ribbonimagey+"px;";break;case "top":styleCss+="width:100%;height:auto;margin:0 auto;top:"+this.options.ribbonimagey+"px;";case "bottom":styleCss+="width:100%;height:auto;text-align:center;bottom:"+
this.options.ribbonimagey+"px;"}styleCss+="}"}styleCss+=".amazingslider-video-wrapper-"+this.id+" video {max-width:100%;height:auto;}";styleCss+=".amazingslider-video-wrapper-"+this.id+" iframe, "+".amazingslider-video-wrapper-"+this.id+" object, "+".amazingslider-video-wrapper-"+this.id+" embed {position:absolute;top:0;left:0;width:100%;height:100%;}";if(this.options.navstyle=="thumbnails"&&this.options.navthumbstyle!="imageonly"){styleCss+=".amazingslider-nav-thumbnail-tite-"+this.id+" {"+this.options.navthumbtitlecss+
"}";styleCss+=".amazingslider-nav-thumbnail-tite-"+this.id+":hover {"+this.options.navthumbtitlehovercss+"}";if(this.options.navthumbstyle=="imageandtitledescription")styleCss+=".amazingslider-nav-thumbnail-description-"+this.id+" {"+this.options.navthumbdescriptioncss+"}"}$("head").append("<style type='text/css'>"+styleCss+"</style>")},createBottomShadow:function(){if(!this.options.showbottomshadow)return;var $shadow=$(".amazingslider-bottom-shadow-"+this.id,this.container);var l=(100-this.options.bottomshadowimagewidth)/
2;$shadow.css({display:"block",position:"absolute",left:l+"%",top:this.options.bottomshadowimagetop+"%",width:this.options.bottomshadowimagewidth+"%",height:"auto"});$shadow.html("<img src='"+this.options.skinsfolder+this.options.bottomshadowimage+"' style='display:block;position:relative;width:100%;height:auto;' />")},createBackgroundImage:function(){if(!this.options.showbackgroundimage||!this.options.backgroundimage)return;var $background=$(".amazingslider-background-image-"+this.id,this.container);
var l=(100-this.options.backgroundimagewidth)/2;$background.css({display:"block",position:"absolute",left:l+"%",top:this.options.backgroundimagetop+"%",width:this.options.backgroundimagewidth+"%",height:"auto"});$background.html("<img src='"+this.options.skinsfolder+this.options.backgroundimage+"' style='display:block;position:relative;width:100%;height:auto;' />")},createArrows:function(){if(this.options.arrowstyle=="none")return;var instance=this;var $leftArrow=$(".amazingslider-arrow-left-"+this.id,
this.container);var $rightArrow=$(".amazingslider-arrow-right-"+this.id,this.container);$leftArrow.css({overflow:"hidden",position:"absolute",cursor:"pointer",width:this.options.arrowwidth+"px",height:this.options.arrowheight+"px",left:this.options.arrowmargin+"px",top:this.options.arrowtop+"%","margin-top":"-"+this.options.arrowheight/2+"px",background:"url('"+this.options.skinsfolder+this.options.arrowimage+"') no-repeat left top"});if(ASPlatforms.isIE678())$leftArrow.css({opacity:"inherit",filter:"inherit"});
$leftArrow.hover(function(){$(this).css({"background-position":"left bottom"})},function(){$(this).css({"background-position":"left top"})});$leftArrow.click(function(){instance.slideRun(-2)});$rightArrow.css({overflow:"hidden",position:"absolute",cursor:"pointer",width:this.options.arrowwidth+"px",height:this.options.arrowheight+"px",right:this.options.arrowmargin+"px",top:this.options.arrowtop+"%","margin-top":"-"+this.options.arrowheight/2+"px",background:"url('"+this.options.skinsfolder+this.options.arrowimage+
"') no-repeat right top"});if(ASPlatforms.isIE678())$rightArrow.css({opacity:"inherit",filter:"inherit"});$rightArrow.hover(function(){$(this).css({"background-position":"right bottom"})},function(){$(this).css({"background-position":"right top"})});$rightArrow.click(function(){instance.slideRun(-1)});if(this.options.arrowstyle=="always"){$leftArrow.css({display:"block"});$rightArrow.css({display:"block"})}else{$leftArrow.css({display:"none"});$rightArrow.css({display:"none"});$(".amazingslider-slider-"+
this.id,this.container).hover(function(){clearTimeout(instance.arrowTimeout);if(ASPlatforms.isIE678()){$(".amazingslider-arrow-left-"+instance.id,instance.container).show();$(".amazingslider-arrow-right-"+instance.id,instance.container).show()}else{$(".amazingslider-arrow-left-"+instance.id,instance.container).fadeIn();$(".amazingslider-arrow-right-"+instance.id,instance.container).fadeIn()}},function(){instance.arrowTimeout=setTimeout(function(){if(ASPlatforms.isIE678()){$(".amazingslider-arrow-left-"+
instance.id,instance.container).hide();$(".amazingslider-arrow-right-"+instance.id,instance.container).hide()}else{$(".amazingslider-arrow-left-"+instance.id,instance.container).fadeOut();$(".amazingslider-arrow-right-"+instance.id,instance.container).fadeOut()}},instance.options.arrowhideonmouseleave)})}},carMoveLeft:function(){var $navContainer=$(".amazingslider-nav-container-"+this.id,this.container);var $bulletWrapper=$(".amazingslider-bullet-wrapper-"+this.id,this.container);if($navContainer.width()>=
$bulletWrapper.width())return;if(this.options.navshowpreview)$(".amazingslider-nav-preview-"+this.id,this.container).hide();var dist=$navContainer.width()+this.options.navspacing;var l=(isNaN(parseInt($bulletWrapper.css("margin-left")))?0:parseInt($bulletWrapper.css("margin-left")))-dist;if(l<=$navContainer.width()-$bulletWrapper.width())l=$navContainer.width()-$bulletWrapper.width();if(l>=0)l=0;$bulletWrapper.animate({"margin-left":l},{queue:false,duration:500,easing:"easeOutCirc"});if(this.options.navthumbnavigationstyle!=
"auto")this.updateCarouselLeftRightArrow(l)},carMoveRight:function(){var $navContainer=$(".amazingslider-nav-container-"+this.id,this.container);var $bulletWrapper=$(".amazingslider-bullet-wrapper-"+this.id,this.container);if($navContainer.width()>=$bulletWrapper.width())return;if(this.options.navshowpreview)$(".amazingslider-nav-preview-"+this.id,this.container).hide();var dist=$navContainer.width()+this.options.navspacing;var l=(isNaN(parseInt($bulletWrapper.css("margin-left")))?0:parseInt($bulletWrapper.css("margin-left")))+
dist;if(l<=$navContainer.width()-$bulletWrapper.width())l=$navContainer.width()-$bulletWrapper.width();if(l>=0)l=0;$bulletWrapper.animate({"margin-left":l},{queue:false,duration:500,easing:"easeOutCirc"});if(this.options.navthumbnavigationstyle!="auto")this.updateCarouselLeftRightArrow(l)},carMoveBottom:function(){var $navContainer=$(".amazingslider-nav-container-"+this.id,this.container);var $bulletWrapper=$(".amazingslider-bullet-wrapper-"+this.id,this.container);if($navContainer.height()>=$bulletWrapper.height())return;
if(this.options.navshowpreview)$(".amazingslider-nav-preview-"+this.id,this.container).hide();var dist=$navContainer.height()+this.options.navspacing;var l=(isNaN(parseInt($bulletWrapper.css("margin-top")))?0:parseInt($bulletWrapper.css("margin-top")))+dist;if(l<=$navContainer.height()-$bulletWrapper.height())l=$navContainer.height()-$bulletWrapper.height();if(l>=0)l=0;$bulletWrapper.animate({"margin-top":l},{queue:false,duration:500,easing:"easeOutCirc"});if(this.options.navthumbnavigationstyle!=
"auto")this.updateCarouselLeftRightArrow(l)},carMoveTop:function(){var $navContainer=$(".amazingslider-nav-container-"+this.id,this.container);var $bulletWrapper=$(".amazingslider-bullet-wrapper-"+this.id,this.container);if($navContainer.height()>=$bulletWrapper.height())return;if(this.options.navshowpreview)$(".amazingslider-nav-preview-"+this.id,this.container).hide();var dist=$navContainer.height()+this.options.navspacing;var l=(isNaN(parseInt($bulletWrapper.css("margin-top")))?0:parseInt($bulletWrapper.css("margin-top")))-
dist;if(l<=$navContainer.height()-$bulletWrapper.height())l=$navContainer.height()-$bulletWrapper.height();if(l>=0)l=0;$bulletWrapper.animate({"margin-top":l},{queue:false,duration:500,easing:"easeOutCirc"});if(this.options.navthumbnavigationstyle!="auto")this.updateCarouselLeftRightArrow(l)},updateCarouselLeftRightArrow:function(l){var $navContainer=$(".amazingslider-nav-container-"+this.id,this.container);var $bulletWrapper=$(".amazingslider-bullet-wrapper-"+this.id,this.container);if(this.options.navdirection==
"vertical"){if(l==0){$(".amazingslider-car-left-arrow-"+this.id,this.container).css({"background-position":"left bottom",cursor:""});$(".amazingslider-car-left-arrow-"+this.id,this.container).data("disabled",true)}else{$(".amazingslider-car-left-arrow-"+this.id,this.container).css({"background-position":"left top",cursor:"pointer"});$(".amazingslider-car-left-arrow-"+this.id,this.container).data("disabled",false)}if(l==$navContainer.height()-$bulletWrapper.height()){$(".amazingslider-car-right-arrow-"+
this.id,this.container).css({"background-position":"right bottom",cursor:""});$(".amazingslider-car-right-arrow-"+this.id,this.container).data("disabled",true)}else{$(".amazingslider-car-right-arrow-"+this.id,this.container).css({"background-position":"right top",cursor:"pointer"});$(".amazingslider-car-right-arrow-"+this.id,this.container).data("disabled",false)}}else{if(l==0){$(".amazingslider-car-left-arrow-"+this.id,this.container).css({"background-position":"left bottom",cursor:""});$(".amazingslider-car-left-arrow-"+
this.id,this.container).data("disabled",true)}else{$(".amazingslider-car-left-arrow-"+this.id,this.container).css({"background-position":"left top",cursor:"pointer"});$(".amazingslider-car-left-arrow-"+this.id,this.container).data("disabled",false)}if(l==$navContainer.width()-$bulletWrapper.width()){$(".amazingslider-car-right-arrow-"+this.id,this.container).css({"background-position":"right bottom",cursor:""});$(".amazingslider-car-right-arrow-"+this.id,this.container).data("disabled",true)}else{$(".amazingslider-car-right-arrow-"+
this.id,this.container).css({"background-position":"right top",cursor:"pointer"});$(".amazingslider-car-right-arrow-"+this.id,this.container).data("disabled",false)}}},createNav:function(){if(this.options.navstyle=="none"&&!this.options.navshowbuttons)return;var instance=this;var i;var $nav=$(".amazingslider-nav-"+this.id,this.container);var $navContainer=$(".amazingslider-nav-container-"+this.id,this.container);var $bulletWrapper=$("<div class='amazingslider-bullet-wrapper-"+this.id+"' style='display:block;position:relative;'></div>");
if(this.options.navstyle=="thumbnails"){this.options.navimagewidth=this.options.navwidth-this.options.navborder*2;this.options.navimageheight=this.options.navheight-this.options.navborder*2;if(this.options.navthumbstyle=="imageandtitle")this.options.navheight+=this.options.navthumbtitleheight;else if(this.options.navthumbstyle=="imageandtitledescription")this.options.navwidth+=this.options.navthumbtitlewidth}if(this.options.navdirection=="vertical"){var len=this.options.navstyle=="none"?0:this.elemArray.length*
this.options.navheight+(this.elemArray.length-1)*this.options.navspacing;if(this.options.navshowbuttons){if(this.options.navshowarrow){len+=len>0?this.options.navspacing:0;len+=2*this.options.navheight+this.options.navspacing}if(this.options.navshowplaypause&&!this.options.navshowplaypausestandalone){len+=len>0?this.options.navspacing:0;len+=this.options.navheight}}$bulletWrapper.css({height:len+"px",width:"auto"})}else{var len=this.options.navstyle=="none"?0:this.elemArray.length*this.options.navwidth+
(this.elemArray.length-1)*this.options.navspacing;if(this.options.navshowbuttons){if(this.options.navshowarrow){len+=len>0?this.options.navspacing:0;len+=2*this.options.navwidth+this.options.navspacing}if(this.options.navshowplaypause&&!this.options.navshowplaypausestandalone){len+=len>0?this.options.navspacing:0;len+=this.options.navwidth}}$bulletWrapper.css({width:len+"px",height:"auto"})}$navContainer.append($bulletWrapper);var bulletPos=0;var bulletSize=this.options.navdirection=="vertical"?this.options.navwidth:
this.options.navheight;if(this.options.navstyle=="thumbnails"&&this.options.navshowfeaturedarrow){bulletSize+=this.options.navdirection=="vertical"?this.options.navfeaturedarrowimagewidth:this.options.navfeaturedarrowimageheight;bulletPos=this.options.navdirection=="vertical"?this.options.navfeaturedarrowimagewidth:this.options.navfeaturedarrowimageheight}var navmarginX="navmarginx"in this.options?this.options.navmarginx:this.options.navmargin;var navmarginY="navmarginy"in this.options?this.options.navmarginy:
this.options.navmargin;$nav.css({display:"block",position:"absolute",height:"auto"});switch(this.options.navposition){case "top":$bulletWrapper.css({"margin-left":"auto","margin-right":"auto","height":bulletSize+"px"});$nav.css({overflow:"hidden","width":"100%",top:"0%",left:"0px","margin-top":navmarginY+"px"});break;case "topleft":$bulletWrapper.css({"height":bulletSize+"px"});$nav.css({overflow:"hidden","max-width":"100%",top:"0px",left:"0px","margin-top":navmarginY+"px","margin-left":navmarginX+
"px"});break;case "topright":$bulletWrapper.css({"height":bulletSize+"px"});$nav.css({overflow:"hidden","max-width":"100%",top:"0px",right:"0px","margin-top":navmarginY+"px","margin-right":navmarginX+"px"});break;case "bottom":$bulletWrapper.css({"margin-left":"auto","margin-right":"auto","margin-top":bulletPos+"px"});$nav.css({overflow:"hidden","width":"100%",top:"100%",left:"0px","margin-top":String(navmarginY-bulletPos)+"px"});break;case "bottomleft":$bulletWrapper.css({"margin-top":bulletPos+
"px"});$nav.css({overflow:"hidden","max-width":"100%",bottom:"0px",left:"0px","margin-bottom":navmarginY+"px","margin-top":String(navmarginY-bulletPos)+"px","margin-left":navmarginX+"px"});break;case "bottomright":$bulletWrapper.css({"margin-top":bulletPos+"px"});$nav.css({overflow:"hidden","max-width":"100%",bottom:"0px",right:"0px","margin-bottom":navmarginY+"px","margin-top":String(navmarginY-bulletPos)+"px","margin-right":navmarginX+"px"});break;case "left":$bulletWrapper.css({"width":bulletSize+
"px"});$nav.css({overflow:"hidden","height":"100%",width:bulletSize+"px",top:"0%",left:"0%","margin-left":navmarginX+"px"});$navContainer.css({display:"block",position:"absolute",top:"0px",bottom:"0px",left:"0px",right:"0px",height:"auto"});break;case "right":$bulletWrapper.css({"margin-left":bulletPos+"px"});$nav.css({overflow:"hidden","height":"100%",width:bulletSize+"px",top:"0%",left:"100%","margin-left":String(navmarginX-bulletPos)+"px"});$navContainer.css({display:"block",position:"absolute",
top:"0px",bottom:"0px",left:"0px",right:"0px",height:"auto"});break}if(this.options.navstyle!="none"){var $bullet;for(i=0;i<this.elemArray.length;i++){$bullet=this.createNavBullet(i);$bulletWrapper.append($bullet)}$nav.mouseenter(function(){instance.pauseCarousel=true});$nav.mouseleave(function(){instance.pauseCarousel=false});if(instance.options.navthumbnavigationstyle=="auto")$nav.mousemove(function(e){if(instance.options.navdirection=="vertical"){if($nav.height()>=$bulletWrapper.height())return;
var d=e.pageY-$nav.offset().top;if(d<10)d=0;if(d>$nav.height()-10)d=$nav.height();var r=d/$nav.height();var l=($nav.height()-$bulletWrapper.height())*r;$bulletWrapper.animate({"margin-top":l},{queue:false,duration:20,easing:"easeOutCubic"})}else{if($nav.width()>=$bulletWrapper.width())return;var d=e.pageX-$nav.offset().left;if(d<10)d=0;if(d>$nav.width()-10)d=$nav.width();var r=d/$nav.width();var l=($nav.width()-$bulletWrapper.width())*r;$bulletWrapper.animate({"margin-left":l},{queue:false,duration:20,
easing:"easeOutCubic"})}});else if(instance.options.navdirection=="vertical"&&$bulletWrapper.height()>$navContainer.height()||instance.options.navdirection=="horizontal"&&$bulletWrapper.width()>$navContainer.width()){var m=instance.options.navthumbnavigationarrowimagewidth+instance.options.navspacing;if(instance.options.navdirection=="horizontal"){var n=Math.floor(($nav.width()-2*m+instance.options.navspacing)/(instance.options.navwidth+instance.options.navspacing));m=Math.floor(($nav.width()-n*instance.options.navwidth-
(n-1)*instance.options.navspacing)/2)}if(instance.options.navdirection=="vertical")$navContainer.css({"margin-top":m+"px","margin-bottom":m+"px",overflow:"hidden"});else $navContainer.css({"margin-left":m+"px","margin-right":m+"px",overflow:"hidden"});var $carLeftArrow=$("<div class='amazingslider-car-left-arrow-"+instance.id+"' style='display:none;'></div>");var $carRightArrow=$("<div class='amazingslider-car-right-arrow-"+instance.id+"' style='display:none;'></div>");$nav.append($carLeftArrow);
$nav.append($carRightArrow);$carLeftArrow.css({overflow:"hidden",position:"absolute",cursor:"pointer",width:instance.options.navthumbnavigationarrowimagewidth+"px",height:instance.options.navthumbnavigationarrowimageheight+"px",background:"url('"+instance.options.skinsfolder+instance.options.navthumbnavigationarrowimage+"') no-repeat left top"});$carRightArrow.css({overflow:"hidden",position:"absolute",cursor:"pointer",width:instance.options.navthumbnavigationarrowimagewidth+"px",height:instance.options.navthumbnavigationarrowimageheight+
"px",background:"url('"+instance.options.skinsfolder+instance.options.navthumbnavigationarrowimage+"') no-repeat right top"});var p=instance.options.navdirection=="vertical"?instance.options.navwidth/2-instance.options.navthumbnavigationarrowimagewidth/2:instance.options.navheight/2-instance.options.navthumbnavigationarrowimageheight/2;if(instance.options.navposition=="bottomleft"||instance.options.navposition=="bottomright"||instance.options.navposition=="bottom"||instance.options.navposition=="right")p+=
bulletPos;if(instance.options.navdirection=="vertical"){$carLeftArrow.css({top:"0px",left:"0px","margin-left":p+"px"});$carRightArrow.css({bottom:"0px",left:"0px","margin-left":p+"px"})}else{$carLeftArrow.css({left:"0px",top:"0px","margin-top":p+"px"});$carRightArrow.css({right:"0px",top:"0px","margin-top":p+"px"})}if(ASPlatforms.isIE678())$carLeftArrow.css({opacity:"inherit",filter:"inherit"});$carLeftArrow.hover(function(){if(!$(this).data("disabled"))$(this).css({"background-position":"left center"})},
function(){if(!$(this).data("disabled"))$(this).css({"background-position":"left top"})});$carLeftArrow.click(function(){if(instance.options.navdirection=="vertical")instance.carMoveBottom();else instance.carMoveRight()});if(ASPlatforms.isIE678())$carRightArrow.css({opacity:"inherit",filter:"inherit"});$carRightArrow.hover(function(){if(!$(this).data("disabled"))$(this).css({"background-position":"right center"})},function(){if(!$(this).data("disabled"))$(this).css({"background-position":"right top"})});
$carRightArrow.click(function(){if(instance.options.navdirection=="vertical")instance.carMoveTop();else instance.carMoveLeft()});$carLeftArrow.css({display:"block","background-position":"left bottom",cursor:""});$carLeftArrow.data("disabled",true);$carRightArrow.css({display:"block"})}if(instance.options.navdirection=="vertical")$nav.touchSwipe({preventWebBrowser:true,swipeTop:function(data){instance.carMoveTop()},swipeBottom:function(){instance.carMoveBottom()}});else $nav.touchSwipe({preventWebBrowser:false,
swipeLeft:function(data){instance.carMoveLeft()},swipeRight:function(){instance.carMoveRight()}});this.container.bind("amazingslider.switch",function(event,prev,cur){$(".amazingslider-bullet-"+instance.id+"-"+prev,instance.container)["bulletNormal"+instance.id]();$(".amazingslider-bullet-"+instance.id+"-"+cur,instance.container)["bulletSelected"+instance.id]()});if(this.options.navshowpreview){var $preview=$("<div class='amazingslider-nav-preview-"+this.id+"' style='display:none;position:absolute;width:"+
this.options.navpreviewwidth+"px;height:"+this.options.navpreviewheight+"px;background-color:"+this.options.navpreviewbordercolor+";padding:"+instance.options.navpreviewborder+"px;'></div>");var $previewArrow=$("<div class='amazingslider-nav-preview-arrow-"+this.id+"' style='display:block;position:absolute;width:"+this.options.navpreviewarrowwidth+"px;height:"+this.options.navpreviewarrowheight+"px;"+'background:url("'+this.options.skinsfolder+this.options.navpreviewarrowimage+"\") no-repeat center center;' ></div>");
switch(this.options.navpreviewposition){case "bottom":$previewArrow.css({left:"50%",bottom:"100%","margin-left":"-"+Math.round(this.options.navpreviewarrowwidth/2)+"px"});break;case "top":$previewArrow.css({left:"50%",top:"100%","margin-left":"-"+Math.round(this.options.navpreviewarrowwidth/2)+"px"});break;case "left":$previewArrow.css({top:"50%",left:"100%","margin-top":"-"+Math.round(this.options.navpreviewarrowheight/2)+"px"});break;case "right":$previewArrow.css({top:"50%",right:"100%","margin-top":"-"+
Math.round(this.options.navpreviewarrowheight/2)+"px"});break}var $previewImages=$("<div class='amazingslider-nav-preview-images-"+this.id+"' style='display:block;position:relative;width:100%;height:100%;overflow:hidden;' />");$preview.append($previewArrow);$preview.append($previewImages);if(this.options.navshowplayvideo){var $previewPlay=$("<div class='amazingslider-nav-preview-play-"+this.id+"' style='display:none;position:absolute;left:0;top:0;width:100%;height:100%;"+'background:url("'+this.options.skinsfolder+
this.options.navplayvideoimage+'") no-repeat center center;'+"' ></div>");$preview.append($previewPlay)}$(".amazingslider-wrapper-"+this.id,this.container).append($preview)}if(this.options.navshowfeaturedarrow)$bulletWrapper.append("<div class='amazingslider-nav-featuredarrow-"+this.id+"' style='display:none;position:absolute;width:"+this.options.navfeaturedarrowimagewidth+"px;"+"height:"+this.options.navfeaturedarrowimageheight+"px;"+'background:url("'+this.options.skinsfolder+this.options.navfeaturedarrowimage+
"\") no-repeat center center;'></div>")}if(this.options.navshowbuttons){var floatDir=this.options.navdirection=="vertical"?"top":"left";var spacing=this.options.navstyle=="none"?0:this.options.navspacing;if(this.options.navshowarrow){var $navLeft=$("<div class='amazingslider-nav-left-"+this.id+"' style='position:relative;float:"+floatDir+";margin-"+floatDir+":"+spacing+"px;width:"+this.options.navwidth+"px;height:"+this.options.navheight+"px;cursor:pointer;'></div>");$bulletWrapper.append($navLeft);
if(this.options.navbuttonradius)$navLeft.css(ASPlatforms.applyBrowserStyles({"border-radius":this.options.navbuttonradius+"px"}));if(this.options.navbuttoncolor)$navLeft.css({"background-color":this.options.navbuttoncolor});if(this.options.navarrowimage)$navLeft.css({"background-image":"url('"+this.options.skinsfolder+this.options.navarrowimage+"')","background-repeat":"no-repeat","background-position":"left top"});$navLeft.hover(function(){if(instance.options.navbuttonhighlightcolor)$(this).css({"background-color":instance.options.navbuttonhighlightcolor});
if(instance.options.navarrowimage)$(this).css({"background-position":"left bottom"})},function(){if(instance.options.navbuttoncolor)$(this).css({"background-color":instance.options.navbuttoncolor});if(instance.options.navarrowimage)$(this).css({"background-position":"left top"})});$navLeft.click(function(){instance.slideRun(-2)});spacing=this.options.navspacing}if(this.options.navshowplaypause){var $navPlay,$navPause;if(this.options.navshowplaypausestandalone){$navPlay=$("<div class='amazingslider-nav-play-"+
this.id+"' style='position:absolute;width:"+this.options.navshowplaypausestandalonewidth+"px;height:"+this.options.navshowplaypausestandaloneheight+"px;'></div>");this.$wrapper.append($navPlay);$navPause=$("<div class='amazingslider-nav-pause-"+this.id+"' style='position:absolute;width:"+this.options.navshowplaypausestandalonewidth+"px;height:"+this.options.navshowplaypausestandaloneheight+"px;'></div>");this.$wrapper.append($navPause);switch(this.options.navshowplaypausestandaloneposition){case "topleft":$navPlay.css({top:0,
left:0,"margin-left":this.options.navshowplaypausestandalonemarginx+"px","margin-top":this.options.navshowplaypausestandalonemarginy+"px"});$navPause.css({top:0,left:0,"margin-left":this.options.navshowplaypausestandalonemarginx+"px","margin-top":this.options.navshowplaypausestandalonemarginy+"px"});break;case "topright":$navPlay.css({top:0,right:0,"margin-right":this.options.navshowplaypausestandalonemarginx+"px","margin-top":this.options.navshowplaypausestandalonemarginy+"px"});$navPause.css({top:0,
right:0,"margin-right":this.options.navshowplaypausestandalonemarginx+"px","margin-top":this.options.navshowplaypausestandalonemarginy+"px"});break;case "bottomleft":$navPlay.css({bottom:0,left:0,"margin-left":this.options.navshowplaypausestandalonemarginx+"px","margin-bottom":this.options.navshowplaypausestandalonemarginy+"px"});$navPause.css({bottom:0,left:0,"margin-left":this.options.navshowplaypausestandalonemarginx+"px","margin-bottom":this.options.navshowplaypausestandalonemarginy+"px"});break;
case "bottomright":$navPlay.css({bottom:0,right:0,"margin-right":this.options.navshowplaypausestandalonemarginx+"px","margin-bottom":this.options.navshowplaypausestandalonemarginy+"px"});$navPause.css({bottom:0,right:0,"margin-right":this.options.navshowplaypausestandalonemarginx+"px","margin-bottom":this.options.navshowplaypausestandalonemarginy+"px"});break;case "center":$navPlay.css({top:"50%",left:"50%","margin-left":"-"+Math.round(this.options.navshowplaypausestandalonewidth/2)+"px","margin-top":"-"+
Math.round(this.options.navshowplaypausestandaloneheight/2)+"px"});$navPause.css({top:"50%",left:"50%","margin-left":"-"+Math.round(this.options.navshowplaypausestandalonewidth/2)+"px","margin-top":"-"+Math.round(this.options.navshowplaypausestandaloneheight/2)+"px"});break}}else{$navPlay=$("<div class='amazingslider-nav-play-"+this.id+"' style='position:relative;float:"+floatDir+";margin-"+floatDir+":"+spacing+"px;width:"+this.options.navwidth+"px;height:"+this.options.navheight+"px;cursor:pointer;'></div>");
$bulletWrapper.append($navPlay);$navPause=$("<div class='amazingslider-nav-pause-"+this.id+"' style='position:relative;float:"+floatDir+";margin-"+floatDir+":"+spacing+"px;width:"+this.options.navwidth+"px;height:"+this.options.navheight+"px;cursor:pointer;'></div>");$bulletWrapper.append($navPause)}if(this.options.navbuttonradius)$navPlay.css(ASPlatforms.applyBrowserStyles({"border-radius":this.options.navbuttonradius+"px"}));if(this.options.navbuttoncolor)$navPlay.css({"background-color":this.options.navbuttoncolor});
if(this.options.navarrowimage)$navPlay.css({"background-image":"url('"+this.options.skinsfolder+this.options.navplaypauseimage+"')","background-repeat":"no-repeat","background-position":"left top"});$navPlay.hover(function(){if(instance.options.navbuttonhighlightcolor)$(this).css({"background-color":instance.options.navbuttonhighlightcolor});if(instance.options.navarrowimage)$(this).css({"background-position":"left bottom"})},function(){if(instance.options.navbuttoncolor)$(this).css({"background-color":instance.options.navbuttoncolor});
if(instance.options.navarrowimage)$(this).css({"background-position":"left top"})});$navPlay.click(function(){instance.isPaused=false;instance.loopCount=0;if(!instance.tempPaused)instance.sliderTimeout.start();$(this).css({display:"none"});$(".amazingslider-nav-pause-"+instance.id,instance.container).css({display:"block"})});if(this.options.navbuttonradius)$navPause.css(ASPlatforms.applyBrowserStyles({"border-radius":this.options.navbuttonradius+"px"}));if(this.options.navbuttoncolor)$navPause.css({"background-color":this.options.navbuttoncolor});
if(this.options.navarrowimage)$navPause.css({"background-image":"url('"+this.options.skinsfolder+this.options.navplaypauseimage+"')","background-repeat":"no-repeat","background-position":"right top"});$navPause.hover(function(){if(instance.options.navbuttonhighlightcolor)$(this).css({"background-color":instance.options.navbuttonhighlightcolor});if(instance.options.navarrowimage)$(this).css({"background-position":"right bottom"})},function(){if(instance.options.navbuttoncolor)$(this).css({"background-color":instance.options.navbuttoncolor});
if(instance.options.navarrowimage)$(this).css({"background-position":"right top"})});$navPause.click(function(){instance.isPaused=true;instance.sliderTimeout.stop();$(this).css({display:"none"});$(".amazingslider-nav-play-"+instance.id,instance.container).css({display:"block"})});if(this.options.navshowplaypausestandalone&&this.options.navshowplaypausestandaloneautohide){$navPlay.css({display:"none"});$navPause.css({display:"none"});this.$wrapper.hover(function(){if(instance.isPaused){$navPlay.fadeIn();
$navPause.css({display:"none"})}else{$navPlay.css({display:"none"});$navPause.fadeIn()}},function(){$navPlay.fadeOut();$navPause.fadeOut()})}else{$navPlay.css({display:instance.isPaused?"block":"none"});$navPause.css({display:instance.isPaused?"none":"block"})}}if(this.options.navshowarrow){var $navRight=$("<div class='amazingslider-nav-right-"+this.id+"' style='position:relative;float:"+floatDir+";margin-"+floatDir+":"+spacing+"px;width:"+this.options.navwidth+"px;height:"+this.options.navheight+
"px;cursor:pointer;'></div>");$bulletWrapper.append($navRight);if(this.options.navbuttonradius)$navRight.css(ASPlatforms.applyBrowserStyles({"border-radius":this.options.navbuttonradius+"px"}));if(this.options.navbuttoncolor)$navRight.css({"background-color":this.options.navbuttoncolor});if(this.options.navarrowimage)$navRight.css({"background-image":"url('"+this.options.skinsfolder+this.options.navarrowimage+"')","background-repeat":"no-repeat","background-position":"right top"});$navRight.hover(function(){if(instance.options.navbuttonhighlightcolor)$(this).css({"background-color":instance.options.navbuttonhighlightcolor});
if(instance.options.navarrowimage)$(this).css({"background-position":"right bottom"})},function(){if(instance.options.navbuttoncolor)$(this).css({"background-color":instance.options.navbuttoncolor});if(instance.options.navarrowimage)$(this).css({"background-position":"right top"})});$navRight.click(function(){instance.slideRun(-1)})}}},createNavBullet:function(index){var instance=this;var f=this.options.navdirection=="vertical"?"top":"left";var marginF=this.options.navdirection=="vertical"?"bottom":
"right";var spacing=index==this.elemArray.length-1?0:this.options.navspacing;var w=this.options.navstyle=="thumbnails"?this.options.navwidth-this.options.navborder*2:this.options.navwidth;var h=this.options.navstyle=="thumbnails"?this.options.navheight-this.options.navborder*2:this.options.navheight;var $bullet=$("<div class='amazingslider-bullet-"+this.id+"-"+index+"' style='position:relative;float:"+f+";margin-"+marginF+":"+spacing+"px;width:"+w+"px;height:"+h+"px;cursor:pointer;'></div>");$bullet.data("index",
index);$bullet.hover(function(){if($(this).data("index")!=instance.curElem)$(this)["bulletHighlight"+instance.id]();var bulletIndex=$(this).data("index");if(instance.options.navswitchonmouseover)if(bulletIndex!=instance.curElem)instance.slideRun(bulletIndex);if(instance.options.navshowpreview){var $preview=$(".amazingslider-nav-preview-"+instance.id,instance.container);var $previewImages=$(".amazingslider-nav-preview-images-"+instance.id,$preview);if(instance.options.navshowplayvideo){var $previewPlay=
$(".amazingslider-nav-preview-play-"+instance.id,$preview);if(instance.elemArray[bulletIndex][ELEM_VIDEO].length>0)$previewPlay.show();else $previewPlay.hide()}var $nav=$(".amazingslider-nav-"+instance.id,instance.container);var $bulletWrapper=$(".amazingslider-bullet-wrapper-"+instance.id,instance.container);var pos=$(this).position();var navPos=$nav.position();var bulletWrapperPos=$bulletWrapper.position();pos.left+=navPos.left+bulletWrapperPos.left;pos.left+=isNaN(parseInt($bulletWrapper.css("margin-left")))?
0:parseInt($bulletWrapper.css("margin-left"));pos.left+=isNaN(parseInt($nav.css("margin-left")))?0:parseInt($nav.css("margin-left"));pos.top+=navPos.top+bulletWrapperPos.top;pos.top+=isNaN(parseInt($bulletWrapper.css("margin-top")))?0:parseInt($bulletWrapper.css("margin-top"));pos.top+=isNaN(parseInt($nav.css("margin-top")))?0:parseInt($nav.css("margin-top"));if(instance.options.navdirection=="vertical"){var $navContainer=$(".amazingslider-nav-container-"+instance.id,instance.container);pos.top+=
isNaN(parseInt($navContainer.css("margin-top")))?0:parseInt($navContainer.css("margin-top"))}var t,l=pos.left+instance.options.navwidth/2-instance.options.navpreviewwidth/2-instance.options.navpreviewborder;var lv,tv=pos.top+instance.options.navheight/2-instance.options.navpreviewheight/2-instance.options.navpreviewborder;var p={};switch(instance.options.navpreviewposition){case "bottom":t=pos.top+instance.options.navheight+instance.options.navpreviewarrowheight;p={left:l+"px",top:t+"px"};break;case "top":t=
pos.top-instance.options.navpreviewheight-2*instance.options.navpreviewborder-instance.options.navpreviewarrowheight;p={left:l+"px",top:t+"px"};break;case "left":lv=pos.left-instance.options.navpreviewwidth-2*instance.options.navpreviewborder-instance.options.navpreviewarrowwidth;p={left:lv+"px",top:tv+"px"};break;case "right":lv=pos.left+instance.options.navwidth+instance.options.navpreviewarrowwidth;p={left:lv+"px",top:tv+"px"};break}var imgLoader=new Image;$(imgLoader).load(function(){var style;
if(this.width/this.height<=instance.options.navpreviewwidth/instance.options.navpreviewheight)style="width:"+instance.options.navpreviewwidth+"px;height:auto;margin-top:-"+Math.floor(this.height/this.width*instance.options.navpreviewwidth/2-instance.options.navpreviewheight/2)+"px";else style="width:auto;height:"+instance.options.navpreviewheight+"px;margin-left:-"+Math.floor(this.width/this.height*instance.options.navpreviewheight/2-instance.options.navpreviewwidth/2)+"px";var $prevImg=$(".amazingslider-nav-preview-img-"+
instance.id,$previewImages);if(instance.options.navdirection=="vertical"){var $curImg=$("<div class='amazingslider-nav-preview-img-"+instance.id+"' style='display:block;position:absolute;overflow:hidden;width:"+instance.options.navpreviewwidth+"px;height:"+instance.options.navpreviewheight+"px;left:0px;top:"+instance.options.navpreviewheight+"px;'><img src='"+instance.elemArray[bulletIndex][ELEM_THUMBNAIL]+"' style='display:block;position:absolute;left:0px;top:0px;"+style+"' /></div>");$previewImages.append($curImg);
if($prevImg.length>0)$prevImg.animate({top:"-"+instance.options.navpreviewheight+"px"},function(){$prevImg.remove()});if($preview.is(":visible")){$curImg.animate({top:"0px"});$preview.stop(true,true).animate(p)}else{$curImg.css({top:"0px"});$preview.stop(true,true).css(p).fadeIn()}}else{var $curImg=$("<div class='amazingslider-nav-preview-img-"+instance.id+"' style='display:block;position:absolute;overflow:hidden;width:"+instance.options.navpreviewwidth+"px;height:"+instance.options.navpreviewheight+
"px;left:"+instance.options.navpreviewheight+"px;top:0px;'><img src='"+instance.elemArray[bulletIndex][ELEM_THUMBNAIL]+"' style='display:block;position:absolute;left:0px;top:0px;"+style+"' /></div>");$previewImages.append($curImg);if($prevImg.length>0)$prevImg.animate({left:"-"+instance.options.navpreviewwidth+"px"},function(){$prevImg.remove()});if($preview.is(":visible")){$curImg.animate({left:"0px"});$preview.stop(true,true).animate(p)}else{$curImg.css({left:"0px"});$preview.stop(true,true).css(p).fadeIn()}}});
imgLoader.src=instance.elemArray[bulletIndex][ELEM_THUMBNAIL]}},function(){if($(this).data("index")!=instance.curElem)$(this)["bulletNormal"+instance.id]();if(instance.options.navshowpreview){var $preview=$(".amazingslider-nav-preview-"+instance.id,instance.container);$preview.delay(500).fadeOut()}});$bullet.click(function(){instance.slideRun($(this).data("index"),instance.options.playvideoonclickthumb)});if(this.options.navstyle=="bullets"){$bullet.css({background:"url('"+this.options.skinsfolder+
this.options.navimage+"') no-repeat left top"});$.fn["bulletNormal"+this.id]=function(){$(this).css({"background-position":"left top"})};$.fn["bulletHighlight"+this.id]=$.fn["bulletSelected"+this.id]=function(){$(this).css({"background-position":"left bottom"})}}else if(this.options.navstyle=="numbering"){$bullet.text(index+1);$bullet.css({"background-color":this.options.navcolor,color:this.options.navfontcolor,"font-size":this.options.navfontsize,"font-family":this.options.navfont,"text-align":"center",
"line-height":this.options.navheight+"px"});$bullet.css(ASPlatforms.applyBrowserStyles({"border-radius":this.options.navradius+"px"}));if(this.options.navbuttonshowbgimage&&this.options.navbuttonbgimage)$bullet.css({background:"url('"+this.options.skinsfolder+this.options.navbuttonbgimage+"') no-repeat center top"});$.fn["bulletNormal"+this.id]=function(){$(this).css({"background-color":instance.options.navcolor,"color":instance.options.navfontcolor});if(instance.options.navbuttonshowbgimage&&instance.options.navbuttonbgimage)$(this).css({"background-position":"center top"})};
$.fn["bulletHighlight"+this.id]=$.fn["bulletSelected"+this.id]=function(){$(this).css({"background-color":instance.options.navhighlightcolor,"color":instance.options.navfonthighlightcolor});if(instance.options.navbuttonshowbgimage&&instance.options.navbuttonbgimage)$(this).css({"background-position":"center bottom"})}}else if(this.options.navstyle=="thumbnails"){$bullet.css({padding:this.options.navborder+"px","background-color":this.options.navbordercolor});$bullet.css({opacity:this.options.navopacity,
filter:"alpha(opacity="+Math.round(100*this.options.navopacity)+")"});var imgLoader=new Image;var instance=this;$(imgLoader).load(function(){var style;if(this.width/this.height<=instance.options.navimagewidth/instance.options.navimageheight)style="max-width:none !important;width:100%;height:auto;margin-top:-"+Math.floor(this.height/this.width*instance.options.navimagewidth/2-instance.options.navimageheight/2)+"px";else style="max-width:none !important;width:auto;height:100%;margin-left:-"+Math.floor(this.width/
this.height*instance.options.navimageheight/2-instance.options.navimagewidth/2)+"px";$bullet.append("<div style='display:block;position:absolute;width:"+instance.options.navimagewidth+"px;height:"+instance.options.navimageheight+"px;overflow:hidden;'><img src='"+instance.elemArray[index][ELEM_THUMBNAIL]+"' style='"+style+"' /></div>");if(instance.options.navshowplayvideo&&instance.elemArray[index][ELEM_VIDEO].length>0)$bullet.append("<div style='display:block;position:absolute;margin-left:0;margin-top:0;width:"+
instance.options.navimagewidth+"px;height:"+instance.options.navimageheight+"px;"+'background:url("'+instance.options.skinsfolder+instance.options.navplayvideoimage+'") no-repeat center center;'+"' ></div>");if(instance.options.navthumbstyle!="imageonly"){var thumbtitle="<div style='display:block;position:absolute;overflow:hidden;";if(instance.options.navthumbstyle=="imageandtitle")thumbtitle+="margin-left:0px;margin-top:"+instance.options.navimageheight+"px;width:"+instance.options.navimagewidth+
"px;height:"+instance.options.navthumbtitleheight+"px;";else if(instance.options.navthumbstyle=="imageandtitledescription")thumbtitle+="margin-left:"+instance.options.navimagewidth+"px;margin-top:0px;width:"+instance.options.navthumbtitlewidth+"px;height:"+instance.options.navimageheight+"px;";thumbtitle+="'><div class='amazingslider-nav-thumbnail-tite-"+instance.id+"'>"+instance.elemArray[index][ELEM_TITLE]+"</div>";if(instance.options.navthumbstyle=="imageandtitledescription")thumbtitle+="<div class='amazingslider-nav-thumbnail-description-"+
instance.id+"'>"+instance.elemArray[index][ELEM_DESCRIPTION]+"</div>";thumbtitle+="</div>";$bullet.append(thumbtitle)}});imgLoader.src=this.elemArray[index][ELEM_THUMBNAIL];$.fn["bulletNormal"+this.id]=function(){$(this).css({opacity:instance.options.navopacity,filter:"alpha(opacity="+Math.round(100*instance.options.navopacity)+")"})};$.fn["bulletHighlight"+this.id]=function(){$(this).css({opacity:1,filter:"alpha(opacity=100)"})};$.fn["bulletSelected"+this.id]=function(){$(this).css({opacity:1,filter:"alpha(opacity=100)"});
if(instance.options.navshowfeaturedarrow){var $featuredarrow=$(".amazingslider-nav-featuredarrow-"+instance.id,instance.container);var pos=$(this).position();var $navContainer=$(".amazingslider-nav-container-"+instance.id,instance.container);var $bulletWrapper=$(".amazingslider-bullet-wrapper-"+instance.id,instance.container);if(instance.options.navdirection=="horizontal"){var t,l=pos.left+instance.options.navwidth/2-instance.options.navfeaturedarrowimagewidth/2;if(instance.options.navposition=="top"||
instance.options.navposition=="topleft"||instance.options.navposition=="topright")t=pos.top+instance.options.navheight;else t=pos.top-instance.options.navfeaturedarrowimageheight;$featuredarrow.css({top:t+"px"});if($featuredarrow.is(":visible"))$featuredarrow.stop(true,true).animate({left:l+"px"});else $featuredarrow.css({display:"block",left:l+"px"});if($navContainer.width()<$bulletWrapper.width()&&!instance.pauseCarousel){var m=Math.abs(isNaN(parseInt($bulletWrapper.css("margin-left")))?0:parseInt($bulletWrapper.css("margin-left")));
if(pos.left<m||pos.left+instance.options.navwidth>m+$navContainer.width()){var pl=-pos.left;if(pl<=$navContainer.width()-$bulletWrapper.width())pl=$navContainer.width()-$bulletWrapper.width();if(pl>=0)pl=0;$bulletWrapper.animate({"margin-left":pl+"px"},{queue:false,duration:500,easing:"easeOutCirc"});instance.updateCarouselLeftRightArrow(pl)}}}else{var l,t=pos.top+instance.options.navheight/2-instance.options.navfeaturedarrowimageheight/2;if(instance.options.navposition=="left")l=pos.left+instance.options.navwidth;
else l=pos.left-instance.options.navfeaturedarrowimagewidth;$featuredarrow.css({left:l+"px"});if($featuredarrow.is(":visible"))$featuredarrow.stop(true,true).animate({top:t+"px"});else $featuredarrow.css({display:"block",top:t+"px"});if($navContainer.height()<$bulletWrapper.height()&&!instance.pauseCarousel){var m=Math.abs(isNaN(parseInt($bulletWrapper.css("margin-top")))?0:parseInt($bulletWrapper.css("margin-top")));if(pos.top<m||pos.top+instance.options.navheight>m+$navContainer.height()){var pl=
-pos.top;if(pl<=$navContainer.height()-$bulletWrapper.height())pl=$navContainer.height()-$bulletWrapper.height();if(pl>=0)pl=0;$bulletWrapper.animate({"margin-top":pl+"px"},{queue:false,duration:500,easing:"easeOutCirc"});instance.updateCarouselLeftRightArrow(pl)}}}}}}return $bullet},slideRun:function(index,playVideo){savedCur=this.curElem;this.calcIndex(index);if(savedCur==this.curElem)return;if(this.isAnimating){if(this.transitionTimeout)clearTimeout(this.transitionTimeout);$(".amazingslider-img-box-"+
this.id,this.container).unbind("transitionFinished").html("<div class='amazingslider-img-"+this.id+" ' style='display:block;position:absolute;left:0px;top:0px;width:100%;height:auto;'><img style='position:absolute;max-width:100%;height:auto;left:0%;top:0%;' src='"+this.elemArray[savedCur][ELEM_SRC]+"' /></div>");this.isAnimating=false}this.sliderTimeout.stop();this.tempPaused=false;this.container.trigger("amazingslider.switch",[savedCur,this.curElem]);$(".amazingslider-video-wrapper-"+this.id,this.container).find("iframe").each(function(){$(this).attr("src",
"")});if((playVideo||this.options.autoplayvideo)&&this.elemArray[this.curElem][ELEM_VIDEO].length>0)this.playVideo(true);else{$(".amazingslider-video-wrapper-"+this.id,this.container).css({display:"none"}).empty();this.container.trigger("amazingslider.switchtext",[savedCur,this.curElem]);var slideDirection=true;if(index==-2)slideDirection=false;else if(index==-1)slideDirection=true;else if(index>=0)slideDirection=this.curElem>savedCur?true:false;this.showImage(slideDirection)}(new Image).src=this.elemArray[this.prevElem][ELEM_SRC];
(new Image).src=this.elemArray[this.nextElem][ELEM_SRC];if(!this.options.randomplay&&this.options.loop>0)if(this.curElem==this.elemArray.length-1){this.loopCount++;if(this.options.loop<=this.loopCount)this.isPaused=true}if(!this.isPaused&&!this.tempPaused&&this.elemArray.length>1)this.sliderTimeout.start()},showImage:function(slideDirection){var instance=this;var imgLoader=new Image;$(imgLoader).load(function(){var ratio=100;var $box=$(".amazingslider-img-box-"+instance.id,instance.container);var $imgPrev=
$(".amazingslider-img-"+instance.id,instance.container);var $imgCur=$("<div class='amazingslider-img-"+instance.id+" ' style='display:block;position:absolute;left:0px;top:0px;width:100%;height:auto;'><img style='position:absolute;"+(ASPlatforms.isIE678()?"opacity:inherit;filter:inherit;":"")+"max-width:"+ratio+"%;height:auto;left:"+(100-ratio)/2+"%;top:0%;' src='"+instance.elemArray[instance.curElem][ELEM_SRC]+"' /></div>");if($imgPrev.length>0)$imgPrev.before($imgCur);else $box.append($imgCur);var transitioneffect=
instance.firstslide&&!instance.options.transitiononfirstslide?"":instance.options.transition;instance.firstslide=false;instance.isAnimating=true;$box.amazingsliderTransition(instance.id,$imgPrev,$imgCur,{effect:transitioneffect,direction:slideDirection,duration:instance.options.transitionduration,easing:instance.options.transitioneasing,crossfade:instance.options.crossfade,fade:instance.options.fade,slide:instance.options.slide,slice:instance.options.slice,blinds:instance.options.blinds,threed:instance.options.threed,
threedhorizontal:instance.options.threedhorizontal,blocks:instance.options.blocks,shuffle:instance.options.shuffle},function(){instance.isAnimating=false},function(timeoutid){instance.transitionTimeout=timeoutid});if(instance.elemArray[instance.curElem][ELEM_LINK]){$box.css({cursor:"pointer"});$box.unbind("click").bind("click",function(){if(instance.elemArray[instance.curElem][ELEM_LIGHTBOX])instance.html5Lightbox.showItem(instance.elemArray[instance.curElem][ELEM_LINK]);else{var target=instance.elemArray[instance.curElem][ELEM_TARGET]?
instance.elemArray[instance.curElem][ELEM_TARGET]:"_self";window.open(instance.elemArray[instance.curElem][ELEM_LINK],target)}})}else{$box.css({cursor:""});$box.unbind("click")}$(".amazingslider-play-"+instance.id,instance.container).css({display:instance.elemArray[instance.curElem][ELEM_VIDEO].length>0?"block":"none"})});imgLoader.src=this.elemArray[this.curElem][ELEM_SRC]},calcIndex:function(index){var r;if(index==-2){this.nextElem=this.curElem;this.curElem=this.prevElem;this.prevElem=this.curElem-
1<0?this.elemArray.length-1:this.curElem-1;if(this.options.randomplay){r=Math.floor(Math.random()*this.elemArray.length);if(r!=this.curElem)this.prevElem=r}}else if(index==-1){this.prevElem=this.curElem;this.curElem=this.nextElem;this.nextElem=this.curElem+1>=this.elemArray.length?0:this.curElem+1;if(this.options.randomplay){r=Math.floor(Math.random()*this.elemArray.length);if(r!=this.curElem)this.nextElem=r}}else if(index>=0){this.curElem=index;this.prevElem=this.curElem-1<0?this.elemArray.length-
1:this.curElem-1;this.nextElem=this.curElem+1>=this.elemArray.length?0:this.curElem+1;if(this.options.randomplay){r=Math.floor(Math.random()*this.elemArray.length);if(r!=this.curElem)this.prevElem=r;r=Math.floor(Math.random()*this.elemArray.length);if(r!=this.curElem)this.nextElem=r}}}};options=options||{};for(var key in options)if(key.toLowerCase()!==key){options[key.toLowerCase()]=options[key];delete options[key]}this.each(function(){this.options=$.extend({},options);var instance=this;$.each($(this).data(),
function(key,value){instance.options[key.toLowerCase()]=value});var searchoptions={};var searchstring=window.location.search.substring(1).split("&");for(var i=0;i<searchstring.length;i++){var keyvalue=searchstring[i].split("=");if(keyvalue&&keyvalue.length==2){var key=keyvalue[0].toLowerCase();var value=unescape(keyvalue[1]).toLowerCase();if(value=="true")searchoptions[key]=true;else if(value=="false")searchoptions[key]=false;else searchoptions[key]=value}}this.options=$.extend(this.options,searchoptions);
var defaultOptions={previewmode:false,isresponsive:true,autoplay:false,pauseonmouseover:true,slideinterval:5E3,randomplay:false,loop:0,skinsfoldername:"skins",showtimer:true,timerposition:"bottom",timercolor:"#ffffff",timeropacity:0.6,timerheight:2,autoplayvideo:false,playvideoimage:"play-video.png",playvideoimagewidth:64,playvideoimageheight:64,playvideoonclickthumb:false,enabletouchswipe:true,border:6,bordercolor:"#ffffff",borderradius:0,showshadow:true,shadowsize:5,shadowcolor:"#aaaaaa",showbottomshadow:false,
bottomshadowimage:"bottom-shadow.png",bottomshadowimagewidth:140,bottomshadowimagetop:90,showbackgroundimage:false,backgroundimage:"background.png",backgroundimagewidth:120,backgroundimagetop:-10,arrowstyle:"mouseover",arrowimage:"arrows.png",arrowwidth:32,arrowheight:32,arrowmargin:0,arrowhideonmouseleave:1E3,arrowtop:50,showribbon:false,ribbonimage:"ribbon_topleft-0.png",ribbonposition:"topleft",ribbonimagex:-11,ribbonimagey:-11,textstyle:"static",textpositionstatic:"bottom",textautohide:false,
textpositionmarginstatic:0,textpositiondynamic:"topleft,topright,bottomleft,bottomright",textpositionmarginleft:24,textpositionmarginright:24,textpositionmargintop:24,textpositionmarginbottom:24,texteffect:"slide",texteffecteasing:"easeOutCubic",texteffectduration:600,addgooglefonts:true,googlefonts:"Inder",textcss:"display:block; padding:12px; text-align:left;",textbgcss:"display:block; position:absolute; top:0px; left:0px; width:100%; height:100%; background-color:#333333; opacity:0.6; filter:alpha(opacity=60);",
titlecss:"display:block; position:relative; font:bold 14px Inder,Arial,Tahoma,Helvetica,sans-serif; color:#fff;",descriptioncss:"display:block; position:relative; font:12px Anaheim,Arial,Tahoma,Helvetica,sans-serif; color:#fff;",shownumbering:false,numberingformat:"%NUM/%TOTAL ",navstyle:"thumbnails",navswitchonmouseover:false,navdirection:"horizontal",navposition:"bottom",navmargin:24,navwidth:64,navheight:60,navspacing:8,navshowpreview:true,navpreviewposition:"top",navpreviewarrowimage:"preview-arrow.png",
navpreviewarrowwidth:20,navpreviewarrowheight:10,navpreviewwidth:120,navpreviewheight:60,navpreviewborder:8,navpreviewbordercolor:"#ffff00",navimage:"bullets.png",navradius:0,navcolor:"",navhighlightcolor:"",navfont:"Lucida Console, Arial",navfontcolor:"#666666",navfonthighlightcolor:"#666666",navfontsize:12,navbuttonshowbgimage:true,navbuttonbgimage:"navbuttonbgimage.png",navshowbuttons:false,navbuttonradius:2,navbuttoncolor:"#999999",navbuttonhighlightcolor:"#333333",navshowplaypause:true,navshowarrow:true,
navplaypauseimage:"nav-play-pause.png",navarrowimage:"nav-arrows.png",navshowplaypausestandalone:false,navshowplaypausestandaloneautohide:false,navshowplaypausestandaloneposition:"bottomright",navshowplaypausestandalonemarginx:24,navshowplaypausestandalonemarginy:24,navshowplaypausestandalonewidth:32,navshowplaypausestandaloneheight:32,navopacity:0.8,navborder:2,navbordercolor:"#ffffff",navshowfeaturedarrow:true,navfeaturedarrowimage:"featured-arrow.png",navfeaturedarrowimagewidth:20,navfeaturedarrowimageheight:10,
navthumbstyle:"imageonly",navthumbtitleheight:20,navthumbtitlewidth:120,navthumbtitlecss:"display:block;position:relative;padding:2px 4px;text-align:left;font:bold 14px Arial,Helvetica,sans-serif;color:#333;",navthumbtitlehovercss:"text-decoration:underline;",navthumbdescriptioncss:"display:block;position:relative;padding:2px 4px;text-align:left;font:normal 12px Arial,Helvetica,sans-serif;color:#333;",navthumbnavigationstyle:"arrow",navthumbnavigationarrowimage:"carousel-arrows-32-32-0.png",navthumbnavigationarrowimagewidth:32,
navthumbnavigationarrowimageheight:32,navshowplayvideo:true,navplayvideoimage:"play-32-32-0.png",transitiononfirstslide:false,transition:"slide",transitionduration:1E3,transitioneasing:"easeOutQuad",fade:{duration:1E3,easing:"easeOutQuad"},crossfade:{duration:1E3,easing:"easeOutQuad"},slide:{duration:1E3,easing:"easeOutElastic"},slice:{duration:1500,easing:"easeOutQuad",effects:"up,down,updown",slicecount:8},blinds:{duration:1500,easing:"easeOutQuad",slicecount:4},threed:{duration:1500,easing:"easeOutQuad",
slicecount:4,fallback:"slice",bgcolor:"#222222",perspective:1E3,perspectiveorigin:"right",scatter:5},threedhorizontal:{duration:1500,easing:"easeOutQuad",slicecount:3,fallback:"slice",bgcolor:"#222222",perspective:1E3,perspectiveorigin:"bottom",scatter:5},blocks:{duration:1500,easing:"easeOutQuad",effects:"topleft, bottomright, top, bottom, random",rowcount:4,columncount:3},shuffle:{duration:1500,easing:"easeOutQuad",rowcount:4,columncount:3},versionmark:"AMFree",showwatermarkdefault:true,watermarkstyledefault:"text",
watermarktextdefault:"",watermarkimagedefault:"",watermarklinkdefault:"source=watermark",watermarktargetdefault:"_blank",watermarkpositioncssdefault:"display:block;position:absolute;bottom:6px;right:6px;",watermarktextcssdefault:"font:12px Arial,Tahoma,Helvetica,sans-serif;color:#666;padding:2px 4px;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px;background-color:#fff;opacity:0.9;filter:alpha(opacity=90);",watermarklinkcssdefault:"text-decoration:none;font:12px Arial,Tahoma,Helvetica,sans-serif;color:#333;"};
this.options=$.extend(defaultOptions,this.options);if(this.options.versionmark!="AMC"+"om"){this.options.showwatermark=window.location.href.indexOf("://"+"amazin"+"gslide"+"r.com")>=0?false:this.options.showwatermarkdefault;this.options.watermarkstyle=this.options.watermarkstyledefault;this.options.watermarktext=this.options.watermarktextdefault;this.options.watermarkimage=this.options.watermarkimagedefault;this.options.watermarklink=this.options.watermarklinkdefault;this.options.watermarktarget=
this.options.watermarktargetdefault;this.options.watermarkpositioncss=this.options.watermarkpositioncssdefault;this.options.watermarktextcss=this.options.watermarktextcssdefault;this.options.watermarklinkcss=this.options.watermarklinkcssdefault}if(typeof amazingslider_previewmode!="undefined")this.options.previewmode=amazingslider_previewmode;this.options.htmlfolder=window.location.href.substr(0,window.location.href.lastIndexOf("/")+1);if(this.options.skinsfoldername.length>0)this.options.skinsfolder=
this.options.jsfolder+this.options.skinsfoldername+"/";else this.options.skinsfolder=this.options.jsfolder;new AmazingSlider($(this),this.options,amazingsliderId++)})}})(jQuery);
(function($){$.fn.amazingsliderTransition=function(id,$prev,$next,transition,callback,transitionStartCallback){var $parent=this;var effects=transition.effect;var duration=transition.duration;var easing=transition.easing;var direction=transition.direction;var effect=null;if(effects){effects=effects.split(",");effect=effects[Math.floor(Math.random()*effects.length)];effect=$.trim(effect.toLowerCase())}if((effect=="threed"||effect=="threedhorizontal")&&!ASPlatforms.css33dTransformSupported())effect=
transition[effect].fallback;if(effect&&transition[effect]){if(transition[effect].duration)duration=transition[effect].duration;if(transition[effect].easing)easing=transition[effect].easing}if(effect=="fade"){$parent.css({overflow:"hidden"});$next.show();$prev.fadeOut(duration,easing,function(){$prev.remove();callback()})}else if(effect=="crossfade"){$parent.css({overflow:"hidden"});$next.hide();$prev.fadeOut(duration/2,easing,function(){$next.fadeIn(duration/2,easing,function(){$prev.remove();callback()})})}else if(effect==
"slide"){$parent.css({overflow:"hidden"});if(direction){$next.css({left:"100%"});$next.animate({left:"0%"},duration,easing);$prev.animate({left:"-100%"},duration,easing,function(){$prev.remove();callback()})}else{$next.css({left:"-100%"});$next.animate({left:"0%"},duration,easing);$prev.animate({left:"100%"},duration,easing,function(){$prev.remove();callback()})}}else if(effect=="slice"){$parent.css({overflow:"hidden"});$parent.sliceTransition(id,$prev,$next,$.extend({duration:duration,easing:easing,
direction:direction},transition["slice"]),callback,transitionStartCallback)}else if(effect=="blinds"){$parent.css({overflow:"hidden"});$parent.blindsTransition(id,$prev,$next,$.extend({duration:duration,easing:easing,direction:direction},transition["blinds"]),callback,transitionStartCallback)}else if(effect=="threed"){$parent.css({overflow:"visible"});$parent.threedTransition(id,$prev,$next,$.extend({duration:duration,easing:easing,direction:direction},transition["threed"]),callback,transitionStartCallback)}else if(effect==
"threedhorizontal"){$parent.css({overflow:"visible"});$parent.threedHorizontalTransition(id,$prev,$next,$.extend({duration:duration,easing:easing,direction:direction},transition["threedhorizontal"]),callback,transitionStartCallback)}else if(effect=="blocks"){$parent.css({overflow:"hidden"});$parent.blocksTransition(id,$prev,$next,$.extend({duration:duration,easing:easing,direction:direction},transition["blocks"]),callback,transitionStartCallback)}else if(effect=="shuffle"){$parent.css({overflow:"visible"});
$parent.shuffleTransition(id,$prev,$next,$.extend({duration:duration,easing:easing,direction:direction},transition["shuffle"]),callback,transitionStartCallback)}else{$next.show();$prev.remove();callback()}};$.fn.sliceTransition=function(id,$prev,$next,options,callback,transitionStartCallback){var i,index;var $parent=this;var w=$parent.width();var sliceW=Math.ceil(w/options.slicecount);$next.hide();for(i=0;i<options.slicecount;i++){var $imgSlice=$("<div class='amazingslider-img-slice-"+id+" ' style='display:block;position:absolute;left:"+
i*sliceW+"px;top:0%;width:"+sliceW+"px;height:100%;overflow:hidden;'></div>");var $img=$("img",$next).clone().css({"max-width":"",left:"-"+sliceW*i+"px"});$img.attr("style",$img.attr("style")+"; "+"max-width:"+w+"px !important;");$imgSlice.append($img);$parent.append($imgSlice)}var slices=$(".amazingslider-img-slice-"+id,$parent);if(!options.direction)slices=$($.makeArray(slices).reverse());var effects=options.effects.split(",");var effect=effects[Math.floor(Math.random()*effects.length)];effect=
$.trim(effect.toLowerCase());$parent.unbind("transitionFinished").bind("transitionFinished",function(){$parent.unbind("transitionFinished");$prev.remove();$next.show();slices.remove();callback()});var duration=options.duration/2;var interval=options.duration/2/options.slicecount;index=0;slices.each(function(){var slice=$(this);switch(effect){case "up":slice.css({top:"",bottom:"0%",height:"0%"});break;case "down":slice.css({top:"0%",height:"0%"});break;case "updown":if(index%2==0)slice.css({top:"0%",
height:"0%"});else slice.css({top:"",bottom:"0%",height:"0%"});break}setTimeout(function(){slice.animate({height:"100%"},duration,options.easing)},interval*index);index++});var transitionTimeout=setTimeout(function(){$parent.trigger("transitionFinished")},options.duration);transitionStartCallback(transitionTimeout)};$.fn.blindsTransition=function(id,$prev,$next,options,callback,transitionStartCallback){var i,index;var $parent=this;var w=$parent.width();var sliceW=Math.ceil(w/options.slicecount);$next.hide();
for(i=0;i<options.slicecount;i++){var $imgSliceWrapper=$("<div class='amazingslider-img-slice-wrapper-"+id+" ' style='display:block;position:absolute;left:"+i*sliceW+"px;top:0%;width:"+sliceW+"px;height:100%;overflow:hidden;'></div>");var $imgSlice=$("<div class='amazingslider-img-slice-"+id+" ' style='display:block;position:absolute;left:0%;top:0%;width:100%;height:100%;overflow:hidden;'></div>");var $img=$("img",$next).clone().css({"max-width":"",left:"-"+sliceW*i+"px"});$img.attr("style",$img.attr("style")+
"; "+"max-width:"+w+"px !important;");$imgSlice.append($img);$imgSliceWrapper.append($imgSlice);$parent.append($imgSliceWrapper)}var slices=$(".amazingslider-img-slice-"+id,$parent);if(!options.direction)slices=$($.makeArray(slices).reverse());$parent.unbind("transitionFinished").bind("transitionFinished",function(){$parent.unbind("transitionFinished");$prev.remove();$next.show();$(".amazingslider-img-slice-wrapper-"+id,$parent).remove();callback()});index=0;slices.each(function(){var slice=$(this);
var target;if(!options.direction){slice.css({left:"",right:"-100%"});target={right:"0%"}}else{slice.css({left:"-100%"});target={left:"0%"}}slice.animate(target,options.duration*(index+1)/options.slicecount,options.easing);index++});var transitionTimeout=setTimeout(function(){$parent.trigger("transitionFinished")},options.duration);transitionStartCallback(transitionTimeout)};$.fn.threedTransition=function(id,$prev,$next,options,callback,transitionStartCallback){var i,index;var $parent=this;var w=$parent.width(),
h=$parent.height(),dist=h/2;var sliceW=Math.ceil(w/options.slicecount);var $cubeWrapper=$("<div class='amazingslider-img-cube-wrapper-"+id+" ' style='display:block;position:absolute;left:0%;top:0%;width:100%;height:100%;'></div>");$parent.append($cubeWrapper);$cubeWrapper.css(ASPlatforms.applyBrowserStyles({"transform-style":"preserve-3d","perspective":options.perspective,"perspective-origin":options.perspectiveorigin+" center"}));$next.hide();for(i=0;i<options.slicecount;i++){var $nextImg=$("img",
$next).clone().css({"max-width":"",left:"-"+sliceW*i+"px"});$nextImg.attr("style",$nextImg.attr("style")+"; "+"max-width:"+w+"px !important;");var $nextImgSlice=$("<div class='amazingslider-img-slice-"+id+" ' style='display:block;position:absolute;left:0%;top:0%;width:100%;height:100%;overflow:hidden;outline:1px solid transparent;background-color:"+options.bgcolor+";'></div>");$nextImgSlice.append($nextImg);var $curImg=$("img",$prev).clone().css({"max-width":"",left:"-"+sliceW*i+"px"});$curImg.attr("style",
$curImg.attr("style")+"; "+"max-width:"+w+"px !important;");var $curImgSlice=$("<div class='amazingslider-img-slice-"+id+" ' style='display:block;position:absolute;left:0%;top:0%;width:100%;height:100%;overflow:hidden;outline:1px solid transparent;background-color:"+options.bgcolor+";'></div>");$curImgSlice.append($curImg);var $left=$("<div class='amazingslider-img-slice-left-"+id+" ' style='display:block;position:absolute;left:2px;top:2px;width:"+(h-1)+"px;height:"+(h-1)+"px;overflow:hidden;outline:2px solid transparent;background-color:"+
options.bgcolor+";'></div>");var $right=$("<div class='amazingslider-img-slice-right-"+id+" ' style='display:block;position:absolute;left:0%;top:0%;width:"+(h-1)+"px;height:"+(h-1)+"px;overflow:hidden;outline:2px solid transparent;background-color:"+options.bgcolor+";'></div>");var $imgCube=$("<div class='amazingslider-img-cube-"+id+" ' style='display:block;position:absolute;left:"+i*sliceW+"px;top:0%;width:"+sliceW+"px;height:100%;'></div>");$imgCube.append($left);$imgCube.append($right);$imgCube.append($nextImgSlice);
$imgCube.append($curImgSlice);$cubeWrapper.append($imgCube);$left.css(ASPlatforms.applyBrowserStyles({"transform-style":"preserve-3d","backface-visibility":"hidden","transform":"rotateY(-90deg) translateZ("+dist+"px"+")"}));$right.css(ASPlatforms.applyBrowserStyles({"transform-style":"preserve-3d","backface-visibility":"hidden","transform":"rotateY(90deg) translateZ("+(sliceW-dist)+"px"+")"}));$curImgSlice.css(ASPlatforms.applyBrowserStyles({"transform-style":"preserve-3d","backface-visibility":"hidden",
"transform":"translateZ("+dist+"px"+")"}));$nextImgSlice.css(ASPlatforms.applyBrowserStyles({"transform-style":"preserve-3d","backface-visibility":"hidden","transform":"rotateX("+(options.direction?"90":"-90")+"deg) translateZ("+dist+"px"+")"}))}var cubes=$(".amazingslider-img-cube-"+id,$parent);$parent.unbind("transitionFinished").bind("transitionFinished",function(){$parent.unbind("transitionFinished");$prev.remove();$next.show();setTimeout(function(){$cubeWrapper.remove()},100);callback()});var interval=
options.duration/2/options.slicecount;var duration=options.duration/2;cubes.each(function(){$(this).css(ASPlatforms.applyBrowserStyles({"transform-style":"preserve-3d","backface-visibility":"hidden"}));$(this).css(ASPlatforms.applyBrowserStyles({"transition-property":"transform"},true));$(this).css(ASPlatforms.applyBrowserStyles({"transform":"translateZ(-"+dist+"px"+")"}))});$prev.hide();index=0;cubes.each(function(){var cube=$(this);var mid=(options.slicecount-1)/2;var scatter=Math.round((index-
mid)*options.scatter*w/100);setTimeout(function(){cube.css(ASPlatforms.applyBrowserStyles({"transform-style":"preserve-3d","backface-visibility":"hidden"}));cube.css(ASPlatforms.applyBrowserStyles({"transition-property":"transform"},true));cube.css(ASPlatforms.applyBrowserStyles({"transition-duration":duration+"ms","transform":"translateZ(-"+dist+"px"+") rotateX("+(options.direction?"-89.99":"89.99")+"deg)"}));cube.animate({left:"+="+scatter+"px"},duration/2-50,function(){cube.animate({left:"-="+
scatter+"px"},duration/2-50)})},interval*index+100);index++});var transitionTimeout=setTimeout(function(){$parent.trigger("transitionFinished")},options.duration);transitionStartCallback(transitionTimeout)};$.fn.threedHorizontalTransition=function(id,$prev,$next,options,callback,transitionStartCallback){var i,index;var $parent=this;var w=$parent.width(),h=$parent.height(),dist=w/2;var sliceH=Math.ceil(h/options.slicecount);var $cubeWrapper=$("<div class='amazingslider-img-cube-wrapper-"+id+" ' style='display:block;position:absolute;left:0%;top:0%;width:100%;height:100%;'></div>");
$parent.append($cubeWrapper);$cubeWrapper.css(ASPlatforms.applyBrowserStyles({"transform-style":"preserve-3d","perspective":options.perspective,"perspective-origin":"center "+options.perspectiveorigin}));$next.hide();for(i=0;i<options.slicecount;i++){var $nextImg=$("img",$next).clone().css({"max-height":"",top:"-"+sliceH*i+"px"});$nextImg.attr("style",$nextImg.attr("style")+"; "+"max-height:"+h+"px !important;");var $nextImgSlice=$("<div class='amazingslider-img-slice-"+id+" ' style='display:block;position:absolute;left:0%;top:0%;width:100%;height:100%;overflow:hidden;outline:1px solid transparent;background-color:"+
options.bgcolor+";'></div>");$nextImgSlice.append($nextImg);var $curImg=$("img",$prev).clone().css({"max-height":"",top:"-"+sliceH*i+"px"});$curImg.attr("style",$curImg.attr("style")+"; "+"max-height:"+h+"px !important;");var $curImgSlice=$("<div class='amazingslider-img-slice-"+id+" ' style='display:block;position:absolute;left:0%;top:0%;width:100%;height:100%;overflow:hidden;outline:1px solid transparent;background-color:"+options.bgcolor+";'></div>");$curImgSlice.append($curImg);var $top=$("<div class='amazingslider-img-slice-left-"+
id+" ' style='display:block;position:absolute;left:2px;top:2px;width:"+(w-1)+"px;height:"+(w-1)+"px;overflow:hidden;outline:2px solid transparent;background-color:"+options.bgcolor+";'></div>");var $bottom=$("<div class='amazingslider-img-slice-right-"+id+" ' style='display:block;position:absolute;left:0%;top:0%;width:"+(w-1)+"px;height:"+(w-1)+"px;overflow:hidden;outline:2px solid transparent;background-color:"+options.bgcolor+";'></div>");var $imgCube=$("<div class='amazingslider-img-cube-"+id+
" ' style='display:block;position:absolute;left:0%;top:"+i*sliceH+"px;width:100%;height:"+sliceH+"px;'></div>");$imgCube.append($top);$imgCube.append($bottom);$imgCube.append($nextImgSlice);$imgCube.append($curImgSlice);$cubeWrapper.append($imgCube);$top.css(ASPlatforms.applyBrowserStyles({"transform-style":"preserve-3d","backface-visibility":"hidden","transform":"rotateX(90deg) translateZ("+dist+"px"+")"}));$bottom.css(ASPlatforms.applyBrowserStyles({"transform-style":"preserve-3d","backface-visibility":"hidden",
"transform":"rotateX(-90deg) translateZ("+(sliceH-dist)+"px"+")"}));$curImgSlice.css(ASPlatforms.applyBrowserStyles({"transform-style":"preserve-3d","backface-visibility":"hidden","transform":"translateZ("+dist+"px"+")"}));$nextImgSlice.css(ASPlatforms.applyBrowserStyles({"transform-style":"preserve-3d","backface-visibility":"hidden","transform":"rotateY("+(options.direction?"-90":"90")+"deg) translateZ("+dist+"px"+")"}))}var cubes=$(".amazingslider-img-cube-"+id,$parent);$parent.unbind("transitionFinished").bind("transitionFinished",
function(){$parent.unbind("transitionFinished");$prev.remove();$next.show();setTimeout(function(){$cubeWrapper.remove()},100);callback()});var interval=options.duration/2/options.slicecount;var duration=options.duration/2;cubes.each(function(){$(this).css(ASPlatforms.applyBrowserStyles({"transform-style":"preserve-3d","backface-visibility":"hidden"}));$(this).css(ASPlatforms.applyBrowserStyles({"transition-property":"transform"},true));$(this).css(ASPlatforms.applyBrowserStyles({"transform":"translateZ(-"+
dist+"px"+")"}))});$prev.hide();index=0;cubes.each(function(){var cube=$(this);var mid=(options.slicecount-1)/2;var scatter=Math.round((index-mid)*options.scatter*h/100);setTimeout(function(){cube.css(ASPlatforms.applyBrowserStyles({"transform-style":"preserve-3d","backface-visibility":"hidden"}));cube.css(ASPlatforms.applyBrowserStyles({"transition-property":"transform"},true));cube.css(ASPlatforms.applyBrowserStyles({"transition-duration":duration+"ms","transform":"translateZ(-"+dist+"px"+") rotateY("+
(options.direction?"89.99":"-89.99")+"deg)"}));cube.animate({top:"+="+scatter+"px"},duration/2-50,function(){cube.animate({top:"-="+scatter+"px"},duration/2-50)})},interval*index+100);index++});var transitionTimeout=setTimeout(function(){$parent.trigger("transitionFinished")},options.duration);transitionStartCallback(transitionTimeout)};$.fn.blocksTransition=function(id,$prev,$next,options,callback,transitionStartCallback){var i,j,index;var $parent=this;var w=$parent.width(),h=$parent.height();var blockW=
Math.ceil(w/options.columncount);var blockH=Math.ceil(h/options.rowcount);var effects=options.effects.split(",");var effect=effects[Math.floor(Math.random()*effects.length)];effect=$.trim(effect.toLowerCase());$next.hide();for(i=0;i<options.rowcount;i++)for(j=0;j<options.columncount;j++){var $imgBlockWrapper=$("<div class='amazingslider-img-block-wrapper-"+id+" ' style='display:block;position:absolute;left:"+j*blockW+"px;top:"+i*blockH+"px;width:"+blockW+"px;height:"+blockH+"px;overflow:hidden;'></div>");
var $imgBlock=$("<div class='amazingslider-img-block-"+id+" ' style='display:block;position:absolute;left:0%;top:0%;width:100%;height:100%;overflow:hidden;'></div>");var $img=$("img",$next).clone().css({"max-width":"","max-height":"",left:"-"+blockW*j+"px",top:"-"+blockH*i+"px"});$img.attr("style",$img.attr("style")+"; "+"max-width:"+w+"px !important;max-height:"+h+"px !important;");$imgBlock.append($img);$imgBlockWrapper.append($imgBlock);$parent.append($imgBlockWrapper)}var blocks=$(".amazingslider-img-block-"+
id,$parent);$parent.unbind("transitionFinished").bind("transitionFinished",function(){$parent.unbind("transitionFinished");$prev.remove();$next.show();$(".amazingslider-img-block-wrapper-"+id,$parent).remove();callback()});if(effect=="bottomright"||effect=="bottom")blocks=$($.makeArray(blocks).reverse());else if(effect=="random")blocks=$($.makeArray(blocks).sort(function(){return 0.5-Math.random()}));index=0;blocks.each(function(){var block=$(this);var row,col;row=Math.floor(index/options.columncount);
col=index%options.columncount;block.hide();switch(effect){case "topleft":case "bottomright":block.delay(options.duration*(row+col)/(options.rowcount+options.columncount)).fadeIn();break;case "top":case "bottom":case "random":block.delay(options.duration*index/(options.rowcount*options.columncount)).fadeIn();break}index++});var transitionTimeout=setTimeout(function(){$parent.trigger("transitionFinished")},options.duration);transitionStartCallback(transitionTimeout)};$.fn.shuffleTransition=function(id,
$prev,$next,options,callback,transitionStartCallback){var i,j,index;var $parent=this;var w=$parent.width(),h=$parent.height();var blockW=Math.ceil(w/options.columncount);var blockH=Math.ceil(h/options.rowcount);for(i=0;i<options.rowcount;i++)for(j=0;j<options.columncount;j++){var $imgBlockWrapperNext=$("<div class='amazingslider-img-block-wrapper-next-"+id+" ' style='display:block;position:absolute;left:"+j*blockW+"px;top:"+i*blockH+"px;width:"+blockW+"px;height:"+blockH+"px;overflow:hidden;'></div>");
var $imgBlockNext=$("<div class='amazingslider-img-block-next-"+id+" ' style='display:block;position:absolute;left:0%;top:0%;width:100%;height:100%;overflow:hidden;'></div>");var $imgNext=$("img",$next).clone().css({"max-width":"","max-height":"",left:"-"+blockW*j+"px",top:"-"+blockH*i+"px"});$imgNext.attr("style",$imgNext.attr("style")+"; "+"max-width:"+w+"px !important;max-height:"+h+"px !important;");$imgBlockNext.append($imgNext);$imgBlockWrapperNext.append($imgBlockNext);$parent.append($imgBlockWrapperNext);
var $imgBlockWrapperPrev=$("<div class='amazingslider-img-block-wrapper-prev-"+id+" ' style='display:block;position:absolute;left:"+j*blockW+"px;top:"+i*blockH+"px;width:"+blockW+"px;height:"+blockH+"px;overflow:hidden;'></div>");var $imgBlockPrev=$("<div class='amazingslider-img-block-prev-"+id+" ' style='display:block;position:absolute;left:0%;top:0%;width:100%;height:100%;overflow:hidden;'></div>");var $imgPrev=$("img",$prev).clone().css({"max-width":"","max-height":"",left:"-"+blockW*j+"px",top:"-"+
blockH*i+"px"});$imgPrev.attr("style",$imgPrev.attr("style")+"; "+"max-width:"+w+"px !important;max-height:"+h+"px !important;");$imgBlockPrev.append($imgPrev);$imgBlockWrapperPrev.append($imgBlockPrev);$parent.append($imgBlockWrapperPrev)}$next.hide();$prev.hide();var blocksNext=$(".amazingslider-img-block-wrapper-next-"+id,$parent);var blocksPrev=$(".amazingslider-img-block-wrapper-prev-"+id,$parent);$parent.unbind("transitionFinished").bind("transitionFinished",function(){$parent.unbind("transitionFinished");
$prev.remove();$next.show();$(".amazingslider-img-block-wrapper-next-"+id,$parent).remove();$(".amazingslider-img-block-wrapper-prev-"+id,$parent).remove();callback()});var offset=$parent.offset();var distL=-offset.left;var distR=$(window).width()-offset.left-$parent.width()/options.columncount;var distT=-offset.top*100/$parent.height();var distB=$(window).height()-offset.top-$parent.height()/options.rowcount;index=0;blocksPrev.each(function(){var block=$(this);var posL=Math.random()*(distR-distL)+
distL;var posT=Math.random()*(distB-distT)+distT;block.animate({left:posL+"px",top:posT+"px",opacity:0},options.duration,options.easing);index++});index=0;blocksNext.each(function(){var block=$(this);var row=Math.floor(index/options.columncount);var col=index%options.columncount;var posL=Math.random()*(distR-distL)+distL;var posT=Math.random()*(distB-distT)+distT;block.css({left:posL+"px",top:posT+"px",opacity:0},options.duration,options.easing);block.animate({left:col*blockW+"px",top:row*blockH+
"px",opacity:1},options.duration,options.easing);index++});var transitionTimeout=setTimeout(function(){$parent.trigger("transitionFinished")},options.duration);transitionStartCallback(transitionTimeout)}})(jQuery);
(function($){$.fn.touchSwipe=function(options){var defaults={preventWebBrowser:false,swipeLeft:null,swipeRight:null,swipeTop:null,swipeBottom:null};if(options)$.extend(defaults,options);return this.each(function(){var startX=-1,startY=-1;var curX=-1,curY=-1;function touchStart(event){var e=event.originalEvent;if(e.targetTouches.length>=1){startX=e.targetTouches[0].pageX;startY=e.targetTouches[0].pageY}else touchCancel(event)}function touchMove(event){if(defaults.preventWebBrowser)event.preventDefault();
var e=event.originalEvent;if(e.targetTouches.length>=1){curX=e.targetTouches[0].pageX;curY=e.targetTouches[0].pageY}else touchCancel(event)}function touchEnd(event){if(curX>0||curY>0){triggerHandler();touchCancel(event)}else touchCancel(event)}function touchCancel(event){startX=-1;startY=-1;curX=-1;curY=-1}function triggerHandler(){if(curX>startX){if(defaults.swipeRight)defaults.swipeRight.call()}else if(defaults.swipeLeft)defaults.swipeLeft.call();if(curY>startY){if(defaults.swipeBottom)defaults.swipeBottom.call()}else if(defaults.swipeTop)defaults.swipeTop.call()}
try{$(this).bind("touchstart",touchStart);$(this).bind("touchmove",touchMove);$(this).bind("touchend",touchEnd);$(this).bind("touchcancel",touchCancel)}catch(e){}})}})(jQuery);jQuery.easing["jswing"]=jQuery.easing["swing"];
jQuery.extend(jQuery.easing,{def:"easeOutQuad",swing:function(x,t,b,c,d){return jQuery.easing[jQuery.easing.def](x,t,b,c,d)},easeInQuad:function(x,t,b,c,d){return c*(t/=d)*t+b},easeOutQuad:function(x,t,b,c,d){return-c*(t/=d)*(t-2)+b},easeInOutQuad:function(x,t,b,c,d){if((t/=d/2)<1)return c/2*t*t+b;return-c/2*(--t*(t-2)-1)+b},easeInCubic:function(x,t,b,c,d){return c*(t/=d)*t*t+b},easeOutCubic:function(x,t,b,c,d){return c*((t=t/d-1)*t*t+1)+b},easeInOutCubic:function(x,t,b,c,d){if((t/=d/2)<1)return c/
2*t*t*t+b;return c/2*((t-=2)*t*t+2)+b},easeInQuart:function(x,t,b,c,d){return c*(t/=d)*t*t*t+b},easeOutQuart:function(x,t,b,c,d){return-c*((t=t/d-1)*t*t*t-1)+b},easeInOutQuart:function(x,t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t*t+b;return-c/2*((t-=2)*t*t*t-2)+b},easeInQuint:function(x,t,b,c,d){return c*(t/=d)*t*t*t*t+b},easeOutQuint:function(x,t,b,c,d){return c*((t=t/d-1)*t*t*t*t+1)+b},easeInOutQuint:function(x,t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t*t*t+b;return c/2*((t-=2)*t*t*t*t+2)+b},easeInSine:function(x,
t,b,c,d){return-c*Math.cos(t/d*(Math.PI/2))+c+b},easeOutSine:function(x,t,b,c,d){return c*Math.sin(t/d*(Math.PI/2))+b},easeInOutSine:function(x,t,b,c,d){return-c/2*(Math.cos(Math.PI*t/d)-1)+b},easeInExpo:function(x,t,b,c,d){return t==0?b:c*Math.pow(2,10*(t/d-1))+b},easeOutExpo:function(x,t,b,c,d){return t==d?b+c:c*(-Math.pow(2,-10*t/d)+1)+b},easeInOutExpo:function(x,t,b,c,d){if(t==0)return b;if(t==d)return b+c;if((t/=d/2)<1)return c/2*Math.pow(2,10*(t-1))+b;return c/2*(-Math.pow(2,-10*--t)+2)+b},
easeInCirc:function(x,t,b,c,d){return-c*(Math.sqrt(1-(t/=d)*t)-1)+b},easeOutCirc:function(x,t,b,c,d){return c*Math.sqrt(1-(t=t/d-1)*t)+b},easeInOutCirc:function(x,t,b,c,d){if((t/=d/2)<1)return-c/2*(Math.sqrt(1-t*t)-1)+b;return c/2*(Math.sqrt(1-(t-=2)*t)+1)+b},easeInElastic:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0)return b;if((t/=d)==1)return b+c;if(!p)p=d*0.3;if(a<Math.abs(c)){a=c;var s=p/4}else var s=p/(2*Math.PI)*Math.asin(c/a);return-(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*2*
Math.PI/p))+b},easeOutElastic:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0)return b;if((t/=d)==1)return b+c;if(!p)p=d*0.3;if(a<Math.abs(c)){a=c;var s=p/4}else var s=p/(2*Math.PI)*Math.asin(c/a);return a*Math.pow(2,-10*t)*Math.sin((t*d-s)*2*Math.PI/p)+c+b},easeInOutElastic:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0)return b;if((t/=d/2)==2)return b+c;if(!p)p=d*0.3*1.5;if(a<Math.abs(c)){a=c;var s=p/4}else var s=p/(2*Math.PI)*Math.asin(c/a);if(t<1)return-0.5*a*Math.pow(2,10*
(t-=1))*Math.sin((t*d-s)*2*Math.PI/p)+b;return a*Math.pow(2,-10*(t-=1))*Math.sin((t*d-s)*2*Math.PI/p)*0.5+c+b},easeInBack:function(x,t,b,c,d,s){if(s==undefined)s=1.70158;return c*(t/=d)*t*((s+1)*t-s)+b},easeOutBack:function(x,t,b,c,d,s){if(s==undefined)s=1.70158;return c*((t=t/d-1)*t*((s+1)*t+s)+1)+b},easeInOutBack:function(x,t,b,c,d,s){if(s==undefined)s=1.70158;if((t/=d/2)<1)return c/2*t*t*(((s*=1.525)+1)*t-s)+b;return c/2*((t-=2)*t*(((s*=1.525)+1)*t+s)+2)+b},easeInBounce:function(x,t,b,c,d){return c-
jQuery.easing.easeOutBounce(x,d-t,0,c,d)+b},easeOutBounce:function(x,t,b,c,d){if((t/=d)<1/2.75)return c*7.5625*t*t+b;else if(t<2/2.75)return c*(7.5625*(t-=1.5/2.75)*t+0.75)+b;else if(t<2.5/2.75)return c*(7.5625*(t-=2.25/2.75)*t+0.9375)+b;else return c*(7.5625*(t-=2.625/2.75)*t+0.984375)+b},easeInOutBounce:function(x,t,b,c,d){if(t<d/2)return jQuery.easing.easeInBounce(x,t*2,0,c,d)*0.5+b;return jQuery.easing.easeOutBounce(x,t*2-d,0,c,d)*0.5+c*0.5+b}});
if(typeof ASYouTubeIframeAPIReady==="undefined"){var ASYouTubeIframeAPIReady=false;var ASYouTubeTimeout=0;function onYouTubeIframeAPIReady(){ASYouTubeIframeAPIReady=true}}if(typeof amazingsliderId==="undefined")var amazingsliderId=0;
| ccastillo89/SOATEAM | UPC.SisTictecks/UPC.SisTictecks.Web/Scripts/amazingslider.js | JavaScript | gpl-3.0 | 125,879 |