1(function ($, w) { 2 3 var OAuthScenario = function (events) { 4 this.attachEventHandlers(events); 5 }; 6 $.extend(OAuthScenario.prototype, w.TMEvents); 7 8 var scenario = 'default', 9 scenarios = { 10 'default' : new OAuthScenario() 11 }; 12 13 var OAuth = { 14 addScenario : function (name, Scenario) { 15 if (Scenario instanceof OAuthScenario) { 16 scenarios[name] = Scenario; 17 } 18 }, 19 setScenario : function (name) { 20 if (name in scenarios) { 21 scenario = name; 22 } 23 }, 24 getScenario : function (name) { 25 var scenarioName = name || scenario; 26 return scenarioName in scenarios ? scenarios[scenarioName] : new OAuthScenario(); 27 }, 28 onError: function () { 29 var scenario = this.getScenario(); 30 if (scenario.trigger('beforeOAuthError') !== false) { 31 scenario.trigger('OAuthError'); 32 33 scenario.trigger('afterOAuthError'); 34 35 this.trigger('OAuthError'); 36 } 37 scenario.trigger('afterScenario'); 38 }, 39 onSuccess: function (userData) { 40 var scenario = this.getScenario(); 41 if (scenario.trigger('beforeOAuthSuccess', userData) !== false) { 42 scenario.trigger('OAuthSuccess', userData); 43 44 scenario.trigger('afterOAuthSuccess', userData); 45 46 this.trigger('OAuthSuccess', userData); 47 } 48 scenario.trigger('afterScenario'); 49 } 50 }; 51 $.extend(OAuth, w.TMEvents); 52 w.OAuthScenario = OAuthScenario; 53 w.OAuth = OAuth; 54})(jQuery, window);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.