extract user mod JS
parent
9eb70cd209
commit
8536a9628e
|
@ -308,3 +308,5 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@jsAt("compiled/user-mod.js")
|
||||
|
|
|
@ -40,38 +40,14 @@ $(function() {
|
|||
|
||||
$('input.user-autocomplete-jump').each(setupAutocomplete);
|
||||
|
||||
$("div.user_show .mod_zone_toggle").each(function() {
|
||||
$('div.user_show .mod_zone_toggle').each(function() {
|
||||
$(this).click(function() {
|
||||
var $zone = $("div.user_show .mod_zone");
|
||||
var $zone = $('div.user_show .mod_zone');
|
||||
if ($zone.is(':visible')) $zone.hide();
|
||||
else $zone.html(lichess.spinnerHtml).show();
|
||||
$zone.load($(this).attr("href"), function() {
|
||||
$zone.find('form.fide_title select').on('change', function() {
|
||||
$(this).parent('form').submit();
|
||||
});
|
||||
lichess.pubsub.emit('content_loaded')();
|
||||
var $modLog = $zone.find('.mod_log ul').children();
|
||||
if ($modLog.length > 20) {
|
||||
var list = $modLog.slice(20);
|
||||
list.addClass('modlog-hidden').hide()
|
||||
.first().before('<a id="modlog-show">Show all ' + $modLog.length + ' mod log entries...</a>');
|
||||
$zone.find('#modlog-show').click(function() {
|
||||
$zone.find('.modlog-hidden').show();
|
||||
$(this).remove();
|
||||
});
|
||||
}
|
||||
$zone.find('li.ip').slice(0, 2).each(function() {
|
||||
var $li = $(this);
|
||||
$(this).one('mouseover', function() {
|
||||
$.ajax({
|
||||
url: '/mod/ip-intel?ip=' + $(this).find('.address').text(),
|
||||
success: function(res) {
|
||||
$li.append($('<span class="intel">' + res + '% proxy</span>'));
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
else {
|
||||
$zone.html(lichess.spinnerHtml).show();
|
||||
$zone.load($(this).attr('href'));
|
||||
}
|
||||
return false;
|
||||
});
|
||||
if (location.search.indexOf('mod') === 1) $(this).click();
|
||||
|
@ -110,20 +86,20 @@ $(function() {
|
|||
|
||||
if ($('#perfStat.correspondence .view_games').length &&
|
||||
lichess.once('user-correspondence-view-games')) lichess.hopscotch(function() {
|
||||
hopscotch.configure({
|
||||
i18n: {
|
||||
nextBtn: 'OK, got it'
|
||||
}
|
||||
}).startTour({
|
||||
id: 'correspondence-games',
|
||||
showPrevButton: true,
|
||||
isTourBubble: false,
|
||||
steps: [{
|
||||
title: "Recently finished games",
|
||||
content: "Would you like to display the list of your correspondence games, sorted by completion date?",
|
||||
target: $('#perfStat.correspondence .view_games')[0],
|
||||
placement: "bottom"
|
||||
}]
|
||||
hopscotch.configure({
|
||||
i18n: {
|
||||
nextBtn: 'OK, got it'
|
||||
}
|
||||
}).startTour({
|
||||
id: 'correspondence-games',
|
||||
showPrevButton: true,
|
||||
isTourBubble: false,
|
||||
steps: [{
|
||||
title: "Recently finished games",
|
||||
content: "Would you like to display the list of your correspondence games, sorted by completion date?",
|
||||
target: $('#perfStat.correspondence .view_games')[0],
|
||||
placement: "bottom"
|
||||
}]
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -107,7 +107,8 @@ function makeBundle(filename) {
|
|||
|
||||
gulp.task('standalones', function() {
|
||||
return gulp.src([
|
||||
'./src/util.js'
|
||||
'./src/util.js',
|
||||
'./src/user-mod.js'
|
||||
])
|
||||
.pipe(streamify(uglify()))
|
||||
.pipe(gulp.dest(destination));
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
var $zone = $("div.user_show .mod_zone");
|
||||
|
||||
$zone.find('form.fide_title select').on('change', function() {
|
||||
$(this).parent('form').submit();
|
||||
});
|
||||
|
||||
lichess.pubsub.emit('content_loaded')();
|
||||
|
||||
var $modLog = $zone.find('.mod_log ul').children();
|
||||
|
||||
if ($modLog.length > 20) {
|
||||
var list = $modLog.slice(20);
|
||||
list.addClass('modlog-hidden').hide()
|
||||
.first().before('<a id="modlog-show">Show all ' + $modLog.length + ' mod log entries...</a>');
|
||||
$zone.find('#modlog-show').click(function() {
|
||||
$zone.find('.modlog-hidden').show();
|
||||
$(this).remove();
|
||||
});
|
||||
}
|
||||
|
||||
$zone.find('li.ip').slice(0, 2).each(function() {
|
||||
var $li = $(this);
|
||||
$(this).one('mouseover', function() {
|
||||
$.ajax({
|
||||
url: '/mod/ip-intel?ip=' + $(this).find('.address').text(),
|
||||
success: function(res) {
|
||||
$li.append($('<span class="intel">' + res + '% proxy</span>'));
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue