[extensions-web] common.js: reformatted, added header



commit 27b0aa64099e118fa2dd4f4ca388e8f5bbbe68a0
Author: Yuri Konotopov <ykonotopov gnome org>
Date:   Sun Feb 12 12:34:09 2017 +0400

    common.js: reformatted, added header

 sweettooth/static/js/versions/common/common.js |  216 +++++++++++++-----------
 1 files changed, 118 insertions(+), 98 deletions(-)
---
diff --git a/sweettooth/static/js/versions/common/common.js b/sweettooth/static/js/versions/common/common.js
index ba7f1ea..492999e 100644
--- a/sweettooth/static/js/versions/common/common.js
+++ b/sweettooth/static/js/versions/common/common.js
@@ -1,99 +1,119 @@
-// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
-
-define(['jquery', 'dbus!API'], function($, API) {
-    "use strict";
-
-    function _makeRawPromise(result) {
-        return (new $.Deferred()).resolve(result);
-    }
-
-    function _makePromise(result) {
-        // Check if result is promise already
-        if(isPromise(result))
-        {
-            return result;
-        }
-
-        return _makeRawPromise(JSON.parse(result));
-    }
-
-    function isPromise(value) {
-        return value && typeof(value.then) == 'function';
-    }
-
-    return {
-        _makePromise: _makePromise,
-
-        ListExtensions: function() {
-            return _makePromise(API.listExtensions());
-        },
-
-        GetExtensionInfo: function(uuid) {
-            return _makePromise(API.getExtensionInfo(uuid));
-        },
-
-        GetErrors: function(uuid) {
-            return _makePromise(API.getExtensionErrors(uuid));
-        },
-
-        LaunchExtensionPrefs: function(uuid) {
-            return API.launchExtensionPrefs(uuid);
-        },
-
-        LaunchExtensionPrefsDummy: function(uuid) { },
-
-        EnableExtension: function(uuid) {
-            API.setExtensionEnabled(uuid, true);
-        },
-
-        DisableExtension: function(uuid) {
-            API.setExtensionEnabled(uuid, false);
-        },
-
-        InstallExtensionOne: function(uuid) {
-            var result = API.installExtension(uuid);
-
-            if(isPromise(result))
-                return result;
-
-            return _makeRawPromise('succeeded');
-        },
-
-        InstallExtensionTwo: function(uuid) {
-            var result = API.installExtension(uuid, "");
-
-            if(isPromise(result))
-                return result;
-
-            return _makeRawPromise('succeeded');
-        },
-
-        InstallExtensionAsync: function(uuid) {
-            var d = new $.Deferred();
-            var result = API.installExtension(uuid, d.done.bind(d), d.fail.bind(d));
-
-            if(isPromise(result))
-                return result;
-
-            return d;
-        },
-
-        UninstallExtension: function(uuid) {
-            return _makePromise(API.uninstallExtension(uuid));
-        },
-
-        API_onchange: function(proxy) {
-            return function(uuid, newState, error) {
-                if (proxy.extensionStateChangedHandler !== null)
-                    proxy.extensionStateChangedHandler(uuid, newState, error);
-            };
-        },
-
-        API_onshellrestart: function(proxy) {
-            return function() {
-                if (proxy.shellRestartHandler !== null)
-                    proxy.shellRestartHandler();
-            };
-        }
-    };
+/*
+    GNOME Shell extensions repository
+    Copyright (C) 2011-2012  Jasper St. Pierre <jstpierre mecheye net>
+    Copyright (C) 2016-2017  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.
+ */
+
+define(['jquery', 'dbus!API'], function ($, API) {
+       "use strict";
+
+       function _makeRawPromise(result) {
+               return (new $.Deferred()).resolve(result);
+       }
+
+       function _makePromise(result) {
+               // Check if result is promise already
+               if (isPromise(result))
+               {
+                       return result;
+               }
+
+               return _makeRawPromise(JSON.parse(result));
+       }
+
+       function isPromise(value) {
+               return value && typeof(value.then) == 'function';
+       }
+
+       return {
+               _makePromise: _makePromise,
+
+               ListExtensions: function () {
+                       return _makePromise(API.listExtensions());
+               },
+
+               GetExtensionInfo: function (uuid) {
+                       return _makePromise(API.getExtensionInfo(uuid));
+               },
+
+               GetErrors: function (uuid) {
+                       return _makePromise(API.getExtensionErrors(uuid));
+               },
+
+               LaunchExtensionPrefs: function (uuid) {
+                       return API.launchExtensionPrefs(uuid);
+               },
+
+               LaunchExtensionPrefsDummy: function (uuid) {
+               },
+
+               EnableExtension: function (uuid) {
+                       API.setExtensionEnabled(uuid, true);
+               },
+
+               DisableExtension: function (uuid) {
+                       API.setExtensionEnabled(uuid, false);
+               },
+
+               InstallExtensionOne: function (uuid) {
+                       var result = API.installExtension(uuid);
+
+                       if (isPromise(result))
+                       {
+                               return result;
+                       }
+
+                       return _makeRawPromise('succeeded');
+               },
+
+               InstallExtensionTwo: function (uuid) {
+                       var result = API.installExtension(uuid, "");
+
+                       if (isPromise(result))
+                       {
+                               return result;
+                       }
+
+                       return _makeRawPromise('succeeded');
+               },
+
+               InstallExtensionAsync: function (uuid) {
+                       var d = new $.Deferred();
+                       var result = API.installExtension(uuid, d.done.bind(d), d.fail.bind(d));
+
+                       if (isPromise(result))
+                       {
+                               return result;
+                       }
+
+                       return d;
+               },
+
+               UninstallExtension: function (uuid) {
+                       return _makePromise(API.uninstallExtension(uuid));
+               },
+
+               API_onchange: function (proxy) {
+                       return function (uuid, newState, error) {
+                               if (proxy.extensionStateChangedHandler !== null)
+                               {
+                                       proxy.extensionStateChangedHandler(uuid, newState, error);
+                               }
+                       };
+               },
+
+               API_onshellrestart: function (proxy) {
+                       return function () {
+                               if (proxy.shellRestartHandler !== null)
+                               {
+                                       proxy.shellRestartHandler();
+                               }
+                       };
+               }
+       };
 });


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