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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<title>Document</title> | |
</head> | |
<body> | |
<canvas></canvas> | |
<script> | |
require('./renderer.js') | |
</script> |
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
getSelectedRecord: function() { | |
var grid = this.getGrid(), | |
records = grid.getSelectionModel().getSelection(), | |
record; | |
if(records.length) { | |
// get first record from selection | |
record = records[0]; | |
// find selection record in store |
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
/** | |
* Improved {@link Ext.data.Model}. | |
* Can automatically update foreign keys and default filter value for hasMany associations. | |
*/ | |
Ext.define('App.model.AssocModel', { | |
extend: 'Ext.data.Model', | |
/** | |
* @private | |
* Copies data from the passed record into this record. If the passed record is undefined, does nothing. |
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
function getZodiacSign(date) { | |
if(!(date instanceof Date)) date = new Date(); | |
var dateStr = +[ | |
date.getMonth() + 1, | |
('0' + date.getDate()).slice(-2) | |
].join('') | |
,signs = [ | |
[120, 'Capricorn'], | |
[219, 'Aquarius'], |
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
function isElementInViewport (el) { | |
var rect = el.getBoundingClientRect(); | |
return ( | |
rect.top >= 0 && | |
rect.left >= 0 && | |
rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && /*or $(window).height() */ | |
rect.right <= (window.innerWidth || document.documentElement.clientWidth) /*or $(window).width() */ | |
); | |
} |