$( contentEditors ).each( function( index, element ) { var data = initDatas[element]; if ( data.body_class ) { t = data.body_class.split( ' ' ); } let bc = $( '#SnS_classes_body' ).val().split( ' ' ), pc = $( '#SnS_classes_post' ).val().split( ' ' ), p; for ( let i = 0; i < t.length; i++ ) { p = $.inArray( bc[i], t ); if ( -1 != p ) { t.splice( p, 1 ); } } for ( let i = 0; i < t.length; i++ ) { p = $.inArray( pc[i], t ); if ( -1 != p ) { t.splice( p, 1 ); } } t = t.join( ' ' ); a[element] = t; });
CMailView.prototype.resetDisabledTools = function (sModuleName, aDisabledTools) { if ($.inArray('spam', aDisabledTools) !== -1) { this.customModulesDisabledSpam(_.union(this.customModulesDisabledSpam(), [sModuleName])); } else { this.customModulesDisabledSpam(_.without(this.customModulesDisabledSpam(), sModuleName)); } if ($.inArray('move', aDisabledTools) !== -1) { this.customModulesDisabledMove(_.union(this.customModulesDisabledMove(), [sModuleName])); } else { this.customModulesDisabledMove(_.without(this.customModulesDisabledMove(), sModuleName)); } if ($.inArray('mark', aDisabledTools) !== -1) { this.customModulesDisabledMark(_.union(this.customModulesDisabledMark(), [sModuleName])); } else { this.customModulesDisabledMark(_.without(this.customModulesDisabledMark(), sModuleName)); } };
}).then(function(hash) { var uniquePlaceTypeIds = [], uniqueChapterIds = [], i; hash = $.extend(true, {}, parentModel, hash); hash.placeTypes = []; for (i = 0; i < hash.places.content.length; i++) { var placeType = hash.places.content[i].get('place_type'); if (placeType && $.inArray(placeType.get('id'), uniquePlaceTypeIds) === -1) { hash.placeTypes.push(placeType); uniquePlaceTypeIds.push(placeType.get('id')); } } hash.chapters = []; for (i = 0; i < hash.events.content.length; i++) { var chapterId = hash.events.content[i].get('chapter_id'); if (chapterId && $.inArray(chapterId, uniqueChapterIds) === -1) { hash.chapters.push(hash.events.content[i].get('chapter')); uniqueChapterIds.push(chapterId); } } return hash; });
module.exports = function(context) { // var bounds = context.mapLayer.getBounds(); // if (bounds.isValid()) context.map.fitBounds(bounds); var bbox = turf.bbox(context.data.get('map')); if (bbox && !$.inArray(Infinity, bbox) && !$.inArray(-Infinity, bbox)) { context.map.fitBounds(bbox); } };
var suffix = function(suffix) { var suffixLower = suffix.toLowerCase(); if ($.inArray(suffixLower, ['jr', 'sr']) !== -1) { suffix = suffix + '.'; suffix = suffix.charAt(0).toUpperCase() + suffix.slice(1); } else if ($.inArray(suffixLower, ['ii', 'iii', 'iv', 'v']) !== -1) { suffix = suffix.toUpperCase(); } return suffix; };
/** * @constructor */ function CMobileSyncSettingsView() { this.bVisiblePersonalContacts = -1 !== $.inArray('personal', Settings.Storages); this.bVisibleSharedWithAllContacts = -1 !== $.inArray('shared', Settings.Storages); this.bVisibleTeamContacts = -1 !== $.inArray('team', Settings.Storages); this.davPersonalContactsUrl = ko.observable(''); this.davCollectedAddressesUrl = ko.observable(''); this.davSharedWithAllUrl = ko.observable(''); this.davTeamAddressBookUrl = ko.observable(''); }
$.fn.defaultAjaxError.func = function(event, request, settings, error) { const inProduction = (INST.environment === "production") const unhandled = ($.inArray(request, $.ajaxJSON.unhandledXHRs) !== -1) const ignore = ($.inArray(request, $.ajaxJSON.ignoredXHRs) !== -1) if((!inProduction || unhandled || $.ajaxJSON.isUnauthenticated(request)) && !ignore) { // $.grep will throw an error if it somehow gets something without length like undefined $.ajaxJSON.unhandledXHRs = ($.ajaxJSON.unhandledXHRs) ? $.grep($.ajaxJSON.unhandledXHRs, (xhr) => xhr !== request) : $.ajaxJSON.unhandledXHRs const debugOnly = !!unhandled func.call(this, event, request, settings, error, debugOnly) } }
Remover.prototype.remove = function (positions) { if (!positions.length) { return; } var _a = this, getter = _a.getter, saveLoad = _a.saveLoad, switcher = _a.switcher, context = _a.context; var removeIndecies = []; for (var i = 0, len = positions.length; i < len; i++) { var removeIndex = getter.positionToIndex(positions[i]); if (removeIndex >= 0 && removeIndex < context.itemCount && $.inArray(removeIndex, removeIndecies) === -1) { removeIndecies.push(removeIndex); } } if (!removeIndecies.length) { return; } removeIndecies.sort(function (prev, next) { return next - prev; }); if (context.itemCount > 1 && $.inArray(context.currentIndex, removeIndecies) >= 0) { switcher.switchNext({ exclude: removeIndecies }) || switcher.switchPrevious({ exclude: removeIndecies }) || switcher.switchNext({ includeDisabled: true, exclude: removeIndecies }) || switcher.switchPrevious({ includeDisabled: true, exclude: removeIndecies }) || switcher.switchNext({ includeHidden: true, exclude: removeIndecies }) || switcher.switchPrevious({ includeHidden: true, exclude: removeIndecies }) || switcher.switchNext({ includeDisabled: true, includeHidden: true, exclude: removeIndecies }) || switcher.switchPrevious({ includeDisabled: true, includeHidden: true, exclude: removeIndecies }); } var currentIndexChanged = false; for (var i = 0, len = removeIndecies.length; i < len; i++) { var removeIndex = removeIndecies[i]; var $labelItems = getter.getHeaderFooterLabels(removeIndex); var $panelItem = getter.getPanel(removeIndex); $labelItems.remove(); $panelItem.remove(); if (removeIndex < context.currentIndex) { context.currentIndex--; currentIndexChanged = true; } context.itemCount--; } if (context.itemCount === 0) { context.currentIndex = -1; context.currentName = undefined; } else if (currentIndexChanged && !context.currentName) { saveLoad.savePosition(context.currentIndex); } return removeIndecies.length; };
setBoundsOptions: function () { var that = this, boundsAvailable = [], newBounds = $.trim(that.options.bounds).split('-'), boundFrom = newBounds[0], boundTo = newBounds[newBounds.length - 1], boundsOwn = [], boundIsOwn, boundsAll = [], indexTo; if (that.type.dataComponents) { $.each(that.type.dataComponents, function () { if (this.forBounds) { boundsAvailable.push(this.id); } }); } if ($.inArray(boundFrom, boundsAvailable) === -1) { boundFrom = null; } indexTo = $.inArray(boundTo, boundsAvailable); if (indexTo === -1 || indexTo === boundsAvailable.length - 1) { boundTo = null; } if (boundFrom || boundTo) { boundIsOwn = !boundFrom; $.each(boundsAvailable, function (i, bound) { if (bound == boundFrom) { boundIsOwn = true; } boundsAll.push(bound); if (boundIsOwn) { boundsOwn.push(bound); } if (bound == boundTo) { return false; } }); } that.bounds.from = boundFrom; that.bounds.to = boundTo; that.bounds.all = boundsAll; that.bounds.own = boundsOwn; },
cockpit.transport.wait(function() { var caps = cockpit.transport.options.capabilities || []; /* If cockpit-ws is handling ssh, check for each capability. Otherwise * the version is new enough that is has them all */ if ($.inArray("ssh", caps) > -1) { mod.allow_connection_string = $.inArray("connection-string", caps) != -1; mod.has_auth_results = $.inArray("auth-method-results", caps) != -1; known_hosts_path = "/var/lib/cockpit/known_hosts"; mod.known_hosts_path = known_hosts_path; console.debug("Running against legacy ws with ssh, using legacy file", known_hosts_path); } else { mod.allow_connection_string = true; mod.has_auth_results = true; } });
image.onload = function () { if (previewColor !== undefined) { if ($.inArray(quad, clrQuads) >= 0) { clrQuads.splice($.inArray(quad, clrQuads), 1); } } quad.image = image; m_this.dataTime().modified(); m_this.modified(); m_this._update(); m_this.layer().draw(); if (prev_onload) { return prev_onload.apply(this, arguments); } };
function loadEngine() { /********************* Configure locales *********************/ var localeList = ['en', 'fr', 'de']; i18n.configure({ defaultLocale: 'en', locales: localeList, directory: kick.gui.pluginsDir + 'kickass/locales', updateFiles: true }); if ($.inArray(kick.gui.settings.locale, localeList) > -1) { console.log('Loading kick engine with locale' + kick.gui.settings.locale); i18n.setLocale(kick.gui.settings.locale); } else { i18n.setLocale('en'); } // menus needed by the module and menu(s) loaded by default kick.menuEntries = ["searchTypes", "orderBy"]; kick.defaultMenus = ["searchTypes", "orderBy"]; // searchTypes menus and default entry kick.searchTypes = JSON.parse('{"' + _("Search") + '":"search"}'); kick.defaultSearchType = 'search'; // orderBy filters and default entry kick.orderBy_filters = JSON.parse('{"' + _("Date") + '":"time_add","' + _("Seeds") + '":"seeds"}'); kick.defaultOrderBy = 'time_add'; // others params kick.has_related = false; kick.categoriesLoaded = true; }
this.add = function (defer, callback, atEnd) { if (defer.__fetchQueue) { var pos = $.inArray(defer, this._queue); if (pos >= 0) { this._queue.splice(pos, 1); this._addToQueue(defer, atEnd); return defer; } } var wait = new $.Deferred(); var process = new $.Deferred(); wait.then(function () { $.when(callback.call(defer)).always(process.resolve); }, process.resolve); defer.__fetchQueue = wait; this._addToQueue(defer, atEnd); $.when(wait, process).always(function () { if (m_this._processing > 0) { m_this._processing -= 1; } m_this.next_item(); }).promise(defer); m_this.next_item(); return defer; };
collectionNames.forEach((collectionName) => { if (CollectionFilter.filterRegex.get() && !collectionName.name.match(new RegExp(CollectionFilter.filterRegex.get(), 'i'))) return; if ($.inArray(collectionName.name, CollectionFilter.excludedCollectionsByFilter.get()) !== -1) return; if (isSystem && collectionName.name.startsWith('system')) result.push(collectionName); else if (!isSystem && !collectionName.name.startsWith('system')) result.push(collectionName); });
function updateComparisons( changes ) { var loanDataChanged = false; for ( var i = 0, len = changes.length; i < len; i++ ) { if ( changes[i].name == 'down-payment' && typeof percentDownAccessedLast !== 'undefined' && !percentDownAccessedLast ) { var val = loan['down-payment'] / loan['price'] * 100; $percent.val( Math.round(val) ); percentDownAccessedLast = false; } // If a user-editable field has changed, rate needs updating if (!loanDataChanged && ($.inArray(changes[i].name, editableFields) !== -1)) { loanDataChanged = true; } } if (loanDataChanged) { if (currentRequest) { getRateData(); } else { $form.removeClass('updating').addClass('update'); } } updateLoanDisplay(); }
function loadEngine() { /********************* Configure locales *********************/ var localeList = ['en', 'fr','de']; i18n.configure({ defaultLocale: 'en', locales:localeList, directory: shoutcast.gui.pluginsDir + 'shoutcast/locales', updateFiles: true }); if ($.inArray(shoutcast.gui.settings.locale, localeList) >-1) { console.log('Loading shoutcast engine with locale ' + shoutcast.gui.settings.locale); i18n.setLocale(shoutcast.gui.settings.locale); } else { i18n.setLocale('en'); } /********************* engine config ************************* **************************************************************/ // menus needed by the module and menu(s) loaded by default shoutcast.menuEntries = ["searchTypes","searchFilters"]; shoutcast.defaultMenus = ["searchTypes","searchFilters"]; // searchTypes menus and default entry shoutcast.searchTypes = JSON.parse('{"'+_("Search")+'":"search"}'); shoutcast.searchFilters = JSON.parse('{"'+_("Shoutcast")+'":"shoutcast","'+_("Icecast")+'":"icecast"}'); shoutcast.defaultSearchFilter = "shoutcast"; shoutcast.defaultSearchType = 'search'; // others params shoutcast.has_related = false; }
$.each(data, function(k, v) { var imgLink = v.server_type ? v.server_type.replace('.','').toLowerCase() : 'other'; $.inArray(imgLink, self.listAvailablePbxs()) < 0 ? imgLink = 'other' : true; $('#pbxs_manager_listpanel .pbx-wrapper[data-id="'+k+'"] .img-wrapper', parent).append('<img class="img_style" src="'+self.appPath+'/style/static/images/endpoints/'+ imgLink +'.png" height="49" width=72"/>'); });
var moveEvent = function(event) { var direction = this.KEYS[event.which]; // Check the key/direction is enabled if ($.inArray(direction, this.options.enabledKeys) === -1) { return; } if (this.options.continuousDelay > 0) { if (moveTimer) { return; } moveTimer = setTimeout(function() { moveTimer = null; }, this.options.continuousDelay); } event.preventDefault(); this.move(event.target, direction); };
function loadEngine() { /********************* Configure locales *********************/ var localeList = ['en', 'fr']; i18n.configure({ defaultLocale: 'en', locales:localeList, directory: tProject.gui.pluginsDir + 'tproject/locales', updateFiles: true }); if ($.inArray(tProject.gui.settings.locale, localeList) >-1) { console.log('Loading tproject engine with locale' + tProject.gui.settings.locale); i18n.setLocale(tProject.gui.settings.locale); } else { i18n.setLocale('en'); } // menus needed by the module and menu(s) loaded by default tProject.menuEntries = ["searchTypes","orderBy","categories"]; tProject.defaultMenus = ["searchTypes","orderBy","categories"]; // searchTypes menus and default entry tProject.searchTypes = JSON.parse('{"'+_("Search torrents")+'":"search","'+_("Search Files")+'":"searchFiles"}'); tProject.defaultSearchType = 'search'; // orderBy filters and default entry tProject.orderBy_filters = JSON.parse('{"'+_("Best")+'":"best","'+_("Seeds")+'":"seeders"}'); tProject.defaultOrderBy = 'best'; // category filters and default entry tProject.category_filters = JSON.parse('{"'+_("All")+'":"9000","'+_("Videos")+'":"2000","'+_("Audio")+'":"1000"}'); tProject.defaultCategory = '9000'; // others params tProject.has_related = false; tProject.categoriesLoaded = false; }
function loadEngine() { /********************* Configure locales *********************/ var localeList = ['en', 'fr']; i18n.configure({ defaultLocale: 'en', locales:localeList, directory: omgTorrent.gui.pluginsDir + 'omgtorrent/locales', updateFiles: true }); if ($.inArray(omgTorrent.gui.settings.locale, localeList) >-1) { console.log('Loading omgtorrent engine with locale' + omgTorrent.gui.settings.locale); i18n.setLocale(omgTorrent.gui.settings.locale); } else { i18n.setLocale('en'); } // menus needed by the module and menu(s) loaded by default omgTorrent.menuEntries = ["searchTypes","orderBy","categories"]; omgTorrent.defaultMenus = ["searchTypes","orderBy"]; // searchTypes menus and default entry omgTorrent.searchTypes = JSON.parse('{"'+_("Search")+'":"search","'+_("Navigation")+'":"navigation"}'); omgTorrent.defaultSearchType = 'navigation'; // orderBy filters and default entry omgTorrent.orderBy_filters = JSON.parse('{"'+_("Date")+'":"id","'+_("Seeds")+'":"seeders"}'); omgTorrent.defaultOrderBy = 'id'; // category filters and default entry omgTorrent.category_filters = JSON.parse('{"'+_("Movies")+'":"films"}'); omgTorrent.defaultCategory = 'films'; // others params omgTorrent.has_related = false; omgTorrent.categoriesLoaded = false; }
, highlightFillColor: function(geo) { if ($.inArray(geo.id, countries) === -1) { return '#222' } return '#b00' }
Validator.addRule('ext', function(item, baseValue, formatMsg){ var ext = item.ext, baseValue = baseValue.split(','); if($.inArray(ext, baseValue) === -1){ return formatMsg; } });
this.get('map').getLayers().forEach(layer => { if (layer.get('base_layer') || !layer.get('display_in_layer_switcher')) { return; } layer.setVisible($.inArray(layer.get('name'), overlay_layers) !== -1); });
'click a[href], button[href]': function(e) { var $target = $(e.currentTarget), scheme = 'javascript:', fn, href = $target.attr('href'), js = href.indexOf(scheme), context = options.context || this, id; if (~$.inArray(href, ['', '#'])) return _leave(); id = this._getSelectedId($target); //if (id === undefined) return; if (~js) { fn = href.slice(scheme.length); ~fn.lastIndexOf(';') && (fn = fn.slice(0, -1)); fn && context[fn] && context[fn](e, id); e.preventDefault(); } else { return _leave(); } function _leave() { var evt = $.Event(e); evt.target = e.target; evt.type = 'leave'; // The third party can intercept default-behavior in the leave event return self._trigger(evt, id); } }
$(document).keydown(function (e) { var preventKeyPress; if (e.keyCode == 8) { var d = e.srcElement || e.target; switch (d.tagName.toUpperCase()) { case 'TEXTAREA': preventKeyPress = d.readOnly || d.disabled; break; case 'INPUT': preventKeyPress = d.readOnly || d.disabled || (d.attributes["type"] && $.inArray(d.attributes["type"].value.toLowerCase(), ["radio", "checkbox", "submit", "button"]) >= 0); break; case 'DIV': preventKeyPress = d.readOnly || d.disabled || !(d.attributes["contentEditable"] && d.attributes["contentEditable"].value == "true"); break; default: preventKeyPress = true; break; } } else preventKeyPress = false; if (preventKeyPress){ e.preventDefault(); App.Events.emit('backbutton'); } });
$form.find(":input").not(":button").each(function() { var $input = $(this), inputType = $input.attr('type'); if ((inputType == "radio" || inputType == 'checkbox') && !$input.attr('checked')) return; var val = $input.val(); if ($input.hasClass('datetime_field_enabled')) { val = $input.data('iso8601'); } try { if($input.data('rich_text')) { val = send($input, "get_code", false); } } catch(e) {} var attr = $input.prop('name') || ''; var multiValue = attr.match(/\[\]$/) if (inputType == 'hidden' && !multiValue) { if ($form.find("[name='" + attr + "']").filter("textarea,:radio:checked,:checkbox:checked,:text,:password,select,:hidden")[0] != $input[0]) { return; } } if(attr && attr !== "" && (inputType == "checkbox" || typeof(result[attr]) == "undefined" || multiValue)) { if(!options.values || $.inArray(attr, options.values) != -1) { if(multiValue) { result[attr] = result[attr] || []; result[attr].push(val); } else { result[attr] = val; } } } var lastAttr = attr; });
export function updateHashPart(part, newVal, removeArray) { const r = /([^&;=]+)=?([^&;]*)/g; const params = []; const h = getHash(); let ok = false; let e = r.exec(h); while (e !== null) { const p = decodeURIParameter(e[1]); if (p === part) { // replace with the given value params.push([e[1], encodeURIComponent(newVal)].join('=')); ok = true; } else if ($.inArray(p, removeArray) === -1) { // use the parameter as is params.push([e[1], e[2]].join('=')); } e = r.exec(h); } // if there was no old parameter, push the param at the end if (!ok) { params.push([encodeURIComponent(part), encodeURIComponent(newVal)].join('=')); } return params.join('&'); }
BaseViewModel.prototype.cancel = function(data, event) { var self = this; event && event.preventDefault(); if (this.dirty()) { bootbox.confirm({ title: 'Discard changes?', message: 'Are you sure you want to discard your unsaved changes?', callback: function(confirmed) { if (confirmed) { self.restoreOriginal(); if ($.inArray('view', self.modes) !== -1) { self.mode('view'); } } }, buttons:{ confirm:{ label:'Discard', className:'btn-danger' } } }); } else { if ($.inArray('view', self.modes) !== -1) { self.mode('view'); } } };
render: function () { var members = []; for (var i = 0; i < this.membersColl.models.length; i += 1) { var member = this.membersColl.models[i]; if ($.inArray(member.id, this.modsAndAdmins) < 0) { members.push(member); } } this.$el.html(GroupMemberListTemplate({ group: this.model, members: members, level: this.model.get('_accessLevel'), accessType: AccessType })); new PaginateWidget({ el: this.$('.g-member-pagination'), collection: this.membersColl, parentView: this }).render(); this.userSearch = new SearchFieldWidget({ el: this.$('.g-group-invite-container'), placeholder: 'Invite a user to join...', types: ['user'], parentView: this }).off().on('g:resultClicked', this._inviteUser, this).render(); return this; },
EventLogging.logEvent = function(e) { ignoringEvent = (e.target.className.indexOf('ignoreEvents') != -1); targetTagName = e.target.tagName; targetId = (e.target.id) ? "#" + e.target.id : ""; rawTargetId = (e.target.id) ? e.target.id : ""; targetType = (e.target.type) ? e.target.type : ""; targetLocator = targetTagName + targetId; eventType = e.type; tagNameIndex = targetTagName; tagNameAndTypeIndex = tagNameIndex + "-" + targetType; tagNameAndIDIndex = tagNameIndex + "#" + rawTargetId; eventIndex = "*"; if (Events.EVENT_TYPES[tagNameAndIDIndex]) { eventIndex = tagNameAndIDIndex; } else if (Events.EVENT_TYPES[tagNameAndTypeIndex]) { eventIndex = tagNameAndTypeIndex; } else if (Events.EVENT_TYPES[tagNameIndex]) { eventIndex = tagNameIndex; } supportedEvents = Events.EVENT_TYPES[eventIndex]; eventSupported = jQuery.inArray(eventType, supportedEvents) != -1 if (!ignoringEvent && eventSupported) { if (typeof console != "undefined" && typeof console.log != "undefined") { console.log(targetLocator + "(" + eventType + ")"); } eventsLog.push(EventLogging.evt(targetLocator, eventType)); } };