su_litebar - var...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
var SU_ClientLitebar=function(){this.api=new SU_Client(); this.apiInitialized=false; this.currentStumble=null; this.currentStaticUrl=null; this.stumblingMode={}; this.currentUser=null; this.sidecarData=null; this.sidepanel=null; this.errorState=null; this.keychain=null; this.credentialsFetchedTime=0; this.data={}; this.timers=null; return true }; SU_ClientLitebar.prototype={init:function(){this.ensureKeychainExists(); this.bindListeners(); if(!this.timers){this.timers=new SU_Timers(); this.timers.init(); if(this.timers.enabled){var b=this.timers.getSavedTimers(); if(b){var a=this; this.setupApi(function() }}) }var a=this; $(window).unload(function(){a.timers.addEvent("interrupted"); a.timers.saveTimersToDOMStorage() }) }}},onStumblePageLoaded:function(){if(this.timers) {this.timers.addEvent("pageLoaded") }},bindListeners:function(){throw"Must implement bindListeners in implementation class" },setData:function(a,b,c){throw"Must implement setData in implementation class" },getData:function(a,b){throw"Must implement getData in implementation class" },getLocation:function(a){throw"Must implement getLocation in implementation class" },setKeychain:function(a){this.keychain=a; this.setData("keychain",a) },ensureKeychainExists:function(){throw"Must implement ensureKeychainExists in implementation class" },handleSidecarData:function(a){if(!a||typeof a.auxData=="undefined"){return false }this.sidecarData=a.auxData; if(typeof a.auxData.updateClient!="undefined") {this.setData("performClientUpdate",1) }},setAuth:function(a){this.keychain.authString=a },setupApi:function(d,c){var a=this; var b=function(){a.api.setDevice(a.device); a.api.setSource(a.source); a.api.setKeychain(a.keychain); if(typeof a.clientVersion!="undefined"){a.api.setClientVersion(a.clientVersion) }a.api.setScriptVersion(a.scriptVersion); a.apiInitialized=true; if(d){d() }}; if(c){this.keychain=new SU_ClientRequestKeychain(); b() }else{this.api.setDevice(this.device); this.api.setSource(this.source); this.ensureKeychainExists(function(){b()
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
}) }},performShareStumble:function(b){var a=this; this.setActiveStumble(null); this.setActiveStaticUrl(null); this.setupApi(function(){a.api.getShare(function(c){a.setActiveStumble(c); a.handleSidecarData(c); a.updateUI(); if(b){b(c) }}) }) },performStumble:function(b){var a=this; this.setActiveStumble(null); this.setActiveStaticUrl(null); this.setupApi(function(){a.api.getStumble(a.stumblingMode,function(c) {a.setActiveStumble(c); a.handleSidecarData(c); a.updateUI(); if(b){b(c) }}) }) },performStumbleDirect:function(c,b){var a=this; this.setActiveStumble(null); this.setActiveStaticUrl(null); this.setupApi(function(){var f=a.stumblingMode; if(c){for(var e in c){f[e]=c[e] }}f.stumbleRequest=new Date().getTime(); if(a.timers){a.timers.addEvent("nextStumbleClick"); a.timers.saveTimersToDOMStorage() }var d=a.api.getStumble(f);
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 8

su_litebar - var...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online