Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.timer = setTimeout(() => {
// log the search to analytics if present
if (typeof ga !== "undefined") {
ga("send", "pageview", `${getAppRoot()}?q=${q}`);
}
$.get(
self.urlRoot,
{ q: q },
data => {
self.set("results", data);
$("#search-spinner").hide();
$("#search-clear-btn").show();
},
"json"
);
}, 400);
}
_getPersistentMenu(): void {
const url = this._baseURL + '/localChat/persistentMenu';
$.get(url)
.done((res: Array) => {
this._persistentMenu = res;
this.emitChange();
})
.fail((res: Object) => {
console.log(res);
});
}
goToPage(data) {
let id = this.state.id;
let url = 'http://www.lrts.me/ajax/playlist/2/' + id + '/' + data.from;
$.get(url, (result) => {
let $li = $(result).find('.section-item');
let total;
if(!$($(result).find('div')[0]).find('span')[1]){
total = 10;
}else {
total = $($(result).find('div')[0]).find('span')[1].innerText;
}
let songs = {
data: {
info: []
}
};
$.each($li, (i, item) => {
let music = {
songname: $(item).find('span')[1].innerText,
singername: $(item).find('.column2')[1].innerText,
module.exports.PlayerQueueListRenderer = function (config) {
$.get('hudcomponents/playerQueue.html', function (data) {
Logger.debug('Injecting player queue.');
$(config.appendTo).append(data);
});
this.render = function (playerQueue, localID) {
var playerQueueList = $('.playerQueue');
playerQueueList.empty();
if (playerQueue.length === 0) {
playerQueueList.append(
$('<li>').addClass('grayed').text('No players queued.')
);
}
playerQueue.forEach(appendNameToList(playerQueueList, localID));
};
};</li>
fetchSingleWorkspaceInfo() {
this.serverRequest = $.get('/api/workspace/' + this.workspaceID)
.done(function(result) {
this.errorCode = null;
this.workspace = result;
this.emitChange();
}.bind(this))
.fail(function(error) {
this.errorCode = error.status;
this.emitChange();
}.bind(this));
}
return Promise.resolve().then(function() {
return $.get(url);
});
} else {
updateWorkspaces() {
this.serverRequest = $.get('/api/workspaces', function(result) {
this.workspaces = result;
this.emitChange();
}.bind(this));
}
}
} else {
//发送请求,改变input状态
this.node.addClass(this.get('loadingClass'));
var postData = {}, name = this.node.attr('name');
postData[name] = value;
if (source.name && source.name.indexOf('Store') > -1) {
source.find(postData, {
strict: false
}).then(function (result) {
this.parse(result);
}.bind(this));
}
//尝试远程获取数据
else if (typeof source === 'string') {
$.get(source, postData).then(function (result) {
this.parse(result);
}.bind(this));
} else if (typeof source === 'function') {
source(value, function (result) {
this.parse(result);
}.bind(this));
}
}
},
/**
getRecent: function () {
if (ajax) {
ajax.abort();
}
var end = moment().add(1, 'd').format(AppConstants.DATE_FORMAT);
var begin = moment().subtract(AppConstants.NUMBER_OF_DAYS_SHOWN_IN_NEW_SESSION_CHART, 'd')
.format(AppConstants.DATE_FORMAT);
ajax = jQuery.get(AppConstants.NEW_SESSION_ANALYTICS_API_ENDPOINT, {begin: begin, end: end})
.done(function (data) {
data = fill(data, begin, end);
NewSessionPerDayChartActions.receivedData(data);
});
}
};
_likeHandler: function(argument, value) {
if (argument.likes && argument.likes.length) {
var oldValue = argument.likes[0].value;
jquery.get(
'/api/argument/like/remove/' + argument.id,
(data) => {
argument.likes = [];
argument.score += data.like.value ? -1 : 1;
if (value !== oldValue)
this._addLike(argument, value);
this.trigger(this);
}
).error((xhr, voteStatus, err) => {
this.trigger(this);
});
} else {
this._addLike(argument, value);
}