_id stringlengths 2 6 | title stringlengths 0 58 | partition stringclasses 3
values | text stringlengths 52 373k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q46200 | train | function(moduleName, context) {
var module = modules[moduleName].creator(context);
if (!context.getElement) {
// Add in a default getElement function that matches the first module element
// Developer should stub this out if there are more than one instance of this module
context.getElement = fu... | javascript | {
"resource": ""
} | |
q46201 | train | function(behaviorName, context) {
var behaviorData = behaviors[behaviorName];
if (behaviorData) {
// getElement on behaviors must be stubbed
if (!context.getElement) {
context.getElement = function() {
throw new Error('You must stub `getElement` for behaviors.');
};
}
retu... | javascript | {
"resource": ""
} | |
q46202 | train | function() {
var todoList = [];
Object.keys(todos).forEach(function(id) {
todoList.push(todos[id]);
});
return todoList;
} | javascript | {
"resource": ""
} | |
q46203 | train | function() {
var me = this;
Object.keys(todos).forEach(function(id) {
if (todos[id].completed) {
me.remove(id);
}
});
} | javascript | {
"resource": ""
} | |
q46204 | train | function(title) {
var todoId = counter++;
todos[todoId] = {
id: todoId,
title: title,
completed: false
};
return todoId;
} | javascript | {
"resource": ""
} | |
q46205 | isServiceBeingInstantiated | train | function isServiceBeingInstantiated(serviceName) {
for (var i = 0, len = serviceStack.length; i < len; i++) {
if (serviceStack[i] === serviceName) {
return true;
}
}
return false;
} | javascript | {
"resource": ""
} |
q46206 | error | train | function error(exception) {
if (typeof customErrorHandler === 'function') {
customErrorHandler(exception);
return;
}
if (globalConfig.debug) {
throw exception;
} else {
application.fire('error', {
exception: exception
});
}
} | javascript | {
"resource": ""
} |
q46207 | createAndBindEventDelegate | train | function createAndBindEventDelegate(eventDelegates, element, handler) {
var delegate = new Box.DOMEventDelegate(element, handler, globalConfig.eventTypes);
eventDelegates.push(delegate);
delegate.attachEvents();
} | javascript | {
"resource": ""
} |
q46208 | callMessageHandler | train | function callMessageHandler(instance, name, data) {
// If onmessage is an object call message handler with the matching key (if any)
if (instance.onmessage !== null && typeof instance.onmessage === 'object' && instance.onmessage.hasOwnProperty(name)) {
instance.onmessage[name].call(instance, data);
// Otherw... | javascript | {
"resource": ""
} |
q46209 | train | function(data) {
if (globalConfig.debug) {
// We grab console via getGlobal() so we can stub it out in tests
var globalConsole = this.getGlobal('console');
if (globalConsole && globalConsole.warn) {
globalConsole.warn(data);
}
} else {
application.fire('warning', data);
}
} | javascript | {
"resource": ""
} | |
q46210 | train | function(data) {
if (globalConfig.debug) {
// We grab console via getGlobal() so we can stub it out in tests
var globalConsole = this.getGlobal('console');
if (globalConsole && globalConsole.info) {
globalConsole.info(data);
}
}
} | javascript | {
"resource": ""
} | |
q46211 | parseRoutes | train | function parseRoutes() {
// Regexs to convert a route (/file/:fileId) into a regex
var optionalParam = /\((.*?)\)/g,
namedParam = /(\(\?)?:\w+/g,
splatParam = /\*\w+/g,
escapeRegExp = /[\-{}\[\]+?.,\\\^$|#\s]/g,
namedParamCallback = function(match, optional) {
return optional ? match : '([^\/... | javascript | {
"resource": ""
} |
q46212 | broadcastStateChanged | train | function broadcastStateChanged(fragment) {
var globMatches = matchGlob(fragment);
if (!!globMatches) {
application.broadcast('statechanged', {
url: fragment,
prevUrl: prevUrl,
params: globMatches.splice(1) // Get everything after the URL
});
}
} | javascript | {
"resource": ""
} |
q46213 | train | function(state, title, fragment) {
prevUrl = history.state.hash;
// First push the state
history.pushState(state, title, fragment);
// Then make the AJAX request
broadcastStateChanged(fragment);
} | javascript | {
"resource": ""
} | |
q46214 | getClosestTodoElement | train | function getClosestTodoElement(element) {
var matchesSelector = element.matches || element.webkitMatchesSelector || element.mozMatchesSelector || element.msMatchesSelector;
while (element) {
if (matchesSelector.bind(element)('li')) {
return element;
} else {
element = element.parentNode;
}
}
... | javascript | {
"resource": ""
} |
q46215 | train | function(event, element, elementType) {
if (elementType === 'delete-btn') {
var todoEl = getClosestTodoElement(element),
todoId = getClosestTodoId(element);
moduleEl.querySelector('#todo-list').removeChild(todoEl);
todosDB.remove(todoId);
context.broadcast('todoremoved', {
id: todoId
... | javascript | {
"resource": ""
} | |
q46216 | train | function(event, element, elementType) {
if (elementType === 'mark-as-complete-checkbox') {
var todoEl = getClosestTodoElement(element),
todoId = getClosestTodoId(element);
if (element.checked) {
todoEl.classList.add('completed');
todosDB.markAsComplete(todoId);
} else {
todoEl.class... | javascript | {
"resource": ""
} | |
q46217 | train | function(event, element, elementType) {
if (elementType === 'todo-label') {
var todoEl = getClosestTodoElement(element);
event.preventDefault();
event.stopPropagation();
this.showEditor(todoEl);
}
} | javascript | {
"resource": ""
} | |
q46218 | train | function(event, element, elementType) {
if (elementType === 'edit-input') {
var todoEl = getClosestTodoElement(element);
if (event.keyCode === ENTER_KEY) {
this.saveLabel(todoEl);
this.hideEditor(todoEl);
} else if (event.keyCode === ESCAPE_KEY) {
this.hideEditor(todoEl);
}
}
... | javascript | {
"resource": ""
} | |
q46219 | train | function(todoEl) {
var todoId = getClosestTodoId(todoEl),
editInputEl = todoEl.querySelector('.edit'),
title = todosDB.get(todoId).title; // Grab current label
// Set the edit input value to current label
editInputEl.value = title;
todoEl.classList.add('editing');
// Place user cursor in the i... | javascript | {
"resource": ""
} | |
q46220 | train | function(todoEl) {
var todoId = getClosestTodoId(todoEl),
editInputEl = todoEl.querySelector('.edit'),
newTitle = (editInputEl.value).trim();
todoEl.querySelector('label').textContent = newTitle;
todosDB.edit(todoId, newTitle);
} | javascript | {
"resource": ""
} | |
q46221 | isListCompleted | train | function isListCompleted() {
var todos = todosDB.getList();
var len = todos.length;
var isComplete = len > 0;
for (var i = 0; i < len; i++) {
if (!todos[i].completed) {
isComplete = false;
break;
}
}
return isComplete;
} | javascript | {
"resource": ""
} |
q46222 | train | function(event, element, elementType) {
if (elementType === 'select-all-checkbox') {
var shouldMarkAsComplete = element.checked;
if (shouldMarkAsComplete) {
todosDB.markAllAsComplete();
} else {
todosDB.markAllAsIncomplete();
}
this.renderList();
context.broadcast('todostatuscha... | javascript | {
"resource": ""
} | |
q46223 | train | function(name, data) {
switch(name) {
case 'todoadded':
case 'todoremoved':
this.renderList();
this.updateSelectAllCheckbox();
break;
case 'todostatuschange':
this.updateSelectAllCheckbox();
break;
case 'statechanged':
setFilterByUrl(data.url);
this.renderList();... | javascript | {
"resource": ""
} | |
q46224 | train | function(id, title, isCompleted) {
var todoTemplateEl = moduleEl.querySelector('.todo-template-container li'),
newTodoEl = todoTemplateEl.cloneNode(true);
// Set the label of the todo
newTodoEl.querySelector('label').textContent = title;
newTodoEl.setAttribute('data-todo-id', id);
if (isCompleted) {... | javascript | {
"resource": ""
} | |
q46225 | train | function() {
// Clear the todo list first
this.clearList();
var todos = todosDB.getList(),
todo;
// Render todos - factor in the current filter as well
for (var i = 0, len = todos.length; i < len; i++) {
todo = todos[i];
if (!filter
|| (filter === 'incomplete' && !todo.completed)
... | javascript | {
"resource": ""
} | |
q46226 | train | function(type, handler) {
var handlers = this._handlers[type],
i,
len;
if (typeof handlers === 'undefined') {
handlers = this._handlers[type] = [];
}
for (i = 0, len = handlers.length; i < len; i++) {
if (handlers[i] === handler) {
// prevent duplicate handlers
return;
}
... | javascript | {
"resource": ""
} | |
q46227 | DOMEventDelegate | train | function DOMEventDelegate(element, handler, eventTypes) {
/**
* The DOM element that this object is handling events for.
* @type {HTMLElement}
*/
this.element = element;
/**
* Object on which event handlers are available.
* @type {Object}
* @private
*/
this._handler = handler;
/**
*... | javascript | {
"resource": ""
} |
q46228 | train | function() {
if (!this._attached) {
forEachEventType(this._eventTypes, this._handler, function(eventType) {
var that = this;
function handleEvent() {
that._handleEvent.apply(that, arguments);
}
Box.DOM.on(this.element, eventType, handleEvent);
this._boundHandler[eventType] = ha... | javascript | {
"resource": ""
} | |
q46229 | train | function() {
forEachEventType(this._eventTypes, this._handler, function(eventType) {
Box.DOM.off(this.element, eventType, this._boundHandler[eventType]);
}, this);
} | javascript | {
"resource": ""
} | |
q46230 | train | function(url) {
var linkEls = moduleEl.querySelectorAll('a');
for (var i = 0, len = linkEls.length; i < len; i++) {
if (url === linkEls[i].pathname) {
linkEls[i].classList.add('selected');
} else {
linkEls[i].classList.remove('selected');
}
}
} | javascript | {
"resource": ""
} | |
q46231 | train | function() {
var todos = todosDB.getList();
var completedCount = 0;
for (var i = 0, len = todos.length; i < len; i++) {
if (todos[i].completed) {
completedCount++;
}
}
var itemsLeft = todos.length - completedCount;
this.updateItemsLeft(itemsLeft);
this.updateCompletedButton(complete... | javascript | {
"resource": ""
} | |
q46232 | train | function(itemsLeft) {
var itemText = itemsLeft === 1 ? 'item' : 'items';
moduleEl.querySelector('.items-left-counter').textContent = itemsLeft;
moduleEl.querySelector('.items-left-text').textContent = itemText + ' left';
} | javascript | {
"resource": ""
} | |
q46233 | resolveConfig | train | function resolveConfig({
filePath,
stylelintPath,
stylelintConfig,
prettierOptions
}) {
const resolve = resolveConfig.resolve;
const stylelint = requireRelative(stylelintPath, filePath, 'stylelint');
const linterAPI = stylelint.createLinter();
if (stylelintConfig) {
return Promi... | javascript | {
"resource": ""
} |
q46234 | train | function() {
var xhr = $.ajaxSettings.xhr();
if (!xhr.upload) return xhr;
xhr.upload.addEventListener('progress', function(e) {
options.progress(e.loaded / e.total);
});
return xhr;
} | javascript | {
"resource": ""
} | |
q46235 | buildRequest | train | async function buildRequest(method, url, params, options) {
let param = {};
let config = {};
if (noneBodyMethod.indexOf(method) >= 0) {
param = { params: { ...params }, ...reqConfig, ...options };
} else {
param = JSON.stringify(params);
config = {
...reqConfig,
headers: {
'Conte... | javascript | {
"resource": ""
} |
q46236 | renderRoutes | train | function renderRoutes() {
return (
<Switch>
{
routes.map(route => (
<Route key={route.path || ''} {...route} />
))
}
</Switch>
);
} | javascript | {
"resource": ""
} |
q46237 | isAlreadyReplicating | train | function isAlreadyReplicating(state, feed_id, ignore_id) {
for(var id in state.peers) {
if(id !== ignore_id) {
var peer = state.peers[id]
if(peer.notes && getReceive(peer.notes[id])) return id
if(peer.replicating && peer.replicating[feed_id] && peer.replicating[feed_id].rx) return id
}
}
... | javascript | {
"resource": ""
} |
q46238 | isAvailable | train | function isAvailable(state, feed_id, ignore_id) {
for(var peer_id in state.peers) {
if(peer_id != ignore_id) {
var peer = state.peers[peer_id]
//BLOCK: check wether id has blocked this peer
if((peer.clock && peer.clock[feed_id] || 0) > (state.clock[feed_id] || 0) && isShared(state, feed_id, peer... | javascript | {
"resource": ""
} |
q46239 | eachFrom | train | function eachFrom(keys, key, iter) {
var i = keys.indexOf(key)
if(!~i) return
//start at 1 because we want to visit all keys but key.
for(var j = 1; j < keys.length; j++)
if(iter(keys[(j+i)%keys.length], j))
return
} | javascript | {
"resource": ""
} |
q46240 | WebRtcPeerRecvonly | train | function WebRtcPeerRecvonly(options, callback) {
if (!(this instanceof WebRtcPeerRecvonly)) {
return new WebRtcPeerRecvonly(options, callback)
}
WebRtcPeerRecvonly.super_.call(this, 'recvonly', options, callback)
} | javascript | {
"resource": ""
} |
q46241 | sendMessage | train | function sendMessage(e) {
var txt = $('#msgtxt').val().trim();
if(!txt) return;
$('#messages').append(createMsgBox(txt));
socket.emit('sendmsg', txt, function(evtJson) {
var evt = JSON.parse(evtJson),
reply = evt['Reply-Text'].split(' '), //0 = +OK, 1 = uuid
... | javascript | {
"resource": ""
} |
q46242 | openChat | train | function openChat() {
var num = validateNum();
if(num) {
socket.emit('setup', num, function() {
number = num;
$('#num').hide();
$('#chat').show();
});
}
} | javascript | {
"resource": ""
} |
q46243 | validateNum | train | function validateNum() {
var pass = true,
num = '';
['#areacode', '#phnum1', '#phnum2'].forEach(function(id) {
var $e = $(id),
val = $e.val();
if(!val || val.length !== parseInt($e.attr('maxlength'), 10)) {
pass = false;
$e.ad... | javascript | {
"resource": ""
} |
q46244 | train | function() {
if (this.$visible) {
return;
}
this.$visible = true;
var pc = editablePromiseCollection();
//own show
pc.when(this.$onshow());
//clear errors
this.$setError(null, '');
//children show
angular.forEach(this.$editables, function(editable... | javascript | {
"resource": ""
} | |
q46245 | train | function(name, msg) {
angular.forEach(this.$editables, function(editable) {
if(!name || editable.name === name) {
editable.setError(msg);
}
});
} | javascript | {
"resource": ""
} | |
q46246 | getNearest | train | function getNearest($select, value) {
var delta = {};
angular.forEach($select.children('option'), function(opt, i){
var optValue = angular.element(opt).attr('value');
if(optValue === '') return;
var distance = Math.abs(optValue - value);
if(typeof delta.distance... | javascript | {
"resource": ""
} |
q46247 | writeProviderEntry | train | function writeProviderEntry (store, cid, peer, time, callback) {
const dsKey = [
makeProviderKey(cid),
'/',
utils.encodeBase32(peer.id)
].join('')
store.put(new Key(dsKey), Buffer.from(varint.encode(time)), callback)
} | javascript | {
"resource": ""
} |
q46248 | loadProviders | train | function loadProviders (store, cid, callback) {
pull(
store.query({ prefix: makeProviderKey(cid) }),
pull.map((entry) => {
const parts = entry.key.toString().split('/')
const lastPart = parts[parts.length - 1]
const rawPeerId = utils.decodeBase32(lastPart)
return [new PeerId(rawPeerId)... | javascript | {
"resource": ""
} |
q46249 | handleMessage | train | function handleMessage (peer, msg, callback) {
// update the peer
dht._add(peer, (err) => {
if (err) {
log.error('Failed to update the kbucket store')
log.error(err)
}
// get handler & exectue it
const handler = getMessageHandler(msg.type)
if (!handler) {
... | javascript | {
"resource": ""
} |
q46250 | train | function () {
this.writeDebug('reset');
locationset = [];
featuredset = [];
normalset = [];
markers = [];
firstRun = false;
$(document).off('click.'+pluginName, '.' + this.settings.locationList + ' li');
if ( $('.' + this.settings.locationList + ' .bh-sl-close-directions-container').length ) {
... | javascript | {
"resource": ""
} | |
q46251 | train | function () {
this.writeDebug('formFiltersReset');
if (this.settings.taxonomyFilters === null) {
return;
}
var $inputs = $('.' + this.settings.taxonomyFiltersContainer + ' input'),
$selects = $('.' + this.settings.taxonomyFiltersContainer + ' select');
if ( typeof($inputs) !== 'object') {
r... | javascript | {
"resource": ""
} | |
q46252 | train | function() {
this.writeDebug('mapReload');
this.reset();
reload = true;
if ( this.settings.taxonomyFilters !== null ) {
this.formFiltersReset();
this.taxonomyFiltersInit();
}
if ((olat) && (olng)) {
this.settings.mapSettings.zoom = originalZoom;
this.processForm();
}
else {
... | javascript | {
"resource": ""
} | |
q46253 | train | function (notifyText) {
this.writeDebug('notify',notifyText);
if (this.settings.callbackNotify) {
this.settings.callbackNotify.call(this, notifyText);
}
else {
alert(notifyText);
}
} | javascript | {
"resource": ""
} | |
q46254 | train | function(param) {
this.writeDebug('getQueryString',param);
if(param) {
param = param.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
var regex = new RegExp('[\\?&]' + param + '=([^&#]*)'),
results = regex.exec(location.search);
return (results === null) ? '' : decodeURIComponent(results[1].replace... | javascript | {
"resource": ""
} | |
q46255 | train | function () {
this.writeDebug('_formEventHandler');
var _this = this;
// ASP.net or regular submission?
if (this.settings.noForm === true) {
$(document).on('click.'+pluginName, '.' + this.settings.formContainer + ' button', function (e) {
_this.processForm(e);
});
$(document).on('keydown.'+... | javascript | {
"resource": ""
} | |
q46256 | train | function (lat, lng, address, geocodeData, map) {
this.writeDebug('_getData',arguments);
var _this = this,
northEast = '',
southWest = '',
formattedAddress = '';
// Define extra geocode result info
if (typeof geocodeData !== 'undefined' && typeof geocodeData.geometry.bounds !== 'undefined') {
... | javascript | {
"resource": ""
} | |
q46257 | train | function () {
this.writeDebug('_start');
var _this = this,
doAutoGeo = this.settings.autoGeocode,
latlng;
// Full map blank start
if (_this.settings.fullMapStartBlank !== false) {
var $mapDiv = $('#' + _this.settings.mapID);
$mapDiv.addClass('bh-sl-map-open');
var myOptions = _this.se... | javascript | {
"resource": ""
} | |
q46258 | train | function() {
this.writeDebug('htmlGeocode',arguments);
var _this = this;
if (_this.settings.sessionStorage === true && window.sessionStorage && window.sessionStorage.getItem('myGeo')){
_this.writeDebug('Using Session Saved Values for GEO');
_this.autoGeocodeQuery(JSON.parse(window.sessionStorage.getIt... | javascript | {
"resource": ""
} | |
q46259 | train | function (thisObj) {
thisObj.writeDebug('reverseGoogleGeocode',arguments);
var geocoder = new google.maps.Geocoder();
this.geocode = function (request, callbackFunction) {
geocoder.geocode(request, function (results, status) {
if (status === google.maps.GeocoderStatus.OK) {
if (results[0]) {
... | javascript | {
"resource": ""
} | |
q46260 | train | function (num, dec) {
this.writeDebug('roundNumber',arguments);
return Math.round(num * Math.pow(10, dec)) / Math.pow(10, dec);
} | javascript | {
"resource": ""
} | |
q46261 | train | function (obj) {
this.writeDebug('hasEmptyObjectVals',arguments);
var objTest = true;
for(var key in obj) {
if (obj.hasOwnProperty(key)) {
if (obj[key] !== '' && obj[key].length !== 0) {
objTest = false;
}
}
}
return objTest;
} | javascript | {
"resource": ""
} | |
q46262 | train | function () {
this.writeDebug('modalClose');
// Callback
if (this.settings.callbackModalClose) {
this.settings.callbackModalClose.call(this);
}
// Reset the filters
filters = {};
// Undo category selections
$('.' + this.settings.overlay + ' select').prop('selectedIndex', 0);
$('.' + thi... | javascript | {
"resource": ""
} | |
q46263 | train | function (loopcount) {
this.writeDebug('_createLocationVariables',arguments);
var value;
locationData = {};
for (var key in locationset[loopcount]) {
if (locationset[loopcount].hasOwnProperty(key)) {
value = locationset[loopcount][key];
if (key === 'distance' || key === 'altdistance') {
... | javascript | {
"resource": ""
} | |
q46264 | train | function(locationsarray) {
this.writeDebug('sortAlpha',arguments);
var property = (this.settings.sortBy.hasOwnProperty('prop') && typeof this.settings.sortBy.prop !== 'undefined') ? this.settings.sortBy.prop : 'name';
if (this.settings.sortBy.hasOwnProperty('order') && this.settings.sortBy.order.toString() =... | javascript | {
"resource": ""
} | |
q46265 | train | function(locationsarray) {
this.writeDebug('sortDate',arguments);
var property = (this.settings.sortBy.hasOwnProperty('prop') && typeof this.settings.sortBy.prop !== 'undefined') ? this.settings.sortBy.prop : 'date';
if (this.settings.sortBy.hasOwnProperty('order') && this.settings.sortBy.order.toString() ==... | javascript | {
"resource": ""
} | |
q46266 | train | function (locationsarray) {
this.writeDebug('sortNumerically',arguments);
var property = (
this.settings.sortBy !== null &&
this.settings.sortBy.hasOwnProperty('prop') &&
typeof this.settings.sortBy.prop !== 'undefined'
) ? this.settings.sortBy.prop : 'distance';
if (this.settings.sortBy !== n... | javascript | {
"resource": ""
} | |
q46267 | train | function (data, filters) {
this.writeDebug('filterData',arguments);
var filterTest = true;
for (var k in filters) {
if (filters.hasOwnProperty(k)) {
// Exclusive filtering
if (this.settings.exclusiveFiltering === true || (this.settings.exclusiveTax !== null && Array.isArray(this.settings.exclus... | javascript | {
"resource": ""
} | |
q46268 | train | function (currentPage) {
this.writeDebug('paginationSetup',arguments);
var pagesOutput = '';
var totalPages;
var $paginationList = $('.bh-sl-pagination-container .bh-sl-pagination');
// Total pages
if ( this.settings.storeLimit === -1 || locationset.length < this.settings.storeLimit ) {
totalPage... | javascript | {
"resource": ""
} | |
q46269 | train | function (markerUrl, markerWidth, markerHeight) {
this.writeDebug('markerImage',arguments);
var markerImg;
// User defined marker dimensions
if (typeof markerWidth !== 'undefined' && typeof markerHeight !== 'undefined') {
markerImg = {
url: markerUrl,
size: new google.maps.Size(markerWidth, m... | javascript | {
"resource": ""
} | |
q46270 | train | function (point, name, address, letter, map, category) {
this.writeDebug('createMarker',arguments);
var marker, markerImg, letterMarkerImg;
var categories = [];
// Custom multi-marker image override (different markers for different categories
if (this.settings.catMarkers !== null) {
if (typeof categ... | javascript | {
"resource": ""
} | |
q46271 | train | function (currentMarker, storeStart, page) {
this.writeDebug('_defineLocationData',arguments);
var indicator = '';
this._createLocationVariables(currentMarker.get('id'));
var altDistLength,
distLength;
if (locationData.distance <= 1) {
if (this.settings.lengthUnit === 'km') {
distLength = ... | javascript | {
"resource": ""
} | |
q46272 | train | function (marker, storeStart, page) {
this.writeDebug('listSetup',arguments);
// Define the location data
var locations = this._defineLocationData(marker, storeStart, page);
// Set up the list template with the location data
var listHtml = listTemplate(locations);
$('.' + this.settings.locationList +... | javascript | {
"resource": ""
} | |
q46273 | train | function (marker) {
var markerImg;
// Reset the previously selected marker
if ( typeof prevSelectedMarkerAfter !== 'undefined' ) {
prevSelectedMarkerAfter.setIcon( prevSelectedMarkerBefore );
}
// Change the selected marker icon
if (this.settings.selectedMarkerImgDim === null) {
markerImg = ... | javascript | {
"resource": ""
} | |
q46274 | train | function (marker, location, infowindow, storeStart, page) {
this.writeDebug('createInfowindow',arguments);
var _this = this;
// Define the location data
var locations = this._defineLocationData(marker, storeStart, page);
// Set up the infowindow template with the location data
var formattedAddress = ... | javascript | {
"resource": ""
} | |
q46275 | train | function (position) {
this.writeDebug('autoGeocodeQuery',arguments);
var _this = this,
distance = null,
$distanceInput = $('#' + this.settings.maxDistanceID),
originAddress;
// Query string parameters
if (this.settings.querystringParams === true) {
// Check for distance query string paramet... | javascript | {
"resource": ""
} | |
q46276 | train | function() {
this.writeDebug('defaultLocation');
var _this = this,
distance = null,
$distanceInput = $('#' + this.settings.maxDistanceID),
originAddress;
// Query string parameters
if (this.settings.querystringParams === true) {
// Check for distance query string parameters
if (this.get... | javascript | {
"resource": ""
} | |
q46277 | train | function (newPage) {
this.writeDebug('paginationChange',arguments);
// Page change callback
if (this.settings.callbackPageChange) {
this.settings.callbackPageChange.call(this, newPage);
}
mappingObj.page = newPage;
this.mapping(mappingObj);
} | javascript | {
"resource": ""
} | |
q46278 | train | function(markerID) {
this.writeDebug('getAddressByMarker',arguments);
var formattedAddress = "";
// Set up formatted address
if(locationset[markerID].address){ formattedAddress += locationset[markerID].address + ' '; }
if(locationset[markerID].address2){ formattedAddress += locationset[markerID].address2... | javascript | {
"resource": ""
} | |
q46279 | train | function() {
this.writeDebug('clearMarkers');
var locationsLimit = null;
if (locationset.length < this.settings.storeLimit) {
locationsLimit = locationset.length;
}
else {
locationsLimit = this.settings.storeLimit;
}
for (var i = 0; i < locationsLimit; i++) {
markers[i].setMap(null);
... | javascript | {
"resource": ""
} | |
q46280 | train | function(origin, locID, map) {
this.writeDebug('directionsRequest',arguments);
// Directions request callback
if (this.settings.callbackDirectionsRequest) {
this.settings.callbackDirectionsRequest.call(this, origin, locID, map, locationset[locID]);
}
var destination = this.getAddressByMarker(locID)... | javascript | {
"resource": ""
} | |
q46281 | train | function() {
this.writeDebug('closeDirections');
// Close directions callback
if (this.settings.callbackCloseDirections) {
this.settings.callbackCloseDirections.call(this);
}
// Remove the close icon, remove the directions, add the list back
this.reset();
if ((olat) && (olng)) {
if (this... | javascript | {
"resource": ""
} | |
q46282 | train | function($lengthSwap) {
this.writeDebug('lengthUnitSwap',arguments);
if ($lengthSwap.val() === 'alt-distance') {
$('.' + this.settings.locationList + ' .loc-alt-dist').show();
$('.' + this.settings.locationList + ' .loc-default-dist').hide();
} else if ($lengthSwap.val() === 'default-distance') {
... | javascript | {
"resource": ""
} | |
q46283 | train | function (data, lat, lng, origin, maxDistance) {
this.writeDebug('locationsSetup',arguments);
if (typeof origin !== 'undefined') {
if (!data.distance) {
data.distance = this.geoCodeCalcCalcDistance(lat, lng, data.lat, data.lng, GeoCodeCalc.EarthRadius);
// Alternative distance length unit
if (... | javascript | {
"resource": ""
} | |
q46284 | train | function() {
this.writeDebug('sorting',arguments);
var _this = this,
$mapDiv = $('#' + _this.settings.mapID),
$sortSelect = $('#' + _this.settings.sortID);
if ($sortSelect.length === 0) {
return;
}
$sortSelect.on('change.'+pluginName, function (e) {
e.stopPropagation();
// Reset pa... | javascript | {
"resource": ""
} | |
q46285 | train | function() {
this.writeDebug('order',arguments);
var _this = this,
$mapDiv = $('#' + _this.settings.mapID),
$orderSelect = $('#' + _this.settings.orderID);
if ($orderSelect.length === 0) {
return;
}
$orderSelect.on('change.'+pluginName, function (e) {
e.stopPropagation();
// Reset ... | javascript | {
"resource": ""
} | |
q46286 | train | function () {
this.writeDebug('countFilters');
var filterCount = 0;
if (!this.isEmptyObject(filters)) {
for (var key in filters) {
if (filters.hasOwnProperty(key)) {
filterCount += filters[key].length;
}
}
}
return filterCount;
} | javascript | {
"resource": ""
} | |
q46287 | train | function(key) {
this.writeDebug('_existingRadioFilters',arguments);
$('#' + this.settings.taxonomyFilters[key] + ' input[type=radio]').each(function () {
if ($(this).prop('checked')) {
var filterVal = $(this).val();
// Only add the taxonomy id if it doesn't already exist
if (typeof filterVal !... | javascript | {
"resource": ""
} | |
q46288 | train | function () {
this.writeDebug('checkFilters');
for(var key in this.settings.taxonomyFilters) {
if (this.settings.taxonomyFilters.hasOwnProperty(key)) {
// Find the existing checked boxes for each checkbox filter
this._existingCheckedFilters(key);
// Find the existing selected value for each s... | javascript | {
"resource": ""
} | |
q46289 | train | function( taxonomy, value ) {
this.writeDebug('selectQueryStringFilters', arguments);
var $taxGroupContainer = $('#' + this.settings.taxonomyFilters[taxonomy]);
// Handle checkboxes.
if ( $taxGroupContainer.find('input[type="checkbox"]').length ) {
for ( var i = 0; i < value.length; i++ ) {
$tax... | javascript | {
"resource": ""
} | |
q46290 | train | function () {
this.writeDebug('checkQueryStringFilters',arguments);
// Loop through the filters.
for(var key in filters) {
if (filters.hasOwnProperty(key)) {
var filterVal = this.getQueryString(key);
// Check for multiple values separated by comma.
if ( filterVal.indexOf( ',' ) !== -1 ) {
... | javascript | {
"resource": ""
} | |
q46291 | train | function (filterContainer) {
this.writeDebug('getFilterKey',arguments);
for (var key in this.settings.taxonomyFilters) {
if (this.settings.taxonomyFilters.hasOwnProperty(key)) {
for (var i = 0; i < this.settings.taxonomyFilters[key].length; i++) {
if (this.settings.taxonomyFilters[key] === filterCo... | javascript | {
"resource": ""
} | |
q46292 | train | function () {
this.writeDebug('taxonomyFiltersInit');
// Set up the filters
for(var key in this.settings.taxonomyFilters) {
if (this.settings.taxonomyFilters.hasOwnProperty(key)) {
filters[key] = [];
}
}
} | javascript | {
"resource": ""
} | |
q46293 | train | function(markers, map) {
this.writeDebug('checkVisibleMarkers',arguments);
var _this = this;
var locations, listHtml;
// Empty the location list
$('.' + this.settings.locationList + ' ul').empty();
// Set up the new list
$(markers).each(function(x, marker){
if (map.getBounds().contains(marker... | javascript | {
"resource": ""
} | |
q46294 | train | function(map) {
this.writeDebug('dragSearch',arguments);
var newCenter = map.getCenter(),
newCenterCoords,
_this = this;
// Save the new zoom setting
this.settings.mapSettings.zoom = map.getZoom();
olat = mappingObj.lat = newCenter.lat();
olng = mappingObj.lng = newCenter.lng();
// Deter... | javascript | {
"resource": ""
} | |
q46295 | train | function() {
this.writeDebug('emptyResult',arguments);
var center,
locList = $('.' + this.settings.locationList + ' ul'),
myOptions = this.settings.mapSettings,
noResults;
// Create the map
this.map = new google.maps.Map(document.getElementById(this.settings.mapID), myOptions);
// Callback... | javascript | {
"resource": ""
} | |
q46296 | train | function(map, origin, originPoint) {
this.writeDebug('originMarker',arguments);
if (this.settings.originMarker !== true) {
return;
}
var marker,
originImg = '';
if (typeof origin !== 'undefined') {
if (this.settings.originMarkerImg !== null) {
if (this.settings.originMarkerDim === nul... | javascript | {
"resource": ""
} | |
q46297 | train | function() {
this.writeDebug('modalWindow');
if (this.settings.modal !== true) {
return;
}
var _this = this;
// Callback
if (_this.settings.callbackModalOpen) {
_this.settings.callbackModalOpen.call(this);
}
// Pop up the modal window
$('.' + _this.settings.overlay).fadeIn();
/... | javascript | {
"resource": ""
} | |
q46298 | train | function(nearestLoc, infowindow, storeStart, page) {
this.writeDebug('openNearestLocation',arguments);
if (this.settings.openNearest !== true || typeof nearestLoc === 'undefined' || (this.settings.fullMapStart === true && firstRun === true) || (this.settings.defaultLoc === true && firstRun === true)) {
retur... | javascript | {
"resource": ""
} | |
q46299 | train | function(map, infowindow, storeStart, page) {
this.writeDebug('listClick',arguments);
var _this = this;
$(document).on('click.' + pluginName, '.' + _this.settings.locationList + ' li', function () {
var markerId = $(this).data('markerid');
var selectedMarker = markers[markerId];
// List click cal... | javascript | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.