diff --git a/app/views/user/mod.scala.html b/app/views/user/mod.scala.html
index 029d405ee9..048a1b6ee6 100644
--- a/app/views/user/mod.scala.html
+++ b/app/views/user/mod.scala.html
@@ -308,3 +308,5 @@
+
+@jsAt("compiled/user-mod.js")
diff --git a/public/javascripts/user.js b/public/javascripts/user.js
index d89156e0f2..acb6811cb7 100644
--- a/public/javascripts/user.js
+++ b/public/javascripts/user.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('Show all ' + $modLog.length + ' mod log entries...');
- $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($('' + res + '% proxy'));
- }
- });
- });
- });
- });
+ 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"
+ }]
+ });
});
- });
});
diff --git a/ui/site/gulpfile.js b/ui/site/gulpfile.js
index 8134f3a793..e24a8df9c9 100644
--- a/ui/site/gulpfile.js
+++ b/ui/site/gulpfile.js
@@ -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));
diff --git a/ui/site/src/user-mod.js b/ui/site/src/user-mod.js
new file mode 100644
index 0000000000..3e423d3978
--- /dev/null
+++ b/ui/site/src/user-mod.js
@@ -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('Show all ' + $modLog.length + ' mod log entries...');
+ $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($('' + res + '% proxy'));
+ }
+ });
+ });
+});