Don't like ads? PRO users don't see any ads ;-)
Guest

JS Example

By: a guest on Sep 7th, 2012  |  syntax: JavaScript  |  size: 2.67 KB  |  hits: 16  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1.  
  2. // Self executing block
  3.  
  4. /**
  5.  * @const
  6.  * @type {!string}
  7.  */
  8. CONFIG.CardId = (function() {
  9.     var IVG = new iVG();
  10.     var cardID = "";
  11.    
  12.     cardID += IVG['UserProfile']['CardID'];
  13.     cardID += IVG['UserProfile']['CardIDCheckDigit'];
  14.    
  15.     while(cardID.length < 12)   {
  16.         cardID = "0" + cardID;
  17.     };
  18.    
  19.     return cardID;
  20. })();
  21.  
  22.  
  23. // List classes/Encapsulation
  24.  
  25. function BaseNode(nodeId, nodeType, domId){
  26.   this.nodeId = nodeId;  
  27.   this.nodeType = nodeType;
  28.   (typeof(domId) === "undefined") ? this.domId=nodeId : this.domId=domId;
  29. };
  30.  
  31.  
  32. BaseNode.prototype.onFocus = function(){
  33.     if(!!$(this.domId) ){
  34.         $(this.domId).addClass("selected");
  35.     }
  36. };
  37.    
  38.    
  39. BaseNode.prototype.lostFocus = function(){
  40.     if(!!$(this.domId) ){
  41.         $(this.domId).removeClass("selected");
  42.     }
  43. };
  44.  
  45. function NavNode(nodeId,navName,domId){
  46.   (typeof(domId) === "undefined") ? domId=nodeId : domId=domId;
  47.   BaseNode.call(this,nodeId,CONST.NODETYPE_NAV,domId);
  48.   this.navName = navName;
  49. }
  50.    
  51. NavNode.prototype = new BaseNode();
  52. NavNode.prototype.constructor = NavNode;
  53.    
  54. NavNode.prototype.onFocus = function(){
  55.    
  56.     if(!!$(this.domId) ){
  57.        
  58.         var navDesc = $(this.domId).innerHTML;
  59.         $(this.domId).addClass("selected");
  60.         $(this.domId).removeClass("inSelected");
  61.         $("sectionTitle").innerHTML=navDesc;
  62.        
  63.     }
  64. };
  65.  
  66. NavNode.prototype.lostFocus = function(){
  67.    
  68.     if(!!$(this.domId) ){
  69.         $(this.domId).removeClass("selected");
  70.         if(!!$("nextMenuItemAudio") && typeof($("nextMenuItemAudio").play) == "function" && !!Core.Config.AudioFeedback ){
  71.           $("nextMenuItemAudio").play();
  72.         }
  73.     }
  74. };
  75.    
  76. function PlaylistNode(nodeId, playlistItem, domId){
  77.   (typeof(domId) === "undefined") ? domId=nodeId : domId=domId;
  78.   BaseNode.call(this,nodeId,CONST.NODETYPE_PLAYLIST_ITEM,domId);
  79.   this.img_src     = playlistItem.boxart;
  80.   this.movie_title = playlistItem.title;
  81. }
  82.  
  83. PlaylistNode.prototype = new BaseNode();
  84. PlaylistNode.prototype.constructor = PlaylistNode;  
  85.  
  86. delete PlaylistNode.prototype.nodeId;
  87. delete PlaylistNode.prototype.nodeType;
  88. delete PlaylistNode.prototype.domId;
  89.  
  90. PlaylistNode.prototype.performAction = function(){
  91.     if(!!this.img_src)
  92.     alert(this.img_src);
  93. };
  94.  
  95. PlaylistNode.prototype.lostFocus = function(){
  96.     if(!!$(this.domId) ){
  97.         $(this.domId).removeClass("selected");
  98.         if(!!$("nextPlaylistItemAudio")
  99.            && typeof($("nextPlaylistItemAudio").play) == "function"
  100.            && !!Core.Config.AudioFeedback ){
  101.            
  102.          $("nextPlaylistItemAudio").play();
  103.          
  104.         }
  105.     }
  106. };