Sha256: ff22cef1d5fd56d87555756b4482b11096067c9bee70a05454738593b50ce2cf

Contents?: true

Size: 1.68 KB

Versions: 15

Compression:

Stored size: 1.68 KB

Contents

// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled file.
//
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
// GO AFTER THE REQUIRES BELOW.
//
//= require jquery
//= require jquery_ujs
//= require select2
//= require hubstats/bootstrap
//= require_tree .


$(document).ready( function() {
  setTimespan()
});

function setTimespan() {
  var index = readCookie("hubstats_index") || 2;
  var timer = document.getElementById("time-select");

  timer.selectedIndex = index;

  timer.onchange = function() {

    createCookie("hubstats_index",this.selectedIndex,1);
    window.location.reload();
  };
}

function createCookie(name,value,days) {
    if (days) {
        var date = new Date();
        date.setTime(date.getTime()+(days*24*60*60*1000));
        var expires = "; expires="+date.toGMTString();
    }
    else var expires = "";
    document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
    var nameEQ = name + "=";
    var ca = document.cookie.split(';');
    for(var i=0;i < ca.length;i++) {
        var c = ca[i];
        while (c.charAt(0)==' ') c = c.substring(1,c.length);
        if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
    }
    return null;
}

function eraseCookie(name) {
    createCookie(name,"",-1);
}

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
hubstats-0.1.0 app/assets/javascripts/hubstats/application.js
hubstats-0.0.23 app/assets/javascripts/hubstats/application.js
hubstats-0.0.22 app/assets/javascripts/hubstats/application.js
hubstats-0.0.21 app/assets/javascripts/hubstats/application.js
hubstats-0.0.20 app/assets/javascripts/hubstats/application.js
hubstats-0.0.19 app/assets/javascripts/hubstats/application.js
hubstats-0.0.18 app/assets/javascripts/hubstats/application.js
hubstats-0.0.17 app/assets/javascripts/hubstats/application.js
hubstats-0.0.16 app/assets/javascripts/hubstats/application.js
hubstats-0.0.15 app/assets/javascripts/hubstats/application.js
hubstats-0.0.14 app/assets/javascripts/hubstats/application.js
hubstats-0.0.13 app/assets/javascripts/hubstats/application.js
hubstats-0.0.12 app/assets/javascripts/hubstats/application.js
hubstats-0.0.10 app/assets/javascripts/hubstats/application.js
hubstats-0.0.9 app/assets/javascripts/hubstats/application.js