Only use keypads when on mobile devices

This commit is contained in:
Donald Burr 2015-10-20 12:39:46 -07:00
parent f9b3b05854
commit 29a6eed349

View file

@ -73,7 +73,10 @@ function setup_ui_elements()
}
});
// set up keypads
// only set up keypads on mobile browsers
// not sure what the best way of doing this is
var pageWidth = $(window).width();
if (pageWidth > 1024) {
$( "#current_rank" ).keypad(); // {prompt: 'Enter here'}
$( "#current_exp" ).keypad(); // {prompt: 'Enter here'}
$( "#desired_rank" ).keypad(); // {prompt: 'Enter here'}
@ -83,6 +86,7 @@ function setup_ui_elements()
$( "#card_current_exp" ).keypad(); // {prompt: 'Enter here'}
$( "#card_desired_level" ).keypad(); // {prompt: 'Enter here'}
$( "#card_feed_exp" ).keypad(); // {prompt: 'Enter here'}
}
// set up date/time pickers
$( "#gem_desired_date" ).datepicker();
@ -838,9 +842,12 @@ function run_timer()
}
$("#timer_output_area").html(string);
// @sifen_trackbot updates come out at 36 minutes past the hour, fetch them at 37 minutes to allow for some slop
if ((minute(now) == 37 && second(now) == 0) || window.immediately_refresh_tier_cutoffs) {
$("#tier_info_output_area").html("<h2>Updating tier cutoff data, please wait...</h2>");
// dumb ass way to fetch and display @sifen_trackbot tier cutoff tweets hourly
// using this twitter fetcher: http://jasonmayes.com/projects/twitterApi/#sthash.budgYosd.dpbs
var config5 = {
twitterFetcher.fetch({
"id": '654587648904794112',
"domId": '',
"maxTweets": 1,
@ -849,15 +856,12 @@ function run_timer()
"showTime": true,
"dateFunction": '',
"showRetweet": false,
"customCallback": handleTweets,
"showInteraction": false
};
function handleTweets(tweets) {
"customCallback": function(tweets) {
if (tweets.length > 0) {
// we only care about the first one
var tweet = tweets[0];
// parse it
LOG(1, "GOT TWEET: " + tweet);
// now parse it
// !!! QUICK & DIRTY HACK ALERT !!!
// this is kinda crappy, @sifen_trackbot tweets come out as multiple lines separated by newlines
// so for now we just split the incoming tweet into an array of strings (one per line) and pull the values out using explicit line numbers
@ -871,12 +875,9 @@ function run_timer()
var updateTime = splitTweet[13];
$("#tier_info_output_area").html("<h2>Latest Tier Cutoffs as of UTC " + updateTime + ":<br />" + tier1 + "<br />" + tier2 + "</h2>");
}
}
// @sifen_trackbot updates come out at 36 minutes past the hour, fetch them at 37 minutes to allow for some slop
if ((minute(now) == 37 && second(now) == 0) || window.immediately_refresh_tier_cutoffs) {
$("#tier_info_output_area").html("<h2>Updating tier cutoff data, please wait...</h2>");
twitterFetcher.fetch(config5);
},
"showInteraction": false
});
window.immediately_refresh_tier_cutoffs = false;
}
}