Sha256: 35d7133a645edc9b0f5193cea76a70b529e0d0e38526425cde1213f033f80632

Contents?: true

Size: 1.34 KB

Versions: 33

Compression:

Stored size: 1.34 KB

Contents

/* -*- coding: utf-8 -*-
 *
 * Copyright 2013 whiteleaf. All rights reserved.
 */

/*
 * キュー関係のコード
 */
$(document).ready(function() {
  "use strict";

  /*
   * キューに積まれた数を表示
   */
  var notification = Narou.Notification.instance();
  var $queue = $("#queue");
  function highlightQueuBoxIcon(size) {
    if (size > 0) {
      $("#queue-text").addClass("active");
    }
    else {
      $("#queue-text").removeClass("active");
    }
  }
  notification.on("notification.queue", function(data) {
    var before_size = $queue.text();
    $queue.text(data);
    highlightQueuBoxIcon(data);
    // キューのスタック数の横に +1 が浮かび上がって消えるアニメーション
    var diff = data - before_size;
    if (diff <= 0) return;
    var $plus = $("<span>+" + diff + "</span>");
    $plus.addClass("queue-plus").css({
      position: "absolute",
      left: $queue.offset().left + $queue.outerWidth() + 1 - $(document).scrollLeft(),
      top: $queue.offset().top - 3 - $(document).scrollTop(),
    });
    $("#header-navbar").append($plus);
    $plus.delay(100).animate({
      top: - $plus.outerHeight(),
      opacity: 0,
    }, 3000, function() {
      $(this).remove();
    });
  });
  $.get("/api/get_queue_size", function(json) {
    $queue.text(json.size);
    highlightQueuBoxIcon(json.size);
  });
});

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
narou-3.0.5 lib/web/public/resources/narou.queue.js
narou-3.0.4 lib/web/public/resources/narou.queue.js
narou-3.0.3 lib/web/public/resources/narou.queue.js
narou-3.0.2 lib/web/public/resources/narou.queue.js
narou-3.0.1 lib/web/public/resources/narou.queue.js
narou-3.0.0 lib/web/public/resources/narou.queue.js
narou-2.9.5 lib/web/public/resources/narou.queue.js
narou-2.9.4 lib/web/public/resources/narou.queue.js
narou-2.9.3.1 lib/web/public/resources/narou.queue.js
narou-2.9.3 lib/web/public/resources/narou.queue.js
narou-2.9.2 lib/web/public/resources/narou.queue.js
narou-2.9.1 lib/web/public/resources/narou.queue.js
narou-2.9.0 lib/web/public/resources/narou.queue.js