summaryrefslogtreecommitdiff
path: root/static/js/pages/fullscreen_init.js
blob: a7f8bb7522dedc5838a39f0196e9396419d223f0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// Initializer for `/fullscreen` (login/register overlays + fullscreen feed).
// Goal: reduce template inline JS without changing behavior.

(function($){
  function choice(a) { return a[Math.floor(Math.random() * a.length)]; }

  function defaultPop(url) {
    var newwindow = window.open(
      url,
      'name',
      'height=50,width=400,left=20,top=20,location=0,status=0,scrollbar=0,resizable=0'
    );
    if (window.focus && newwindow) { newwindow.focus(); }
    return newwindow;
  }

  if (typeof window.pop !== 'function') { window.pop = defaultPop; }

  var urls = [
    'https://archive.hump.fm/images/20100601/1275428508049-dumpfm-foot-oie_oie_overlay-1.gif',
    'https://archive.hump.fm/images/20100928/1285728674225-dumpfm-timb-running.unicorn.gif',
    'https://archive.hump.fm/images/20100726/1280119193796-dumpfm-enso-human-condition.gif',
    'https://archive.hump.fm/images/20100521/1274415795577-dumpfm-ucnv-mx.gif',
    'https://archive.hump.fm/images/20100912/1284315873224-dumpfm-Neontoast-1283990707508-dumpfm-crunkus-crabtoon.gif',
    'https://archive.hump.fm/images/20110927/1317105622918-dumpfm-peachfist-test8scam.gif',
    'https://archive.hump.fm/images/20110323/1300915179773-dumpfm-blingscience-fishtank.gif',
    'https://archive.hump.fm/images/20110418/1303108538834-dumpfm-LAVARLAMAR-lettuce_lavarlamar.gif',
    'https://s3.amazonaws.com/i.asdf.us/im/84/gradient_horse_1318306378_1322355741_ryz_1337322355_ryz.gif',
    'https://archive.hump.fm/images/20110724/1311552093462-dumpfm-hologrampa-1291586335941-dumpfm-jeeeelings-cat_face_wink_hologrampa-lettuce.gif',
    'https://s3.amazonaws.com/i.asdf.us/im/be/tt7620731fltt_1315431978.gif'
  ];

  // Legacy behavior: register these on DOM-ready (historically done via `jQuery(initLogin)`).
  if (typeof window.initLogin === 'function') { $(window.initLogin); }
  if (typeof window.startChatUpdater === 'function') { $(window.startChatUpdater); }

  if (window.location && window.location.href.indexOf('nologin') !== -1) {
    $('#loginbox').hide();
  }

  var bigImage = document.getElementById('big-image');
  if (bigImage) { bigImage.innerHTML = "<img src='" + choice(urls) + "'>"; }

  if (typeof window.initFullscreen === 'function') { window.initFullscreen(); }
  if (typeof window.initRegister === 'function') { window.initRegister(); }

  $('#reglink').click(function(e){
    e.preventDefault();
    $('#loginbox').hide();
    $('#registerbox').show().addClass('b');
    return false;
  });

  $('#nickInput').focus();
})(jQuery);