[extensions-web] dbus.js: formatted, added header



commit fd35e52e2832502e142043a19d04740338ce14cb
Author: Yuri Konotopov <ykonotopov gnome org>
Date:   Wed Feb 22 19:06:44 2017 +0400

    dbus.js: formatted, added header

 sweettooth/static/js/dbus.js |  182 +++++++++++++++++++++++-------------------
 1 files changed, 101 insertions(+), 81 deletions(-)
---
diff --git a/sweettooth/static/js/dbus.js b/sweettooth/static/js/dbus.js
index 4711e2f..07174f0 100644
--- a/sweettooth/static/js/dbus.js
+++ b/sweettooth/static/js/dbus.js
@@ -1,4 +1,13 @@
-// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
+/*
+    GNOME Shell extensions repository
+    Copyright (C) 2011-2012  Jasper St. Pierre <jstpierre mecheye net>
+    Copyright (C) 2016  Yuri Konotopov <ykonotopov gnome org>
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU Affero General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+ */
 
 // We need to abuse the plugin system so that we can defer the
 // load completion until our dynamically built requirement is
@@ -7,84 +16,95 @@
 // Thanks to James Burke for helping me with this.
 // http://groups.google.com/group/requirejs/msg/cc6016210c53a51d
 
-define(['jquery'], function($) {
-    "use strict";
-
-    var exports = {};
-
-    var load = exports.load = function(name, req, onLoad, config) {
-        function processLoad()
-        {
-            if (name == "API") {
-                onLoad(window.SweetTooth);
-                return;
-            }
-
-            var apiVersion = undefined;
-
-            try {
-                if (window.SweetTooth) {
-                    apiVersion = window.SweetTooth.apiVersion;
-                }
-            } catch (e) { }
-
-            if (!apiVersion)
-                apiVersion = 'dummy';
-
-            var scriptname = './versions/' + apiVersion + '/main';
-            // requirejs caches response.
-            req([scriptname], function(module) {
-                onLoad(module);
-            });
-        }
-
-        $(document).ready(function() {
-            if (!('SweetTooth' in window)) {
-                // Try NPAPI plugin
-                try {
-                    var MIME_TYPE = 'application/x-gnome-shell-integration';
-                    var $plg = $('<embed>', { type: MIME_TYPE });
-
-                    // Netscape plugins are strange: if you make them invisible with
-                    // CSS or give them 0 width/height, they won't load. Just smack it
-                    // off-screen so it isn't visible, but still works.
-                    $plg.css({ position: 'absolute',
-                               left: '-1000em',
-                               top: '-1000em' });
-
-                    // TODO: this may not work if the DOM is not ready
-                    // when this call is made. Depending on browsers
-                    // you want to support, either listen to
-                    // DOMContentLoaded, event, or use $(function(){}), but in
-                    // those cases, the full body of this load action should
-                    // be in that call.
-                    $(document.body).append($plg);
-
-                    // The API is defined on the plugin itself.
-                    window.SweetTooth = $plg[0];
-                } catch (e) {
-                    // In this case we probably failed the origin checks and
-                    // the NPAPI plugin spat out an error. Explicitly set the
-                    // plugin to NULL
-                    window.SweetTooth = null;
-                }
-
-                processLoad();
-            }
-            else if (typeof(SweetTooth.initialize) === 'function')
-            {
-                // Browser extension
-                // SweetTooth.initialize should be Promise or jQuery.Deferred
-                SweetTooth.initialize().then(function() {
-                    processLoad();
-                })
-            }
-            else
-            {
-                processLoad();
-            }
-        });
-    };
-
-    return exports;
+define(['jquery'], function ($) {
+       "use strict";
+
+       var exports = {};
+
+       var load = exports.load = function (name, req, onLoad, config) {
+               function processLoad() {
+                       if (name == "API")
+                       {
+                               onLoad(window.SweetTooth);
+                               return;
+                       }
+
+                       var apiVersion = undefined;
+
+                       try
+                       {
+                               if (window.SweetTooth)
+                               {
+                                       apiVersion = window.SweetTooth.apiVersion;
+                               }
+                       }
+                       catch (e) { }
+
+                       if (!apiVersion)
+                       {
+                               apiVersion = 'dummy';
+                       }
+
+                       var scriptname = './versions/' + apiVersion + '/main';
+                       // requirejs caches response.
+                       req([scriptname], function (module) {
+                               onLoad(module);
+                       });
+               }
+
+               $(document).ready(function () {
+                       if (!('SweetTooth' in window))
+                       {
+                               // Try NPAPI plugin
+                               try
+                               {
+                                       var MIME_TYPE = 'application/x-gnome-shell-integration';
+                                       var $plg = $('<embed>', {type: MIME_TYPE});
+
+                                       // Netscape plugins are strange: if you make them invisible with
+                                       // CSS or give them 0 width/height, they won't load. Just smack it
+                                       // off-screen so it isn't visible, but still works.
+                                       $plg.css({
+                                               position: 'absolute',
+                                               left: '-1000em',
+                                               top: '-1000em'
+                                       });
+
+                                       // TODO: this may not work if the DOM is not ready
+                                       // when this call is made. Depending on browsers
+                                       // you want to support, either listen to
+                                       // DOMContentLoaded, event, or use $(function(){}), but in
+                                       // those cases, the full body of this load action should
+                                       // be in that call.
+                                       $(document.body).append($plg);
+
+                                       // The API is defined on the plugin itself.
+                                       window.SweetTooth = $plg[0];
+                               }
+                               catch (e)
+                               {
+                                       // In this case we probably failed the origin checks and
+                                       // the NPAPI plugin spat out an error. Explicitly set the
+                                       // plugin to NULL
+                                       window.SweetTooth = null;
+                               }
+
+                               processLoad();
+                       }
+                       else if (typeof(SweetTooth.initialize) === 'function')
+                       {
+                               // Browser extension
+                               // SweetTooth.initialize should be Promise or jQuery.Deferred
+                               SweetTooth.initialize().then(function () {
+                                       processLoad();
+                               });
+                       }
+                       else
+                       {
+                               processLoad();
+                       }
+               });
+       };
+
+       return exports;
 });


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]