Guest User

Mod Script

a guest
Mar 22nd, 2018
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var instantenaousTypeWriter = 1; // If you want default behaviour, change 1 by 0.
  2.  
  3.     (function(a) {
  4.         var b = [], c;
  5.         GameManager.addTickListener(function(a) {
  6.             if (0 != b.length) {
  7.                 if (isNaN(c) || 0 === c)
  8.                     c = 1;
  9.                 a *= c;
  10.                 if (0 !== a)
  11.                     for (var f = 0; f < b.length; f++)
  12.                         b[f].tick(a, !1)
  13.             }
  14.         }, !1);
  15.         a.fn.typewrite = function(d) {
  16.             d || (d = {});
  17.             var f = Localization.isRTLLanguage(), g = {selector: this,delay: 100,speedUpOnClick: !1,callback: null,animateScroll: !0,scrollPadding: 25,scrollPollIntervalInChars: 50};
  18.             d && a.extend(g, d);
  19.             f && (g.delay *= 5, g.scrollPollIntervalInChars /= 5);
  20.             c = 1;
  21.             var k = function(a) {
  22.                 c = (c + 2.5).clamp(1, 10)
  23.             };
  24.             if (d.speedUpOnClick) {
  25.                 var l = g.callback;
  26.                 g.callback = function() {
  27.                     a(window).off("click", k);
  28.                     l()
  29.                 }
  30.             }
  31.             for (var h = a(g.selector), m = h.text().replaceAll("<br />", "\n"), n = a("<span></span>"), p = {}, q = "", s = 0; s < m.length; s++)
  32.                 if (q += m[s], "[" == q) {
  33.                     var t = m.substr(s);
  34.                     t.startsWith("[pause:") ? (q = s + 7, s = m.indexOf("]", q), q = m.substr(q, s - q), p[n.children().length] = {type: "pause",value: parseFloat(q)}, q = "") : t.startsWith("[delay:") && (q = s + 7, s = m.indexOf("]", q), q = m.substr(q, s - q), p[n.children().length] = {type: "delay",value: q}, q = "")
  35.                 } else
  36.                     "\n" == q ? (n.append(a("<br />")), q = "") : f ? " " ==
  37.                     m[s] && (n.append(a("<span></span>").text(q)), q = "") : (n.append(a("<span></span>").text(q)), q = "");
  38.             "" != q && n.append(a("<span></span>").text(q));
  39.             var r = [];
  40.             n.children().each(function() {
  41.                 a(this).css({opacity: 0})
  42.             });
  43.             h.empty();
  44.             h.append(n);
  45.             var u = 0, z = 0, w = 0, y = n.children().length, B = h.parent();
  46.             n.children().each(function(b) {
  47.                 (function(a, b) {
  48.                     r.push(function() {
  49.                         b.css({opacity: 1});
  50.                         if (g.animateScroll && (w++ >= g.scrollPollIntervalInChars - 1 || a == y - 1)) {
  51.                             w = 0;
  52.                             0 == z && (z = h.height());
  53.                             var c = g.scrollPadding + b.position().top - h.position().top -
  54.                             z;
  55.                             0 < c && u < c && (B.stop().animate({scrollTop: c}, 600), u = c)
  56.                         }
  57.                     })
  58.                 })(b, a(this))
  59.             });
  60.             var v = createjs.Tween.get(h);
  61.             d.wait && (v = v.wait(d.wait));
  62.             d.soundLoop && (v = v.call(function() {
  63.                 Sound.playSoundLoop(d.soundLoop, d.volume)
  64.             }));
  65.             f = 1;
  66.             for (s = 0; s < r.length; s++) {
  67.                 if (p.hasOwnProperty(s))
  68.                     if ("pause" == p[s].type) {
  69.                         v = v.call(function() {
  70.                             d.soundLoop && Sound.stopSound(d.soundLoop)
  71.                         }).wait(p[s].value).call(function() {
  72.                             d.soundLoop && Sound.playSoundLoop(d.soundLoop, d.volume)
  73.                         }).call(r[s]);
  74.                         continue
  75.                     } else
  76.                         "delay" == p[s].type && (f = "slow" == p[s].value ? 10 :
  77.                         1);
  78.                 instantenaousTypeWriter == 1 ? v = v.call(r[s]) : v = v.wait(g.delay * f ).call(r[s])
  79.             }
  80.             v.call(function() {
  81.                 d.soundLoop && Sound.stopSound(d.soundLoop);
  82.                 "return-tween" != d.type && -1 != b.indexOf(v) && b.remove(v);
  83.                 g.callback && g.callback()
  84.             });
  85.             if ("return-tween" === d.type)
  86.                 return v;
  87.             setTimeout(function() {
  88.                 b.push(v);
  89.                 if (g.speedUpOnClick)
  90.                     a(window).on("click", k)
  91.             }, g.delay)
  92.         }
  93.     })(jQuery);
Advertisement
Add Comment
Please, Sign In to add comment