Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/1405_better_buttons' into develop
- Loading branch information
Showing
10 changed files
with
160 additions
and
145 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
|
||
var debug = true; | ||
var height, width, device; | ||
var scrollPosition; | ||
|
||
|
||
// Debugging Message Control | ||
var debug_stage_msg = function(message) { | ||
if(debug) { | ||
console.log(message); | ||
} | ||
} | ||
|
||
var dsm = debug_stage_msg; // Alias | ||
|
||
|
||
// Event Tracking Wrapper | ||
var shoutOut = function(category, action, opt_label, opt_value) { | ||
|
||
opt_label = opt_label || false; | ||
opt_value = opt_value || false; | ||
|
||
// Google Analytics Shit | ||
_gaq.push(['_trackEvent', category, action, opt_label, opt_value]); | ||
|
||
dsm("An event was logged"); | ||
|
||
} | ||
|
||
/* ---------- HELPER FUNCTIONS --------- */ | ||
|
||
// CSS Wrappers | ||
var setCSS = function(target, property, value) { | ||
$(target).css(property, value); | ||
return target; | ||
} | ||
|
||
var setWidth = function(target, value) { | ||
setCSS(target, 'min-width', Math.round(value)); | ||
} | ||
|
||
var setHeight = function(target, value) { | ||
setCSS(target, 'min-height', Math.round(value)); | ||
} | ||
|
||
// Mathematical Wrappers | ||
var percentage = function(number, percentage, decimalPlaces) { | ||
decimalPlaces = decimalPlaces || false; | ||
|
||
var result = (percentage/100) * number; | ||
|
||
if (decimalPlaces) { | ||
return Math.floor(result * (10 * decimalPlaces)) / (10 * decimalPlaces); | ||
} else { | ||
return result; | ||
} | ||
} | ||
|
||
|
||
/* ---------- RESPONSIVE ---------- */ | ||
// Get Device Type | ||
var getDeviceType = function(width, height) { | ||
if (width > 1600 && height > 1100) { | ||
device = 'desk-wide'; | ||
} | ||
else if (width > 1000) { | ||
device = 'desk'; | ||
} | ||
else if (width < 1000 && width > 481) { | ||
device = 'portable'; | ||
} | ||
else if (width < 481) { | ||
device = 'palm'; | ||
} | ||
else { | ||
device = 'unknown'; | ||
} | ||
|
||
return device; | ||
} | ||
|
||
var deviceDimensions = function() { | ||
// Get to know the viewport | ||
// https://stackoverflow.com/questions/1248081/get-the-browser-viewport-dimensions-with-javascript | ||
|
||
window.width = Math.max(window.innerWidth) | ||
window.height = Math.max(window.innerHeight) | ||
|
||
return width, height; | ||
} | ||
|
||
// Classes that need viewport data to Initialize | ||
var viewportDependentClasses = function(device) { | ||
if(device != 'desk-wide') { | ||
$('.full-height').css('min-height', height); | ||
$('.half-height').css('min-height', height / 2); | ||
} else { | ||
setHeight('.full-height', 900); | ||
setHeight('.half-height', 1500); | ||
} | ||
|
||
return false; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.