this.startWithParent = false;
require( [ 'css!bootstrap_css', 'bootstrap', 'app/modules/conferences', 'app/modules/auth', ], function () { app.start(); } );
MyConference.addInitializer(function(options){ mainLayout = new MainLayout; MyConference.mainView.show(mainLayout); var headerView = new HeaderView; headerView.MyConference = MyConference; mainLayout.header.show(headerView); MyConference.Conferences.start(); MyConference.Auth.start(); });
var afterInit = function(){ var sendAccessToken = function(response){ $.post( cfg.baseUrl + 'auth.json/facebook', {FacebookKEY: response.authResponse.accessToken}, function(data, message, xhr){ process_social_resporce(model, data, xhr); }, "text" ); } FB.getLoginStatus(function(response) { if(response.status == "not_authorized" || response.status == "unknown"){ FB.login(function(response, a) { if (response.authResponse) { sendAccessToken(response); } else { console.log(response, a) } }, {scope:'email'}); }else{ sendAccessToken(response); } }); } window.fbAsyncInit = function() { FB.init({ appId : cfg.facebookAppId, // App ID status : true, // check login status cookie : true, // enable cookies to allow the server to access the session xfbml : true // parse XFBML }); afterInit(); }; // Load the SDK asynchronously (function(d){ var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0]; if (d.getElementById(id)) {return afterInit();} js = d.createElement('script'); js.id = id; js.async = true; js.src = "//connect.facebook.net/en_US/all.js"; ref.parentNode.insertBefore(js, ref); }(document));
var childWin = window.open(cfg.baseUrl + 'auth.json/twitter/'+Storage.get('API_KEY'), 'Twitter Auth', "height=640,width=480"); childWin.onunload = function(){ var check = function(){ if(childWin.document){ var body = childWin.document.getElementsByTagName("body")[0]; if(!model.isNew() || body.textContent.length > 0){ process_social_resporce(model, body.textContent); childWin.close(); }else{ setTimeout(check, 100); } }else{ setTimeout(check, 100); } } setTimeout(check, 100); }
var ConferencesController = Marionette.Controller.extend(new function(){ return { main: function(){ MyConference.mainView.currentView.header.currentView.setHeader('Conferences'); var conferencesCollection = new ConferencesCollection; var spinnerView = new SpinnerView(); spinnerView.render(); conferencesCollection.fetch({ error: function(){ console.log('error'); }, success: function(collection){ var mainView = new MainView; mainView.collection = conferencesCollection; MyConference.mainView.currentView.content.show(mainView); spinnerView.remove(); } }) }, conference: function(id){ var conferenceModel = new ConferenceModel; conferenceModel.set('id', id); conferenceModel.fetch({ error: function(){ var conferenceNotFoundView = new ConferenceNotFoundView; MyConference.mainView.currentView.content.show(conferenceNotFoundView); }, success: function(conference){ var conferenceFullView = new ConferenceFullView; conferenceFullView.model = conference; MyConference.mainView.currentView.content.show(conferenceFullView); } }); }, streams: function(conference_id){ ShowStreams( conference_id, function(){ ShowStream(streams.at(0).get('id')); } ); }, stream: function(id){ ShowStream(id); } } }); var MainRouter = Backbone.Marionette.AppRouter.extend({ appRoutes: { "conference/:id": "conference", "conferences": "main", "": "main", "streams/:conference_id": "streams", "stream/:id": "stream" }, controller: new ConferencesController });
regions: { decision: "#decision" },
if(MyConference.Auth.getUser().isNew()){ var view = new GuestDecisionView; }else{ var desisionModel = new DecisionModel(view.model.get('decision')); var view = new LoggedInDecisionView({model: desisionModel}); view.parent = this; } this.decision.show(view);
cordova platform add android
cordova build android
cordova run android
Source: https://habr.com/ru/post/200192/
All Articles