From d38649831b26ca585ce46736b22a80d604bda045 Mon Sep 17 00:00:00 2001 From: kaifansariw Date: Sun, 7 Sep 2025 19:15:52 +0530 Subject: [PATCH] Delete sugar web directory --- lib/sugar-web/LICENSE | 202 ----- lib/sugar-web/README.md | 7 - lib/sugar-web/activity/activity.js | 217 ------ lib/sugar-web/activity/shortcut.js | 2 - lib/sugar-web/bus.js | 14 - lib/sugar-web/bus/sugarizer.js | 186 ----- lib/sugar-web/bus/sugaros.js | 14 - lib/sugar-web/datastore.js | 10 - lib/sugar-web/datastore/sugarizer.js | 17 - lib/sugar-web/datastore/sugaros.js | 16 - lib/sugar-web/dictstore.js | 68 -- lib/sugar-web/env.js | 116 --- lib/sugar-web/graphics/README.md | 40 - lib/sugar-web/graphics/activitypalette.html | 9 - lib/sugar-web/graphics/activitypalette.js | 62 -- lib/sugar-web/graphics/css/sugar-200dpi.css | 460 ----------- lib/sugar-web/graphics/css/sugar-200dpi.less | 2 - lib/sugar-web/graphics/css/sugar-96dpi.css | 460 ----------- lib/sugar-web/graphics/css/sugar-96dpi.less | 2 - lib/sugar-web/graphics/css/sugar.less | 589 -------------- lib/sugar-web/graphics/grid.js | 57 -- lib/sugar-web/graphics/icon.js | 9 - .../graphics/icons/actions/activity-stop.svg | 6 - .../actions/checkbox-checked-selected.svg | 27 - .../icons/actions/checkbox-checked.svg | 27 - .../actions/checkbox-unchecked-selected.svg | 22 - .../icons/actions/checkbox-unchecked.svg | 22 - .../icons/actions/dialog-cancel-active.svg | 6 - .../graphics/icons/actions/dialog-cancel.svg | 6 - .../icons/actions/dialog-ok-active.svg | 6 - .../graphics/icons/actions/dialog-ok.svg | 6 - .../icons/actions/entry-cancel-active.svg | 23 - .../icons/actions/entry-cancel-disabled.svg | 21 - .../graphics/icons/actions/entry-cancel.svg | 21 - .../icons/actions/radio-active-selected.svg | 31 - .../graphics/icons/actions/radio-active.svg | 31 - .../graphics/icons/actions/radio-selected.svg | 26 - .../graphics/icons/actions/radio.svg | 26 - .../graphics/icons/actions/zoom-groups.svg | 6 - .../graphics/icons/actions/zoom-home.svg | 6 - .../icons/actions/zoom-neighborhood.svg | 6 - .../graphics/icons/emblems/arrow-down.svg | 20 - .../graphics/icons/emblems/arrow-up.svg | 20 - lib/sugar-web/graphics/menupalette.html | 8 - lib/sugar-web/graphics/menupalette.js | 53 -- lib/sugar-web/graphics/palette.js | 13 - lib/sugar-web/graphics/presencepalette.js | 88 --- lib/sugar-web/graphics/radiobuttonsgroup.js | 62 -- lib/sugar-web/graphics/xocolor.js | 731 ------------------ lib/sugar-web/package.json | 10 - lib/sugar-web/presence.js | 34 - .../test/functional/datastoreSpec.js | 272 ------- .../test/functional/toolkitContractSpec.js | 50 -- lib/sugar-web/test/graphics/iconSpec.js | 78 -- .../test/graphics/menupaletteSpec.js | 97 --- lib/sugar-web/test/graphics/paletteSpec.js | 55 -- .../test/graphics/radiobuttonsgroupSpec.js | 116 --- lib/sugar-web/test/karma-shared.conf.js | 75 -- lib/sugar-web/test/karma-unit.conf.js | 19 - lib/sugar-web/test/karma.conf.js | 16 - lib/sugar-web/test/loader.js | 21 - lib/sugar-web/test/unit/busSpec.js | 175 ----- lib/sugar-web/test/unit/datastoreSpec.js | 51 -- lib/sugar-web/test/unit/dictstoreSpec.js | 73 -- lib/sugar-web/test/unit/envSpec.js | 156 ---- 65 files changed, 5177 deletions(-) delete mode 100755 lib/sugar-web/LICENSE delete mode 100755 lib/sugar-web/README.md delete mode 100755 lib/sugar-web/activity/activity.js delete mode 100755 lib/sugar-web/activity/shortcut.js delete mode 100755 lib/sugar-web/bus.js delete mode 100755 lib/sugar-web/bus/sugarizer.js delete mode 100755 lib/sugar-web/bus/sugaros.js delete mode 100755 lib/sugar-web/datastore.js delete mode 100755 lib/sugar-web/datastore/sugarizer.js delete mode 100755 lib/sugar-web/datastore/sugaros.js delete mode 100755 lib/sugar-web/dictstore.js delete mode 100755 lib/sugar-web/env.js delete mode 100755 lib/sugar-web/graphics/README.md delete mode 100755 lib/sugar-web/graphics/activitypalette.html delete mode 100755 lib/sugar-web/graphics/activitypalette.js delete mode 100755 lib/sugar-web/graphics/css/sugar-200dpi.css delete mode 100755 lib/sugar-web/graphics/css/sugar-200dpi.less delete mode 100755 lib/sugar-web/graphics/css/sugar-96dpi.css delete mode 100755 lib/sugar-web/graphics/css/sugar-96dpi.less delete mode 100755 lib/sugar-web/graphics/css/sugar.less delete mode 100755 lib/sugar-web/graphics/grid.js delete mode 100755 lib/sugar-web/graphics/icon.js delete mode 100755 lib/sugar-web/graphics/icons/actions/activity-stop.svg delete mode 100755 lib/sugar-web/graphics/icons/actions/checkbox-checked-selected.svg delete mode 100755 lib/sugar-web/graphics/icons/actions/checkbox-checked.svg delete mode 100755 lib/sugar-web/graphics/icons/actions/checkbox-unchecked-selected.svg delete mode 100755 lib/sugar-web/graphics/icons/actions/checkbox-unchecked.svg delete mode 100755 lib/sugar-web/graphics/icons/actions/dialog-cancel-active.svg delete mode 100755 lib/sugar-web/graphics/icons/actions/dialog-cancel.svg delete mode 100755 lib/sugar-web/graphics/icons/actions/dialog-ok-active.svg delete mode 100755 lib/sugar-web/graphics/icons/actions/dialog-ok.svg delete mode 100755 lib/sugar-web/graphics/icons/actions/entry-cancel-active.svg delete mode 100755 lib/sugar-web/graphics/icons/actions/entry-cancel-disabled.svg delete mode 100755 lib/sugar-web/graphics/icons/actions/entry-cancel.svg delete mode 100755 lib/sugar-web/graphics/icons/actions/radio-active-selected.svg delete mode 100755 lib/sugar-web/graphics/icons/actions/radio-active.svg delete mode 100755 lib/sugar-web/graphics/icons/actions/radio-selected.svg delete mode 100755 lib/sugar-web/graphics/icons/actions/radio.svg delete mode 100755 lib/sugar-web/graphics/icons/actions/zoom-groups.svg delete mode 100755 lib/sugar-web/graphics/icons/actions/zoom-home.svg delete mode 100755 lib/sugar-web/graphics/icons/actions/zoom-neighborhood.svg delete mode 100755 lib/sugar-web/graphics/icons/emblems/arrow-down.svg delete mode 100755 lib/sugar-web/graphics/icons/emblems/arrow-up.svg delete mode 100755 lib/sugar-web/graphics/menupalette.html delete mode 100755 lib/sugar-web/graphics/menupalette.js delete mode 100755 lib/sugar-web/graphics/palette.js delete mode 100755 lib/sugar-web/graphics/presencepalette.js delete mode 100755 lib/sugar-web/graphics/radiobuttonsgroup.js delete mode 100755 lib/sugar-web/graphics/xocolor.js delete mode 100755 lib/sugar-web/package.json delete mode 100755 lib/sugar-web/presence.js delete mode 100755 lib/sugar-web/test/functional/datastoreSpec.js delete mode 100755 lib/sugar-web/test/functional/toolkitContractSpec.js delete mode 100755 lib/sugar-web/test/graphics/iconSpec.js delete mode 100755 lib/sugar-web/test/graphics/menupaletteSpec.js delete mode 100755 lib/sugar-web/test/graphics/paletteSpec.js delete mode 100755 lib/sugar-web/test/graphics/radiobuttonsgroupSpec.js delete mode 100755 lib/sugar-web/test/karma-shared.conf.js delete mode 100755 lib/sugar-web/test/karma-unit.conf.js delete mode 100755 lib/sugar-web/test/karma.conf.js delete mode 100755 lib/sugar-web/test/loader.js delete mode 100755 lib/sugar-web/test/unit/busSpec.js delete mode 100755 lib/sugar-web/test/unit/datastoreSpec.js delete mode 100755 lib/sugar-web/test/unit/dictstoreSpec.js delete mode 100755 lib/sugar-web/test/unit/envSpec.js diff --git a/lib/sugar-web/LICENSE b/lib/sugar-web/LICENSE deleted file mode 100755 index d645695673..0000000000 --- a/lib/sugar-web/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/lib/sugar-web/README.md b/lib/sugar-web/README.md deleted file mode 100755 index de87a7250a..0000000000 --- a/lib/sugar-web/README.md +++ /dev/null @@ -1,7 +0,0 @@ -Sugar Web -========= - -These are the tools that a developer can use to make a web -activity. - -For details see: http://developer.sugarlabs.org/ diff --git a/lib/sugar-web/activity/activity.js b/lib/sugar-web/activity/activity.js deleted file mode 100755 index a7ec50b89f..0000000000 --- a/lib/sugar-web/activity/activity.js +++ /dev/null @@ -1,217 +0,0 @@ -/** - * Defines the activity module. - * @module activity - */ -define(["webL10n.sugarizer", - "sugar-web/activity/shortcut", - "sugar-web/bus", - "sugar-web/env", - "sugar-web/datastore", - "sugar-web/presence", - "sugar-web/graphics/icon", - "sugar-web/graphics/activitypalette"], function ( - l10n, shortcut, bus, env, datastore, presence, icon, activitypalette) { - - 'use strict'; - - var datastoreObject = null; - - var presenceCallback = null; - var presenceResponse = null; - - /** - * Represents the activity module. - * @namespace activity - */ - var activity = {}; - - /** - * Sets up the activity, initializing various components and event listeners. - */ - activity.setup = function () { - // Listen for bus events - bus.listen(); - - // Start localization - l10n.start(); - - /** - * Sends a pause event when notified by the bus. - */ - function sendPauseEvent() { - var pauseEvent = document.createEvent("CustomEvent"); - pauseEvent.initCustomEvent('activityPause', false, false, { - 'cancelable': true - }); - window.dispatchEvent(pauseEvent); - } - - // Listen for 'activity.pause' notification to send pause event - bus.onNotification("activity.pause", sendPauseEvent); - - // An activity that handles 'activityStop' can also call - // event.preventDefault() to prevent the close, and explicitly - // call activity.close() after storing. - - /** - * Sends a stop event and closes the activity when notified by the bus. - */ - function sendStopEvent() { - var stopEvent = document.createEvent("CustomEvent"); - stopEvent.initCustomEvent('activityStop', false, false, { - 'cancelable': true - }); - var result = window.dispatchEvent(stopEvent); - if (result) { - activity.close(); - } - } - - // Listen for 'activity.stop' notification to send stop event - bus.onNotification("activity.stop", sendStopEvent); - - // Initialize datastore object - datastoreObject = new datastore.DatastoreObject(); - - // Initialize activity palette - var activityButton = document.getElementById("activity-button"); - - var activityPalette = new activitypalette.ActivityPalette( - activityButton, datastoreObject); - - // Colorize the activity icon. - activity.getXOColor(function (error, colors) { - icon.colorize(activityButton, colors); - var invokerElem = - document.querySelector("#activity-palette .palette-invoker"); - icon.colorize(invokerElem, colors); - }); - - // Make the activity stop with the stop button. - var stopButton = document.getElementById("stop-button"); - stopButton.addEventListener('click', function (e) { - sendStopEvent(); - }); - - // Add shortcut for closing activity - shortcut.add("Ctrl", "Q", this.close); - - // Get environment information - env.getEnvironment(function (error, environment) { - // Set metadata for datastore object - if (!environment.objectId) { - datastoreObject.setMetadata({ - "title": environment.activityName + " Activity", - "title_set_by_user": "0", - "activity": environment.bundleId, - "activity_id": environment.activityId - }); - } - - // Join network if in Sugarizer environment - if (env.isSugarizer()) { - presence.joinNetwork(function(error, presence) { - if (environment.sharedId) { - presence.joinSharedActivity(environment.sharedId, function() { - var group_color = presence.getSharedInfo().colorvalue; - icon.colorize(activityButton, group_color); - datastoreObject.setMetadata({"buddy_color":group_color}); - datastoreObject.save(function() {}); - }); - } - if (presenceCallback) { - presenceCallback(error, presence); - } else { - presenceResponse = {error: error, presence: presence}; - } - }); - } - - // Save datastore metadata and set title description for activity palette - datastoreObject.save(function () { - datastoreObject.getMetadata(function (error, metadata) { - activityPalette.setTitleDescription(metadata); - }); - }); - }); - }; - - /** - * Gets the datastore object. - * @returns {object} The datastore object. - */ - activity.getDatastoreObject = function () { - return datastoreObject; - }; - - /** - * Gets the presence object. - * @param {function} connectionCallback - The callback function to handle the presence object. - * @returns {object} The presence object. - */ - activity.getPresenceObject = function(connectionCallback) { - if (presenceResponse == null) { - presenceCallback = connectionCallback; - } else { - connectionCallback(presenceResponse.error, presenceResponse.presence); - presenceResponse = null; - } - return presence; - }; - - /** - * Retrieves the XO color. - * @param {function} callback - The callback function to handle the XO color. - */ - activity.getXOColor = function (callback) { - function onResponseReceived(error, result) { - if (error === null) { - callback(null, { - stroke: result[0][0], - fill: result[0][1] - }); - } else { - callback(null, { - stroke: "#00A0FF", - fill: "#8BFF7A" - }); - } - } - - bus.sendMessage("activity.get_xo_color", [], onResponseReceived); - }; - - /** - * Closes the activity. - * @param {function} callback - The callback function to handle the closing of the activity. - */ - activity.close = function (callback) { - function onResponseReceived(error, result) { - if (error === null) { - callback(null); - } else { - callback(error, null); - } - } - - bus.sendMessage("activity.close", [], onResponseReceived); - }; - - /** - * Shows the object chooser. - * @param {function} callback - The callback function to handle the object chooser. - */ - activity.showObjectChooser = function (callback) { - function onResponseReceived(error, result) { - if (error === null) { - callback(null, result[0]); - } else { - callback(error, null); - } - } - - bus.sendMessage("activity.show_object_chooser", [], onResponseReceived); - }; - - return activity; -}); diff --git a/lib/sugar-web/activity/shortcut.js b/lib/sugar-web/activity/shortcut.js deleted file mode 100755 index 465cf0ac52..0000000000 --- a/lib/sugar-web/activity/shortcut.js +++ /dev/null @@ -1,2 +0,0 @@ -define(function(){'use strict';var shortcut={};shortcut._allShortcuts=[];shortcut.add=function(modifiersString,key,callback){var modifiersList=modifiersString.toLowerCase().split("+");var modifiers={'ctrlKey':modifiersList.indexOf('ctrl')>=0,'altKey':modifiersList.indexOf('alt')>=0,'shiftKey':modifiersList.indexOf('shift')>=0};this._allShortcuts.push({'modifiers':modifiers,'key':key.toLowerCase(),'callback':callback});};document.onkeypress=function(e){e=e||window.event;var modifiers={'ctrlKey':e.ctrlKey,'altKey':e.altKey,'shiftKey':e.shiftKey};var charCode;if(typeof e.which=="number"){charCode=e.which;}else{charCode=e.keyCode;} -var key=String.fromCharCode(charCode).toLowerCase();for(var i=0;i0){socket.send(that.queue.shift());}};socket.onmessage=function(message){that.onMessage(message);};that.socket=socket;});} -WebSocketClient.prototype.send=function(data){if(this.socket&&this.socket.readyState==WebSocket.OPEN){this.socket.send(data);}else{this.queue.push(data);}};WebSocketClient.prototype.close=function(){this.socket.close();};var bus={};function InputStream(){this.streamId=null;this.readCallback=null;} -InputStream.prototype.open=function(callback){var that=this;bus.sendMessage("open_stream",[],function(error,result){that.streamId=result[0];inputStreams[that.streamId]=that;callback(error);});};InputStream.prototype.read=function(count,callback){if(this.readCallback){throw new Error("Read already in progress");} -this.readCallback=callback;var buffer=new ArrayBuffer(8);var headerView=new Uint8Array(buffer,0,1);headerView[0]=this.streamId;var bodyView=new Uint32Array(buffer,4,1);bodyView[0]=count;bus.sendBinary(buffer);};InputStream.prototype.gotData=function(buffer){var callback=this.readCallback;this.readCallback=null;callback(null,buffer);};InputStream.prototype.close=function(callback){var that=this;function onStreamClosed(error,result){if(callback){callback(error);} -delete inputStreams[that.streamId];} -bus.sendMessage("close_stream",[this.streamId],onStreamClosed);};function OutputStream(){this.streamId=null;} -OutputStream.prototype.open=function(callback){var that=this;bus.sendMessage("open_stream",[],function(error,result){that.streamId=result[0];callback(error);});};OutputStream.prototype.write=function(data){var buffer=new ArrayBuffer(data.byteLength+1);var bufferView=new Uint8Array(buffer);bufferView[0]=this.streamId;bufferView.set(new Uint8Array(data),1);bus.sendBinary(buffer);};OutputStream.prototype.close=function(callback){bus.sendMessage("close_stream",[this.streamId],callback);};bus.createInputStream=function(callback){return new InputStream();};bus.createOutputStream=function(callback){return new OutputStream();};bus.sendMessage=function(method,params,callback){var message={"method":method,"id":lastId,"params":params,"jsonrpc":"2.0"};if(callback){callbacks[lastId]=callback;} -client.send(JSON.stringify(message));lastId++;};bus.onNotification=function(method,callback){notificationCallbacks[method]=callback;};bus.sendBinary=function(buffer,callback){client.send(buffer);};bus.listen=function(customClient){if(customClient){client=customClient;}else{client=new WebSocketClient();} -client.onMessage=function(message){if(typeof message.data!="string"){var dataView=new Uint8Array(message.data);var streamId=dataView[0];if(streamId in inputStreams){var inputStream=inputStreams[streamId];inputStream.gotData(message.data.slice(1));} -return;} -var parsed=JSON.parse(message.data);var responseId=parsed.id;if(parsed.method){var notificationCallback=notificationCallbacks[parsed.method];if(notificationCallback!==undefined){notificationCallback(parsed.params);} -return;} -if(responseId in callbacks){var callback=callbacks[responseId];if(parsed.error===null){callback(null,parsed.result);}else{callback(new Error(parsed.error),null);} -delete callbacks[responseId];}};};bus.close=function(){client.close();client=null;};return bus;}); \ No newline at end of file diff --git a/lib/sugar-web/datastore.js b/lib/sugar-web/datastore.js deleted file mode 100755 index 4793cf5325..0000000000 --- a/lib/sugar-web/datastore.js +++ /dev/null @@ -1,10 +0,0 @@ -define(["sugar-web/env", "sugar-web/datastore/sugarizer", "sugar-web/datastore/sugaros"], function(env, sugarizer, sugaros) { - 'use strict'; - var datastore ; - if (env.isSugarizer()) { - datastore = sugarizer; - } else { - datastore = sugaros; - } - return datastore; -}); diff --git a/lib/sugar-web/datastore/sugarizer.js b/lib/sugar-web/datastore/sugarizer.js deleted file mode 100755 index ba8ccb702a..0000000000 --- a/lib/sugar-web/datastore/sugarizer.js +++ /dev/null @@ -1,17 +0,0 @@ -define(["sugar-web/bus","sugar-web/env"],function(bus,env){'use strict';var datastore={};var html5storage={};var datastorePrefix='sugar_datastore_';var initialized=false;datastore.getUrlParameter=function(name){var match=RegExp('[?&]'+name+'=([^&]*)').exec(window.location.search);return match&&decodeURIComponent(match[1].replace(/\+/g,' '));};datastore.createUUID=function(){var s=[];var hexDigits="0123456789abcdef";for(var i=0;i<36;i++){s[i]=hexDigits.substr(Math.floor(Math.random()*0x10),1);} -s[14]="4";s[19]=hexDigits.substr((s[19]&0x3)|0x8,1);s[8]=s[13]=s[18]=s[23]="-";var uuid=s.join("");return uuid;};datastore.callbackChecker=function(callback){if(callback===undefined||callback===null){callback=function(){};} -return callback;};datastore.create=function(metadata,callback,text){var callback_c=datastore.callbackChecker(callback);var objectId=datastore.createUUID();html5storage.setValue(datastorePrefix+objectId,{metadata:metadata,text:(text===undefined)?null:text});callback_c(null,objectId);} -datastore.find=function(id){var results=[];if(!html5storage.test()) -return results;for(var key in html5storage.getAll()){if(key.substr(0,datastorePrefix.length)==datastorePrefix){var entry=html5storage.getValue(key);entry.objectId=key.substr(datastorePrefix.length);if(id===undefined||entry.metadata.activity==id){results.push(entry);}}} -return results;} -datastore.remove=function(objectId){html5storage.removeValue(datastorePrefix+objectId);} -function DatastoreObject(objectId){this.objectId=objectId;this.newMetadata={};this.newDataAsText=null;this.toload=false;if(!initialized){env.getEnvironment(function(){initialized=true;});} -var that=this;if(this.objectId===undefined){var env_objectId=window.top.sugar.environment.objectId;if(env_objectId!=null){this.objectId=env_objectId;this.toload=true;}}} -DatastoreObject.prototype.getMetadata=function(callback){var callback_c=datastore.callbackChecker(callback);var result=html5storage.getValue(datastorePrefix+this.objectId);if(result!=null){this.setMetadata(result.metadata);this.setDataAsText(result.text);this.toload=false;callback_c(null,result.metadata);}};DatastoreObject.prototype.loadAsText=function(callback){var callback_c=datastore.callbackChecker(callback);var result=html5storage.getValue(datastorePrefix+this.objectId);if(result!=null){this.setMetadata(result.metadata);this.setDataAsText(result.text);this.toload=false;callback_c(null,result.metadata,result.text);}};DatastoreObject.prototype.setMetadata=function(metadata){for(var key in metadata){this.newMetadata[key]=metadata[key];}};DatastoreObject.prototype.setDataAsText=function(text){this.newDataAsText=text;};DatastoreObject.prototype.save=function(callback){if(this.objectId===undefined){var that=this;this.newMetadata["timestamp"]=this.newMetadata["creation_time"]=new Date().getTime();this.newMetadata["file_size"]=0;datastore.create(this.newMetadata,function(error,oid){if(error==null){that.objectId=oid;}});}else{if(this.toload){this.getMetadata(null);this.toload=false;}} -var callback_c=datastore.callbackChecker(callback);this.newMetadata["timestamp"]=new Date().getTime();var sugar_settings=html5storage.getValue("sugar_settings");if(sugar_settings){this.newMetadata["buddy_name"]=sugar_settings.name;this.newMetadata["buddy_color"]=sugar_settings.colorvalue;} -html5storage.setValue(datastorePrefix+this.objectId,{metadata:this.newMetadata,text:this.newDataAsText});callback_c(null,this.newMetadata);};datastore.DatastoreObject=DatastoreObject;datastore.localStorage=html5storage;var storageloadedcalls=[];html5storage.load=function(then){if(typeof chrome!='undefined'&&chrome.app&&chrome.app.runtime){var that=this;if(storageloadedcalls.length!=0){storageloadedcalls.push(then);return;} -storageloadedcalls.push(then);chrome.storage.local.get(null,function(values){that.values=values;for(var i=0;i - - -
- -
-
- -
diff --git a/lib/sugar-web/graphics/activitypalette.js b/lib/sugar-web/graphics/activitypalette.js deleted file mode 100755 index 4e4eb0adaa..0000000000 --- a/lib/sugar-web/graphics/activitypalette.js +++ /dev/null @@ -1,62 +0,0 @@ -define(["sugar-web/graphics/palette", - "text!sugar-web/graphics/activitypalette.html"], function (palette, template) { - - // 'use strict'; - - var activitypalette = {}; - - activitypalette.ActivityPalette = function (activityButton, - datastoreObject) { - - palette.Palette.call(this, activityButton); - - var activityTitle; - var descriptionLabel; - var descriptionBox; - - this.getPalette().id = "activity-palette"; - - var containerElem = document.createElement('div'); - containerElem.innerHTML = template; - this.setContent([containerElem]); - - this.titleElem = containerElem.querySelector('#title'); - this.descriptionElem = containerElem.querySelector('#description'); - - this.titleElem.onblur = function () { - datastoreObject.setMetadata({ - "title": this.value, - "title_set_by_user": "1" - }); - datastoreObject.save(); - }; - - this.descriptionElem.onblur = function () { - datastoreObject.setMetadata({ - "description": this.value - }); - datastoreObject.save(); - }; - }; - - // Fill the text inputs with the received metadata. - var setTitleDescription = function (metadata) { - this.titleElem.value = metadata.title; - - if (metadata.description !== undefined) { - this.descriptionElem.value = metadata.description; - } - }; - - activitypalette.ActivityPalette.prototype = - Object.create(palette.Palette.prototype, { - setTitleDescription: { - value: setTitleDescription, - enumerable: true, - configurable: true, - writable: true - } - }); - - return activitypalette; -}); diff --git a/lib/sugar-web/graphics/css/sugar-200dpi.css b/lib/sugar-web/graphics/css/sugar-200dpi.css deleted file mode 100755 index a566aed1a6..0000000000 --- a/lib/sugar-web/graphics/css/sugar-200dpi.css +++ /dev/null @@ -1,460 +0,0 @@ -html { - height: 100%; - -webkit-tap-highlight-color: rgba(0, 0, 0, 0); -} -body { - position: relative; - height: 100%; - margin: 0; - font-family: sans-serif; - font-size: 10pt; - background-color: #c0c0c0; -} -.unselectable { - user-select: none; - -webkit-user-select: none; - -moz-user-select: none; -} -.pull-right { - float: right; -} -a { - color: #0076c3; - text-decoration: none; -} -/* Toolbar */ -.toolbar { - height: 75px; - padding: 0 77px; - color: white; - background-color: #282828; - user-select: none; - -webkit-user-select: none; - -moz-user-select: none; -} -/* Toolbar separator */ -.toolbar hr { - display: inline-block; - height: 45px; - margin: 4.5px; - margin-bottom: -21px; - border: 1px solid #808080; -} -/* Toolbar toolbutton */ -.toolbar .toolbutton { - position: relative; - width: 67px; - height: 67px; - margin: 4px 2px; - color: white; - color: transparent; - background-color: transparent; - background-position: center; - background-repeat: no-repeat; - background-size: contain; - border: 0; - border-radius: 7.5px; -} -.toolbar .toolbutton:hover { - background-color: black; -} -.toolbar .toolbutton:active, -.toolbar .toolbutton.active { - background-color: #808080; -} -.toolbar .toolbutton img { - width: 100%; - height: 100%; -} -.toolbar .toolbutton:before { - position: absolute; - right: -4px; - bottom: -4px; - display: block; - width: 75px; - height: 15px; - background-color: transparent; - content: ""; -} -.toolbar .toolbutton.invoker:before { - background-image: url('../icons/emblems/arrow-down.svg'); -} -.toolbar #stop-button { - background-image: url('../icons/actions/activity-stop.svg'); -} -/* Canvas */ -#canvas { - position: absolute; - top: 75px; - bottom: 0; - width: 100%; - overflow-y: auto; - color: black; - background-color: #c0c0c0; -} -/* Button */ -button { - padding: 2px 4px; - line-height: 30px; - color: white; - background-color: #808080; - border: 2px solid transparent; - border-radius: 30px; - user-select: none; - -webkit-user-select: none; - -moz-user-select: none; -} -button:hover { - background-color: #a2a2a2; - border-color: #a2a2a2; -} -button:active { - color: black; - background-color: white; - border-color: #808080; -} -button:focus { - border-color: white; -} -.toolbar button { - margin-top: 18.5px; -} -/* Button with icon */ -button.icon { - position: relative; - padding-left: 34px; -} -button.icon span.ok { - background-image: url(../icons/actions/dialog-ok.svg); -} -button.icon:active span.ok { - background-image: url(../icons/actions/dialog-ok-active.svg); -} -button.icon span.cancel { - background-image: url(../icons/actions/dialog-cancel.svg); -} -button.icon:active span.cancel { - background-image: url(../icons/actions/dialog-cancel-active.svg); -} -button.icon span { - position: absolute; - display: inline-block; - width: 30px; - height: 30px; - background-color: transparent; - background-position: center; - background-repeat: no-repeat; - background-size: 30px 30px; -} -button.icon span { - top: 2px; - left: 2px; -} -/* One line text input */ -input[type='text'] { - width: 225px; - padding: 4px; - line-height: 30px; - background-color: #e5e5e5; - border: 2px solid #e5e5e5; - border-radius: 30px; - outline: 0; -} -input[type='text']:focus { - background-color: white; -} -input[type='text']:disabled { - background-color: #808080; - border-color: #808080; -} -.toolbar input[type='text'], -.palette .row input[type='text'] { - margin-top: 16.5px; -} -.palette .row input[type='text']:nth-last-child(1) { - margin-top: 14.5px; -} -input[type='text'].expand { - width: calc(100% - 12px); -} -/* One line text input with buttons inside */ -.icon-input { - position: relative; - display: inline-block; -} -.icon-input input[type='text'] { - width: 187px; - padding-right: 42px; -} -.icon-input.expand { - width: 100%; -} -.icon-input.expand input[type='text'] { - width: calc(100% - 50px); -} -.icon-input button { - position: absolute; - width: 42px; - height: 42px; - padding: 0; - background-size: 30px 30px; -} -.icon-input button.right { - right: 0; - margin: 0 0 0 -42px; - border-radius: 0 30px 30px 0; -} -.icon-input button { - background-color: transparent; - background-position: center; - background-repeat: no-repeat; - border: 0; -} -.icon-input button { - top: 2px; -} -.toolbar .icon-input button:hover { - background-color: transparent; -} -.toolbar .icon-input button { - top: 16.5px; -} -button.cancel { - background-image: url(../icons/actions/entry-cancel.svg); -} -button.cancel:active { - background-image: url(../icons/actions/entry-cancel-active.svg); -} -button.cancel:disabled { - background-image: url(../icons/actions/entry-cancel-disabled.svg); -} -/* Slider */ -/* FIXME this is not fully Sugarized yet */ -input[type='range'] { - height: 15px; - cursor: pointer; - background-color: #808080; - border-radius: 30px; - appearance: none; - -webkit-appearance: none !important; -} -input[type='range']::-webkit-slider-thumb { - width: 30px; - height: 30px; - background-color: #c0c0c0; - border: 4px solid #808080; - border-radius: 15px; - -webkit-appearance: none !important; -} -input[type='range']::-webkit-slider-thumb:hover { - background-color: #e2e2e2; - border-color: #a2a2a2; -} -.toolbar input[type='range'] { - margin-top: 30px; -} -/* Label */ -label { - user-select: none; - -webkit-user-select: none; - -moz-user-select: none; -} -/* Palette */ -.palette { - position: absolute; - color: white; - pointer-events: none; - background-color: transparent; -} -.palette-invoker { - width: 71px; - height: 73px; - background-color: black; - background-position: 2px 2px; - background-repeat: no-repeat; - background-size: 67px; - border: 2px solid #808080; - border-bottom: 0; -} -.palette-invoker:after { - position: absolute; - top: 60px; - left: 0; - display: block; - width: 75px; - height: 15px; - background-color: transparent; - background-image: url('../icons/emblems/arrow-up.svg'); - content: ""; -} -.palette-invoker:before { - position: absolute; - top: 75px; - left: 2px; - display: block; - width: 71px; - height: 2px; - background-color: black; - content: ""; -} -.palette .wrapper { - max-width: 371px; - min-width: 221px; - min-height: 71px; - pointer-events: auto; - background-color: black; - border: 2px solid #808080; -} -.palette .header { - height: 71px; - margin: 0 7.5px; - font-weight: bold; - line-height: 71px; - user-select: none; - -webkit-user-select: none; - -moz-user-select: none; -} -.palette hr { - border: 1px solid #808080; -} -.palette hr.header-separator { - margin-top: 0; -} -.palette .row { - height: 75px; - margin: 0 7.5px; -} -.palette .row:nth-last-child(1) { - height: 71px; -} -.palette .row.small { - height: 30px; -} -.palette .row.expand { - height: auto; -} -/* Palette menu */ -.palette .menu { - padding: 0; - margin-top: 15px; - margin-bottom: 15px; - list-style-type: none; -} -.palette .menu button { - width: 100%; - padding-top: 0; - padding-bottom: 0; - margin-top: 0; - margin-bottom: 0; - line-height: 45px; - text-align: left; - background-color: transparent; - border: 0; - border-radius: 0; -} -.palette .menu button:hover { - color: white; - background-color: #808080; -} -.palette .menu button.icon { - padding-left: 49px; -} -.palette .menu button.icon span { - top: 0; - left: 0; - width: 45px; - height: 45px; -} -/* Scrollbar */ -::-webkit-scrollbar { - width: 15px; - background-color: #808080; -} -::-webkit-scrollbar-thumb { - background-color: white; - border: 2px solid #dddddd; - border-radius: 15px; -} -/* Grid for visual debugging and layout */ -.grid { - position: absolute; - top: 0; - left: 0; - background-color: transparent; -} -/* Checkbox and radio */ -input[type='checkbox'], -input[type='radio'] { - width: 30px; - height: 30px; - margin: 2px 2px 4px 2px; - vertical-align: middle; - background-position: center; - background-size: contain; - -webkit-appearance: none; - -moz-appearance: none; - appearance: none; -} -.toolbar input[type='checkbox'], -.toolbar input[type='radio'] { - margin-top: 20.5px; - margin-bottom: 24.5px; -} -input[type='checkbox'] { - background-image: url(../icons/actions/checkbox-unchecked.svg); -} -input[type='checkbox']:active { - background-image: url(../icons/actions/checkbox-checked-selected.svg); -} -input[type='checkbox']:checked:active { - background-image: url(../icons/actions/checkbox-checked-selected.svg); -} -input[type='checkbox']:checked { - background-image: url(../icons/actions/checkbox-checked.svg); -} -input[type='radio'] { - background-image: url(../icons/actions/radio.svg); -} -input[type='radio']:active { - background-image: url(../icons/actions/radio-selected.svg); -} -input[type='radio']:checked:active { - background-image: url(../icons/actions/radio-active-selected.svg); -} -input[type='radio']:checked { - background-image: url(../icons/actions/radio-active.svg); -} -/* Textarea */ -textarea { - margin: 2px; - border: 2px solid #808080; -} -textarea.expand { - width: calc(100% - 12px); -} -/* Lists */ -ul.flat-list { - padding: 0; - margin: 0; - list-style-type: none; -} -ul.flat-list li { - height: 43px; - line-height: 43px; - background-color: white; - border-bottom: 2px dotted #c0c0c0; -} -ul.flat-list li:nth-last-child(1) { - border-bottom: none; -} -ul.flat-list.big li { - height: 58px; - line-height: 58px; -} -ul.flat-list.striped li:nth-child(odd) { - background-color: #e5e5e5; -} -/* ActivityPalette */ -#activity-palette .wrapper { - width: 371px; -} diff --git a/lib/sugar-web/graphics/css/sugar-200dpi.less b/lib/sugar-web/graphics/css/sugar-200dpi.less deleted file mode 100755 index 614c5ed162..0000000000 --- a/lib/sugar-web/graphics/css/sugar-200dpi.less +++ /dev/null @@ -1,2 +0,0 @@ -@subcell-size: 15px; -@import "sugar.less"; diff --git a/lib/sugar-web/graphics/css/sugar-96dpi.css b/lib/sugar-web/graphics/css/sugar-96dpi.css deleted file mode 100755 index fdcbe71a41..0000000000 --- a/lib/sugar-web/graphics/css/sugar-96dpi.css +++ /dev/null @@ -1,460 +0,0 @@ -html { - height: 100%; - -webkit-tap-highlight-color: rgba(0, 0, 0, 0); -} -body { - position: relative; - height: 100%; - margin: 0; - font-family: sans-serif; - font-size: 10pt; - background-color: #c0c0c0; -} -.unselectable { - user-select: none; - -webkit-user-select: none; - -moz-user-select: none; -} -.pull-right { - float: right; -} -a { - color: #0076c3; - text-decoration: none; -} -/* Toolbar */ -.toolbar { - height: 55px; - padding: 0 57px; - color: white; - background-color: #282828; - user-select: none; - -webkit-user-select: none; - -moz-user-select: none; -} -/* Toolbar separator */ -.toolbar hr { - display: inline-block; - height: 33px; - margin: 2.5px; - margin-bottom: -17px; - border: 1px solid #808080; -} -/* Toolbar toolbutton */ -.toolbar .toolbutton { - position: relative; - width: 47px; - height: 47px; - margin: 4px 2px; - color: white; - color: transparent; - background-color: transparent; - background-position: center; - background-repeat: no-repeat; - background-size: contain; - border: 0; - border-radius: 5.5px; -} -.toolbar .toolbutton:hover { - background-color: black; -} -.toolbar .toolbutton:active, -.toolbar .toolbutton.active { - background-color: #808080; -} -.toolbar .toolbutton img { - width: 100%; - height: 100%; -} -.toolbar .toolbutton:before { - position: absolute; - right: -4px; - bottom: -4px; - display: block; - width: 55px; - height: 11px; - background-color: transparent; - content: ""; -} -.toolbar .toolbutton.invoker:before { - background-image: url('../icons/emblems/arrow-down.svg'); -} -.toolbar #stop-button { - background-image: url('../icons/actions/activity-stop.svg'); -} -/* Canvas */ -#canvas { - position: absolute; - top: 55px; - bottom: 0; - width: 100%; - overflow-y: auto; - color: black; - background-color: #c0c0c0; -} -/* Button */ -button { - padding: 2px 4px; - line-height: 22px; - color: white; - background-color: #808080; - border: 2px solid transparent; - border-radius: 22px; - user-select: none; - -webkit-user-select: none; - -moz-user-select: none; -} -button:hover { - background-color: #a2a2a2; - border-color: #a2a2a2; -} -button:active { - color: black; - background-color: white; - border-color: #808080; -} -button:focus { - border-color: white; -} -.toolbar button { - margin-top: 12.5px; -} -/* Button with icon */ -button.icon { - position: relative; - padding-left: 26px; -} -button.icon span.ok { - background-image: url(../icons/actions/dialog-ok.svg); -} -button.icon:active span.ok { - background-image: url(../icons/actions/dialog-ok-active.svg); -} -button.icon span.cancel { - background-image: url(../icons/actions/dialog-cancel.svg); -} -button.icon:active span.cancel { - background-image: url(../icons/actions/dialog-cancel-active.svg); -} -button.icon span { - position: absolute; - display: inline-block; - width: 22px; - height: 22px; - background-color: transparent; - background-position: center; - background-repeat: no-repeat; - background-size: 22px 22px; -} -button.icon span { - top: 2px; - left: 2px; -} -/* One line text input */ -input[type='text'] { - width: 165px; - padding: 4px; - line-height: 22px; - background-color: #e5e5e5; - border: 2px solid #e5e5e5; - border-radius: 22px; - outline: 0; -} -input[type='text']:focus { - background-color: white; -} -input[type='text']:disabled { - background-color: #808080; - border-color: #808080; -} -.toolbar input[type='text'], -.palette .row input[type='text'] { - margin-top: 10.5px; -} -.palette .row input[type='text']:nth-last-child(1) { - margin-top: 8.5px; -} -input[type='text'].expand { - width: calc(100% - 12px); -} -/* One line text input with buttons inside */ -.icon-input { - position: relative; - display: inline-block; -} -.icon-input input[type='text'] { - width: 135px; - padding-right: 34px; -} -.icon-input.expand { - width: 100%; -} -.icon-input.expand input[type='text'] { - width: calc(100% - 42px); -} -.icon-input button { - position: absolute; - width: 34px; - height: 34px; - padding: 0; - background-size: 22px 22px; -} -.icon-input button.right { - right: 0; - margin: 0 0 0 -34px; - border-radius: 0 22px 22px 0; -} -.icon-input button { - background-color: transparent; - background-position: center; - background-repeat: no-repeat; - border: 0; -} -.icon-input button { - top: 2px; -} -.toolbar .icon-input button:hover { - background-color: transparent; -} -.toolbar .icon-input button { - top: 10.5px; -} -button.cancel { - background-image: url(../icons/actions/entry-cancel.svg); -} -button.cancel:active { - background-image: url(../icons/actions/entry-cancel-active.svg); -} -button.cancel:disabled { - background-image: url(../icons/actions/entry-cancel-disabled.svg); -} -/* Slider */ -/* FIXME this is not fully Sugarized yet */ -input[type='range'] { - height: 11px; - cursor: pointer; - background-color: #808080; - border-radius: 22px; - appearance: none; - -webkit-appearance: none !important; -} -input[type='range']::-webkit-slider-thumb { - width: 22px; - height: 22px; - background-color: #c0c0c0; - border: 4px solid #808080; - border-radius: 11px; - -webkit-appearance: none !important; -} -input[type='range']::-webkit-slider-thumb:hover { - background-color: #e2e2e2; - border-color: #a2a2a2; -} -.toolbar input[type='range'] { - margin-top: 22px; -} -/* Label */ -label { - user-select: none; - -webkit-user-select: none; - -moz-user-select: none; -} -/* Palette */ -.palette { - position: absolute; - color: white; - pointer-events: none; - background-color: transparent; -} -.palette-invoker { - width: 51px; - height: 53px; - background-color: black; - background-position: 2px 2px; - background-repeat: no-repeat; - background-size: 47px; - border: 2px solid #808080; - border-bottom: 0; -} -.palette-invoker:after { - position: absolute; - top: 44px; - left: 0; - display: block; - width: 55px; - height: 11px; - background-color: transparent; - background-image: url('../icons/emblems/arrow-up.svg'); - content: ""; -} -.palette-invoker:before { - position: absolute; - top: 55px; - left: 2px; - display: block; - width: 51px; - height: 2px; - background-color: black; - content: ""; -} -.palette .wrapper { - max-width: 271px; - min-width: 161px; - min-height: 51px; - pointer-events: auto; - background-color: black; - border: 2px solid #808080; -} -.palette .header { - height: 51px; - margin: 0 5.5px; - font-weight: bold; - line-height: 51px; - user-select: none; - -webkit-user-select: none; - -moz-user-select: none; -} -.palette hr { - border: 1px solid #808080; -} -.palette hr.header-separator { - margin-top: 0; -} -.palette .row { - height: 55px; - margin: 0 5.5px; -} -.palette .row:nth-last-child(1) { - height: 51px; -} -.palette .row.small { - height: 22px; -} -.palette .row.expand { - height: auto; -} -/* Palette menu */ -.palette .menu { - padding: 0; - margin-top: 11px; - margin-bottom: 11px; - list-style-type: none; -} -.palette .menu button { - width: 100%; - padding-top: 0; - padding-bottom: 0; - margin-top: 0; - margin-bottom: 0; - line-height: 33px; - text-align: left; - background-color: transparent; - border: 0; - border-radius: 0; -} -.palette .menu button:hover { - color: white; - background-color: #808080; -} -.palette .menu button.icon { - padding-left: 37px; -} -.palette .menu button.icon span { - top: 0; - left: 0; - width: 33px; - height: 33px; -} -/* Scrollbar */ -::-webkit-scrollbar { - width: 11px; - background-color: #808080; -} -::-webkit-scrollbar-thumb { - background-color: white; - border: 2px solid #dddddd; - border-radius: 11px; -} -/* Grid for visual debugging and layout */ -.grid { - position: absolute; - top: 0; - left: 0; - background-color: transparent; -} -/* Checkbox and radio */ -input[type='checkbox'], -input[type='radio'] { - width: 22px; - height: 22px; - margin: 2px 2px 4px 2px; - vertical-align: middle; - background-position: center; - background-size: contain; - -webkit-appearance: none; - -moz-appearance: none; - appearance: none; -} -.toolbar input[type='checkbox'], -.toolbar input[type='radio'] { - margin-top: 14.5px; - margin-bottom: 18.5px; -} -input[type='checkbox'] { - background-image: url(../icons/actions/checkbox-unchecked.svg); -} -input[type='checkbox']:active { - background-image: url(../icons/actions/checkbox-checked-selected.svg); -} -input[type='checkbox']:checked:active { - background-image: url(../icons/actions/checkbox-checked-selected.svg); -} -input[type='checkbox']:checked { - background-image: url(../icons/actions/checkbox-checked.svg); -} -input[type='radio'] { - background-image: url(../icons/actions/radio.svg); -} -input[type='radio']:active { - background-image: url(../icons/actions/radio-selected.svg); -} -input[type='radio']:checked:active { - background-image: url(../icons/actions/radio-active-selected.svg); -} -input[type='radio']:checked { - background-image: url(../icons/actions/radio-active.svg); -} -/* Textarea */ -textarea { - margin: 2px; - border: 2px solid #808080; -} -textarea.expand { - width: calc(100% - 12px); -} -/* Lists */ -ul.flat-list { - padding: 0; - margin: 0; - list-style-type: none; -} -ul.flat-list li { - height: 31px; - line-height: 31px; - background-color: white; - border-bottom: 2px dotted #c0c0c0; -} -ul.flat-list li:nth-last-child(1) { - border-bottom: none; -} -ul.flat-list.big li { - height: 42px; - line-height: 42px; -} -ul.flat-list.striped li:nth-child(odd) { - background-color: #e5e5e5; -} -/* ActivityPalette */ -#activity-palette .wrapper { - width: 271px; -} diff --git a/lib/sugar-web/graphics/css/sugar-96dpi.less b/lib/sugar-web/graphics/css/sugar-96dpi.less deleted file mode 100755 index ea91f49208..0000000000 --- a/lib/sugar-web/graphics/css/sugar-96dpi.less +++ /dev/null @@ -1,2 +0,0 @@ -@subcell-size: 11px; -@import "sugar.less"; diff --git a/lib/sugar-web/graphics/css/sugar.less b/lib/sugar-web/graphics/css/sugar.less deleted file mode 100755 index 647368f5f0..0000000000 --- a/lib/sugar-web/graphics/css/sugar.less +++ /dev/null @@ -1,589 +0,0 @@ -// recess: ignore - -@toolbar-grey: #282828; -@button-grey: #808080; -@panel-grey: #C0C0C0; -@text-field-grey: #E5E5E5; -@link-blue: #0076C3; - -@line-width: 2px; -@cell-size: 5 * @subcell-size; -@font-size: 10pt; - -@toolbar-height: @cell-size; -@icon-small-size: 2 * @subcell-size; - -@toolbutton-size: @toolbar-height - (4 * @line-width); -@toolbar-button-margin-top: (@toolbar-height / 2) - (2 * @line-width) - - (@icon-small-size / 2); - -@input-text-padding: (2 * @line-width); -@input-text-line-height: 2 * @subcell-size; -@input-text-width: 3 * @cell-size; -@toolbar-input-height: (@toolbar-height / 2) - (@input-text-line-height / 2) - - (@input-text-padding + @line-width); - -@button-small-size: @input-text-line-height + (2 * @input-text-padding) + - (2 * @line-width); - -html { - height: 100%; - -webkit-tap-highlight-color: rgba(0, 0, 0, 0); -} - -body { - position: relative; - height: 100%; - margin: 0; - font-family: sans-serif; - font-size: @font-size; - background-color: @panel-grey; -} - -.unselectable { - user-select: none; - -webkit-user-select: none; - -moz-user-select: none; -} - -.pull-right { - float: right; -} - -a { - color: @link-blue; - text-decoration: none; -} - -/* Toolbar */ - -.toolbar { - height: @toolbar-height; - padding: 0 @toolbutton-size + (5 * @line-width); - color: white; - background-color: @toolbar-grey; - .unselectable; -} - -/* Toolbar separator */ - -.toolbar hr { - display: inline-block; - height: 3 * @subcell-size; - margin: (@subcell-size - (@line-width * 3)) / 2; - margin-bottom: -1 * (@subcell-size + (@line-width * 3)); - border: (@line-width / 2) solid @button-grey; -} - -/* Toolbar toolbutton */ - -.toolbar .toolbutton { - position: relative; - width: @toolbutton-size; - height: @toolbutton-size; - margin: (2 * @line-width) @line-width; - color: white; - color: transparent; - background-color: transparent; - background-position: center; - background-repeat: no-repeat; - background-size: contain; - border: 0; - border-radius: @subcell-size / 2; -} - -.toolbar .toolbutton:hover { - background-color: black; -} - -.toolbar .toolbutton:active, .toolbar .toolbutton.active { - background-color: @button-grey; -} - -.toolbar .toolbutton img { - width: 100%; - height: 100%; -} - -.toolbar .toolbutton:before { - position: absolute; - right: -2 * @line-width; - bottom: -2 * @line-width; - display: block; - width: @cell-size; - height: @subcell-size; - background-color: transparent; - content: ""; -} - -.toolbar .toolbutton.invoker:before { - background-image: url('../icons/emblems/arrow-down.svg'); -} - -.toolbar #stop-button { - background-image: url('../icons/actions/activity-stop.svg'); -} - -/* Canvas */ - -#canvas { - position: absolute; - top: @toolbar-height; - bottom: 0; - width: 100%; - overflow-y: auto; - color: black; - background-color: @panel-grey; -} - -/* Button */ - -button { - padding: @line-width (2 * @line-width); - line-height: @icon-small-size; - color: white; - background-color: @button-grey; - border: @line-width solid transparent; - border-radius: 2 * @subcell-size; - .unselectable; -} - -button:hover { - background-color: @button-grey + #222; - border-color: @button-grey + #222; -} - -button:active { - color: black; - background-color: white; - border-color: @button-grey; -} - -button:focus { - border-color: white; -} - -.toolbar button { - margin-top: @toolbar-button-margin-top; -} - -/* Button with icon */ - -button.icon { - position: relative; - padding-left: @icon-small-size + (2 * @line-width); -} - -button.icon span.ok { - background-image: url(../icons/actions/dialog-ok.svg); -} - -button.icon:active span.ok { - background-image: url(../icons/actions/dialog-ok-active.svg); -} - -button.icon span.cancel { - background-image: url(../icons/actions/dialog-cancel.svg); -} - -button.icon:active span.cancel { - background-image: url(../icons/actions/dialog-cancel-active.svg); -} - -button.icon span { - position: absolute; - display: inline-block; - width: @icon-small-size; - height: @icon-small-size; - background-color: transparent; - background-position: center; - background-repeat: no-repeat; - background-size: @icon-small-size @icon-small-size; -} - -button.icon span { - top: @line-width; - left: @line-width; -} - -/* One line text input */ - -input[type='text'] { - width: @input-text-width; - padding: @input-text-padding; - line-height: @input-text-line-height; - background-color: @text-field-grey; - border: @line-width solid @text-field-grey; - border-radius: 2 * @subcell-size; - outline: 0; -} - -input[type='text']:focus { - background-color: white; -} - -input[type='text']:disabled { - background-color: @button-grey; - border-color: @button-grey; -} - -.toolbar input[type='text'], .palette .row input[type='text'] { - margin-top: @toolbar-input-height; -} - -.palette .row input[type='text']:nth-last-child(1) { - margin-top: @toolbar-input-height - @line-width; -} - -input[type='text'].expand { - width: calc(~"100%" - (2 * @input-text-padding + 2 * @line-width)); -} - -/* One line text input with buttons inside */ - -.icon-input { - position: relative; - display: inline-block; -} - -.icon-input input[type='text'] { - width: @input-text-width + @input-text-padding - @button-small-size; - padding-right: @button-small-size; -} - -.icon-input.expand { - width: 100%; -} - -.icon-input.expand input[type='text'] { - width: calc(~"100%" - (@input-text-padding + 2 * @line-width + - @button-small-size)); -} - -.icon-input button { - position: absolute; - width: @button-small-size; - height: @button-small-size; - padding: 0; - background-size: @icon-small-size @icon-small-size; -} - -.icon-input button.right { - right: 0; - margin: 0 0 0 -@button-small-size; - border-radius: 0 (2 * @subcell-size) (2 * @subcell-size) 0; -} - -.icon-input button { - background-color: transparent; - background-position: center; - background-repeat: no-repeat; - border: 0; -} - -.icon-input button { - top: @line-width; -} - -.toolbar .icon-input button:hover { - background-color: transparent; -} - -.toolbar .icon-input button { - top: @toolbar-input-height; -} - -button.cancel { - background-image: url(../icons/actions/entry-cancel.svg); -} - -button.cancel:active { - background-image: url(../icons/actions/entry-cancel-active.svg); -} - -button.cancel:disabled { - background-image: url(../icons/actions/entry-cancel-disabled.svg); -} - -/* Slider */ -/* FIXME this is not fully Sugarized yet */ - -input[type='range'] { - height: @subcell-size; - cursor: pointer; - background-color: @button-grey; - border-radius: 2 * @subcell-size; - appearance: none; - -webkit-appearance: none !important; -} - -input[type='range']::-webkit-slider-thumb { - width: @icon-small-size; - height: @icon-small-size; - background-color: @panel-grey; - border: (2 * @line-width) solid @button-grey; - border-radius: @subcell-size; - -webkit-appearance: none !important; -} - -input[type='range']::-webkit-slider-thumb:hover { - background-color: @panel-grey + #222; - border-color: @button-grey + #222; -} - -.toolbar input[type='range'] { - margin-top: (@toolbar-height / 2) - (@subcell-size / 2); -} - -/* Label */ - -label { - .unselectable; -} - -/* Palette */ - -.palette { - position: absolute; - color: white; - pointer-events: none; - background-color: transparent; -} - -.palette-invoker { - width: @cell-size - 2 * @line-width; - height: @cell-size - @line-width; - background-color: black; - background-position: @line-width @line-width; - background-repeat: no-repeat; - background-size: @toolbutton-size; - border: @line-width solid @button-grey; - border-bottom: 0; -} - -.palette-invoker:after { - position: absolute; - top: 4 * @subcell-size; - left: 0; - display: block; - width: @cell-size; - height: @subcell-size; - background-color: transparent; - background-image: url('../icons/emblems/arrow-up.svg'); - content: ""; -} - -.palette-invoker:before { - position: absolute; - top: @cell-size; - left: @line-width; - display: block; - width: @cell-size - 2 * @line-width; - height: @line-width; - background-color: black; - content: ""; -} - -.palette .wrapper { - max-width: 5 * @cell-size - 2 * @line-width; - min-width: 3 * @cell-size - 2 * @line-width; - min-height: @cell-size - 2 * @line-width; - pointer-events: auto; - background-color: black; - border: @line-width solid @button-grey; -} - -.palette .header { - height: @cell-size - 2 * @line-width; - margin: 0 (@subcell-size / 2); - font-weight: bold; - line-height: @cell-size - 2 * @line-width; - .unselectable; -} - -.palette hr { - border: (@line-width / 2) solid @button-grey; -} - -.palette hr.header-separator { - margin-top: 0; -} - -.palette .row { - height: @cell-size; - margin: 0 (@subcell-size / 2); -} - -.palette .row:nth-last-child(1) { - height: @cell-size - 2 * @line-width; -} - -.palette .row.small { - height: 2 * @subcell-size; -} - -.palette .row.expand { - height: auto; -} - -/* Palette menu */ - -.palette .menu { - padding: 0; - margin-top: @subcell-size; - margin-bottom: @subcell-size; - list-style-type: none; -} - -.palette .menu button { - width: 100%; - padding-top: 0; - padding-bottom: 0; - margin-top: 0; - margin-bottom: 0; - line-height: 3 * @subcell-size; - text-align: left; - background-color: transparent; - border: 0; - border-radius: 0; -} - -.palette .menu button:hover { - color: white; - background-color: @button-grey; -} - -.palette .menu button.icon { - padding-left: 3 * @subcell-size + 2 * @line-width; -} - -.palette .menu button.icon span { - top: 0; - left: 0; - width: 3 * @subcell-size; - height: 3 * @subcell-size; -} - -/* Scrollbar */ - -::-webkit-scrollbar { - width: @subcell-size; - background-color: @button-grey; -} - -::-webkit-scrollbar-thumb { - background-color: white; - border: @line-width solid #ddd; - border-radius: @subcell-size; -} - -/* Grid for visual debugging and layout */ - -.grid { - position: absolute; - top: 0; - left: 0; - background-color: transparent; -} - -.appearance(@value) { - -webkit-appearance: @value; - -moz-appearance: @value; - appearance: @value; -} - -/* Checkbox and radio */ - -input[type='checkbox'], -input[type='radio'] { - width: @icon-small-size; - height: @icon-small-size; - margin: @line-width @line-width (2 * @line-width) @line-width; - vertical-align: middle; - background-position: center; - background-size: contain; - .appearance(none); -} - -.toolbar input[type='checkbox'], -.toolbar input[type='radio'] { - margin-top: (@toolbar-height - @icon-small-size) / 2 - @line-width; - margin-bottom: (@toolbar-height - @icon-small-size) / 2 + @line-width; -} - -input[type='checkbox'] { - background-image: url(../icons/actions/checkbox-unchecked.svg); -} - -input[type='checkbox']:active { - background-image: url(../icons/actions/checkbox-checked-selected.svg); -} - -input[type='checkbox']:checked:active { - background-image: url(../icons/actions/checkbox-checked-selected.svg); -} - -input[type='checkbox']:checked { - background-image: url(../icons/actions/checkbox-checked.svg); -} - -input[type='radio'] { - background-image: url(../icons/actions/radio.svg); -} - -input[type='radio']:active { - background-image: url(../icons/actions/radio-selected.svg); -} - -input[type='radio']:checked:active { - background-image: url(../icons/actions/radio-active-selected.svg); -} - -input[type='radio']:checked { - background-image: url(../icons/actions/radio-active.svg); -} - -/* Textarea */ - -textarea { - margin: @line-width; - border: @line-width solid @button-grey; -} - -textarea.expand { - width: calc(~"100%" - (6 * (@line-width))); -} - -/* Lists */ - -ul.flat-list { - padding: 0; - margin: 0; - list-style-type: none; -} - -ul.flat-list li { - height: 3 * @subcell-size - @line-width; - line-height: 3 * @subcell-size - @line-width; - background-color: white; - border-bottom: @line-width dotted @panel-grey; -} - -ul.flat-list li:nth-last-child(1) { - border-bottom: none; -} - -ul.flat-list.big li { - height: 4 * @subcell-size - @line-width; - line-height: 4 * @subcell-size - @line-width; -} - -ul.flat-list.striped li:nth-child(odd) { - background-color: @text-field-grey; -} - -/* ActivityPalette */ - -#activity-palette .wrapper { - width: 5 * @cell-size - 2 * @line-width; -} diff --git a/lib/sugar-web/graphics/grid.js b/lib/sugar-web/graphics/grid.js deleted file mode 100755 index 3322bb8c54..0000000000 --- a/lib/sugar-web/graphics/grid.js +++ /dev/null @@ -1,57 +0,0 @@ -define(function () { - - 'use strict'; - - var grid = {}; - - // Add a grid overlay with lines spaced by subcellSize, for visual - // debugging. This is useful while doing the activity layout or - // while developing widgets. - grid.addGrid = function (subcellSize) { - var canvas = document.createElement('canvas'); - canvas.className = "grid"; - document.body.appendChild(canvas); - - var updateGrid = function () { - canvas.width = window.innerWidth; - canvas.height = window.innerHeight; - - var ctx = canvas.getContext("2d"); - ctx.strokeStyle = "#00FFFF"; - - var subcellsVertical = window.innerHeight / subcellSize; - for (i = 0; i < subcellsVertical; i++) { - if ((i + 1) % 5 === 0) { - ctx.lineWidth = 1; - } else { - ctx.lineWidth = 0.5; - } - ctx.beginPath(); - ctx.moveTo(0, subcellSize * (i + 1)); - ctx.lineTo(canvas.width, subcellSize * (i + 1)); - ctx.stroke(); - } - - var subcellsHorizontal = window.innerWidth / subcellSize; - for (i = 0; i < subcellsHorizontal; i++) { - if ((i + 1) % 5 === 0) { - ctx.lineWidth = 1; - } else { - ctx.lineWidth = 0.5; - } - ctx.beginPath(); - ctx.moveTo(subcellSize * (i + 1), 0); - ctx.lineTo(subcellSize * (i + 1), canvas.height); - ctx.stroke(); - } - }; - - updateGrid(); - - window.onresize = function (event) { - updateGrid(); - }; - }; - - return grid; -}); diff --git a/lib/sugar-web/graphics/icon.js b/lib/sugar-web/graphics/icon.js deleted file mode 100755 index 0c70ff1eb1..0000000000 --- a/lib/sugar-web/graphics/icon.js +++ /dev/null @@ -1,9 +0,0 @@ -define(function(){'use strict';var icon={};function changeColors(iconData,fillColor,strokeColor){var re;if(fillColor){re=/()/;iconData=iconData.replace(re,"$1"+fillColor+"$3");} -if(strokeColor){re=/()/;iconData=iconData.replace(re,"$1"+strokeColor+"$3");} -return iconData;} -icon.load=function(iconInfo,callback){var source;var dataHeader="data:image/svg+xml,";if("uri"in iconInfo){source=iconInfo.uri;}else if("name"in iconInfo){source="lib/graphics/icons/"+iconInfo.name+".svg";} -var fillColor=iconInfo.fillColor;var strokeColor=iconInfo.strokeColor;if(source.substring(0,4)=='data'){var iconData=decodeURIComponent(source.slice(dataHeader.length));var newData=changeColors(iconData,fillColor,strokeColor);callback(dataHeader+escape(newData));return;} -var client=new XMLHttpRequest();client.onload=function(){var iconData=this.responseText;var newData=changeColors(iconData,fillColor,strokeColor);callback(dataHeader+escape(newData));};client.open("GET",source);client.send();};function getBackgroundURL(elem){var style=elem.currentStyle||window.getComputedStyle(elem,'');var res=style.backgroundImage.slice(4,-1);var last=res.length-1;if(res[0]=='"'&&res[last]=='"'){res=res.slice(1,last);} -return res;} -function setBackgroundURL(elem,url){elem.style.backgroundImage="url('"+url+"')";} -icon.colorize=function(elem,colors,callback){var iconInfo={"uri":getBackgroundURL(elem),"strokeColor":colors.stroke,"fillColor":colors.fill};icon.load(iconInfo,function(url){setBackgroundURL(elem,url);if(callback){callback();}});};return icon;}); \ No newline at end of file diff --git a/lib/sugar-web/graphics/icons/actions/activity-stop.svg b/lib/sugar-web/graphics/icons/actions/activity-stop.svg deleted file mode 100755 index 11b82e817c..0000000000 --- a/lib/sugar-web/graphics/icons/actions/activity-stop.svg +++ /dev/null @@ -1,6 +0,0 @@ - - -]> - - \ No newline at end of file diff --git a/lib/sugar-web/graphics/icons/actions/checkbox-checked-selected.svg b/lib/sugar-web/graphics/icons/actions/checkbox-checked-selected.svg deleted file mode 100755 index 8ec1223a7c..0000000000 --- a/lib/sugar-web/graphics/icons/actions/checkbox-checked-selected.svg +++ /dev/null @@ -1,27 +0,0 @@ - - - -]> - - - - - - diff --git a/lib/sugar-web/graphics/icons/actions/checkbox-checked.svg b/lib/sugar-web/graphics/icons/actions/checkbox-checked.svg deleted file mode 100755 index 3cfce18f6a..0000000000 --- a/lib/sugar-web/graphics/icons/actions/checkbox-checked.svg +++ /dev/null @@ -1,27 +0,0 @@ - - - -]> - - - - - - diff --git a/lib/sugar-web/graphics/icons/actions/checkbox-unchecked-selected.svg b/lib/sugar-web/graphics/icons/actions/checkbox-unchecked-selected.svg deleted file mode 100755 index 2263279eb3..0000000000 --- a/lib/sugar-web/graphics/icons/actions/checkbox-unchecked-selected.svg +++ /dev/null @@ -1,22 +0,0 @@ - - -]> - - - - - diff --git a/lib/sugar-web/graphics/icons/actions/checkbox-unchecked.svg b/lib/sugar-web/graphics/icons/actions/checkbox-unchecked.svg deleted file mode 100755 index e1587823ef..0000000000 --- a/lib/sugar-web/graphics/icons/actions/checkbox-unchecked.svg +++ /dev/null @@ -1,22 +0,0 @@ - - -]> - - - - - diff --git a/lib/sugar-web/graphics/icons/actions/dialog-cancel-active.svg b/lib/sugar-web/graphics/icons/actions/dialog-cancel-active.svg deleted file mode 100755 index dc0d688f65..0000000000 --- a/lib/sugar-web/graphics/icons/actions/dialog-cancel-active.svg +++ /dev/null @@ -1,6 +0,0 @@ - - -]> - - diff --git a/lib/sugar-web/graphics/icons/actions/dialog-cancel.svg b/lib/sugar-web/graphics/icons/actions/dialog-cancel.svg deleted file mode 100755 index dab4ae2d99..0000000000 --- a/lib/sugar-web/graphics/icons/actions/dialog-cancel.svg +++ /dev/null @@ -1,6 +0,0 @@ - - -]> - - \ No newline at end of file diff --git a/lib/sugar-web/graphics/icons/actions/dialog-ok-active.svg b/lib/sugar-web/graphics/icons/actions/dialog-ok-active.svg deleted file mode 100755 index 45de8401ad..0000000000 --- a/lib/sugar-web/graphics/icons/actions/dialog-ok-active.svg +++ /dev/null @@ -1,6 +0,0 @@ - - -]> - - diff --git a/lib/sugar-web/graphics/icons/actions/dialog-ok.svg b/lib/sugar-web/graphics/icons/actions/dialog-ok.svg deleted file mode 100755 index 69e5a2a13c..0000000000 --- a/lib/sugar-web/graphics/icons/actions/dialog-ok.svg +++ /dev/null @@ -1,6 +0,0 @@ - - -]> - - \ No newline at end of file diff --git a/lib/sugar-web/graphics/icons/actions/entry-cancel-active.svg b/lib/sugar-web/graphics/icons/actions/entry-cancel-active.svg deleted file mode 100755 index 467509e759..0000000000 --- a/lib/sugar-web/graphics/icons/actions/entry-cancel-active.svg +++ /dev/null @@ -1,23 +0,0 @@ - - - -]> - diff --git a/lib/sugar-web/graphics/icons/actions/entry-cancel-disabled.svg b/lib/sugar-web/graphics/icons/actions/entry-cancel-disabled.svg deleted file mode 100755 index 55b4cdb878..0000000000 --- a/lib/sugar-web/graphics/icons/actions/entry-cancel-disabled.svg +++ /dev/null @@ -1,21 +0,0 @@ - - - -]> - - - diff --git a/lib/sugar-web/graphics/icons/actions/entry-cancel.svg b/lib/sugar-web/graphics/icons/actions/entry-cancel.svg deleted file mode 100755 index 5339a7e94f..0000000000 --- a/lib/sugar-web/graphics/icons/actions/entry-cancel.svg +++ /dev/null @@ -1,21 +0,0 @@ - - - -]> - - - diff --git a/lib/sugar-web/graphics/icons/actions/radio-active-selected.svg b/lib/sugar-web/graphics/icons/actions/radio-active-selected.svg deleted file mode 100755 index c1d1085a0d..0000000000 --- a/lib/sugar-web/graphics/icons/actions/radio-active-selected.svg +++ /dev/null @@ -1,31 +0,0 @@ - - - -]> - - - - - - - diff --git a/lib/sugar-web/graphics/icons/actions/radio-active.svg b/lib/sugar-web/graphics/icons/actions/radio-active.svg deleted file mode 100755 index a5fe591560..0000000000 --- a/lib/sugar-web/graphics/icons/actions/radio-active.svg +++ /dev/null @@ -1,31 +0,0 @@ - - - -]> - - - - - - - diff --git a/lib/sugar-web/graphics/icons/actions/radio-selected.svg b/lib/sugar-web/graphics/icons/actions/radio-selected.svg deleted file mode 100755 index a24b97e652..0000000000 --- a/lib/sugar-web/graphics/icons/actions/radio-selected.svg +++ /dev/null @@ -1,26 +0,0 @@ - - - -]> - - - - - - diff --git a/lib/sugar-web/graphics/icons/actions/radio.svg b/lib/sugar-web/graphics/icons/actions/radio.svg deleted file mode 100755 index d250286248..0000000000 --- a/lib/sugar-web/graphics/icons/actions/radio.svg +++ /dev/null @@ -1,26 +0,0 @@ - - - -]> - - - - - - diff --git a/lib/sugar-web/graphics/icons/actions/zoom-groups.svg b/lib/sugar-web/graphics/icons/actions/zoom-groups.svg deleted file mode 100755 index b88462ff50..0000000000 --- a/lib/sugar-web/graphics/icons/actions/zoom-groups.svg +++ /dev/null @@ -1,6 +0,0 @@ - - -]> - - \ No newline at end of file diff --git a/lib/sugar-web/graphics/icons/actions/zoom-home.svg b/lib/sugar-web/graphics/icons/actions/zoom-home.svg deleted file mode 100755 index 5578fecbff..0000000000 --- a/lib/sugar-web/graphics/icons/actions/zoom-home.svg +++ /dev/null @@ -1,6 +0,0 @@ - - -]> - - \ No newline at end of file diff --git a/lib/sugar-web/graphics/icons/actions/zoom-neighborhood.svg b/lib/sugar-web/graphics/icons/actions/zoom-neighborhood.svg deleted file mode 100755 index 8d3f8d1344..0000000000 --- a/lib/sugar-web/graphics/icons/actions/zoom-neighborhood.svg +++ /dev/null @@ -1,6 +0,0 @@ - - -]> - - \ No newline at end of file diff --git a/lib/sugar-web/graphics/icons/emblems/arrow-down.svg b/lib/sugar-web/graphics/icons/emblems/arrow-down.svg deleted file mode 100755 index 2de1a9e348..0000000000 --- a/lib/sugar-web/graphics/icons/emblems/arrow-down.svg +++ /dev/null @@ -1,20 +0,0 @@ - - - -]> - - - - - diff --git a/lib/sugar-web/graphics/icons/emblems/arrow-up.svg b/lib/sugar-web/graphics/icons/emblems/arrow-up.svg deleted file mode 100755 index a977f4a86a..0000000000 --- a/lib/sugar-web/graphics/icons/emblems/arrow-up.svg +++ /dev/null @@ -1,20 +0,0 @@ - - - -]> - - - - - diff --git a/lib/sugar-web/graphics/menupalette.html b/lib/sugar-web/graphics/menupalette.html deleted file mode 100755 index daf5fd579f..0000000000 --- a/lib/sugar-web/graphics/menupalette.html +++ /dev/null @@ -1,8 +0,0 @@ -{{#.}} -
  • - -
  • -{{/.}} diff --git a/lib/sugar-web/graphics/menupalette.js b/lib/sugar-web/graphics/menupalette.js deleted file mode 100755 index 27fe8edf8c..0000000000 --- a/lib/sugar-web/graphics/menupalette.js +++ /dev/null @@ -1,53 +0,0 @@ -define(["sugar-web/graphics/palette", - "text!sugar-web/graphics/menupalette.html", "mustache"], function (palette, template, mustache) { - - 'use strict'; - - var menupalette = {}; - - menupalette.MenuPalette = function (invoker, primaryText, menuData) { - palette.Palette.call(this, invoker, primaryText); - - this.selectItemEvent = document.createEvent("CustomEvent"); - this.selectItemEvent.initCustomEvent('selectItem', true, true, { - 'item': undefined - }); - - var menuElem = document.createElement('ul'); - menuElem.className = "menu"; - menuElem.innerHTML = mustache.render(template, menuData); - this.setContent([menuElem]); - - // Pop-down the palette when a item in the menu is clicked. - - this.buttons = menuElem.querySelectorAll('button'); - - var that = this; - - function popDownOnButtonClick(event) { - that.selectItemEvent.detail.target = event.target; - that.getPalette().dispatchEvent(that.selectItemEvent); - that.popDown(); - } - - for (var i = 0; i < this.buttons.length; i++) { - this.buttons[i].addEventListener('click', popDownOnButtonClick); - } - }; - - var addEventListener = function (type, listener, useCapture) { - return this.getPalette().addEventListener(type, listener, useCapture); - }; - - menupalette.MenuPalette.prototype = - Object.create(palette.Palette.prototype, { - addEventListener: { - value: addEventListener, - enumerable: true, - configurable: true, - writable: true - } - }); - - return menupalette; -}); diff --git a/lib/sugar-web/graphics/palette.js b/lib/sugar-web/graphics/palette.js deleted file mode 100755 index ded906de2a..0000000000 --- a/lib/sugar-web/graphics/palette.js +++ /dev/null @@ -1,13 +0,0 @@ -define(function(){'use strict';var palettesGroup=[];function getOffset(elem){var style=elem.currentStyle||window.getComputedStyle(elem,'');var x=-2*style.marginLeft.slice(0,-2);var y=-1*style.marginTop.slice(0,-2);var rect=elem.getBoundingClientRect();x+=rect.left;y+=rect.top;return{top:y,left:x,width:rect.width,height:rect.height};} -var palette={};palette.Palette=function(invoker,primaryText){this.invoker=invoker;if(this.invoker.classList.contains("toolbutton")){this.invoker.classList.add("invoker");} -this.primaryText=primaryText;var paletteElem;var wrapperElem;var headerElem;var headerSeparatorElem;var containerElem;var that=this;palettesGroup.push(this);invoker.addEventListener('click',function(event){if(!that.invoker.classList.contains("toolbutton")){updatePosition(event.x,event.y);} -that.toggle();});function updatePosition(clickX,clickY){var paletteX;var paletteY;if(typeof(clickX)!=='undefined'&&typeof(clickY)!=='undefined'){paletteX=clickX;paletteY=clickY;}else{var invokerOffset=getOffset(that.invoker);paletteX=invokerOffset.left;paletteY=invokerOffset.top;} -paletteElem.style.left=paletteX+"px";paletteElem.style.top=paletteY+"px";} -function createPaletteElement(){if(paletteElem!==undefined){return;} -paletteElem=document.createElement('div');paletteElem.className="palette";paletteElem.style.visibility="hidden";document.body.appendChild(paletteElem);if(that.invoker.classList.contains("toolbutton")){var invokerElem=document.createElement('div');invokerElem.className="palette-invoker";var style=that.invoker.currentStyle||window.getComputedStyle(that.invoker,'');invokerElem.style.backgroundImage=style.backgroundImage;invokerElem.addEventListener('click',function(e){that.toggle();});paletteElem.appendChild(invokerElem);} -wrapperElem=document.createElement('div');wrapperElem.className="wrapper";paletteElem.appendChild(wrapperElem);if(that.primaryText!==undefined){headerElem=document.createElement('div');headerElem.className="header";headerElem.innerText=that.primaryText;wrapperElem.appendChild(headerElem);} -headerSeparatorElem=document.createElement('hr');headerSeparatorElem.className="header-separator";headerSeparatorElem.style.display="none";wrapperElem.appendChild(headerSeparatorElem);containerElem=document.createElement('div');containerElem.className="container";wrapperElem.appendChild(containerElem);updatePosition();} -this.getPalette=function(){if(paletteElem===undefined){createPaletteElement();} -return paletteElem;};this.setContent=function(elementsList){if(paletteElem===undefined){createPaletteElement();} -(function removePreviousContent(){for(var i=0;i0&&this.primaryText!==undefined){headerSeparatorElem.style.display="block";}else{headerSeparatorElem.style.display="none";}};this.isDown=function(){return paletteElem===undefined||paletteElem.style.visibility=="hidden";};};palette.Palette.prototype.popUp=function(){for(var i=0;i. - */ - -define(["sugar-web/bus", "sugar-web/env", "sugar-web/datastore"], function (bus, env, datastore) { - - 'use strict'; - - var defaultTimeoutInterval = jasmine.getEnv().defaultTimeoutInterval; - - describe("datastore object", function () { - - beforeEach(function () { - // FIXME: due to db initialization, - // the very first save() call may take a while - jasmine.getEnv().defaultTimeoutInterval = 10000; - spyOn(env, 'isStandalone').andReturn(false); - bus.listen(); - }); - - afterEach(function () { - jasmine.getEnv().defaultTimeoutInterval = defaultTimeoutInterval; - bus.close(); - }); - - it("should be able to set and get metadata", function () { - var saved; - var gotMetadata; - var datastoreObject; - var objectId; - var testTitle = "hello"; - - runs(function () { - saved = false; - - datastoreObject = new datastore.DatastoreObject(); - datastoreObject.setMetadata({ - title: testTitle - }); - - datastoreObject.save(function () { - saved = true; - objectId = datastoreObject.objectId; - }); - }); - - waitsFor(function () { - return saved; - }, "should have saved the object"); - - runs(function () { - gotMetadata = false; - - datastoreObject = new datastore.DatastoreObject(objectId); - datastoreObject.getMetadata(function (error, metadata) { - expect(metadata.title).toEqual(testTitle); - gotMetadata = true; - }); - }); - - waitsFor(function () { - return gotMetadata; - }, "should have got the object metadata"); - }); - - it("should be able to save and load text", function () { - var saved; - var gotMetadata; - var datastoreObject; - var objectId; - var testText = "hello"; - - runs(function () { - saved = false; - - datastoreObject = new datastore.DatastoreObject(); - datastoreObject.setDataAsText(testText); - - datastoreObject.save(function () { - saved = true; - objectId = datastoreObject.objectId; - }); - }); - - waitsFor(function () { - return saved; - }, "should have saved the object"); - - runs(function () { - gotMetadata = false; - - function onLoaded(error, metadata, text) { - expect(text).toEqual(testText); - gotMetadata = true; - } - - datastoreObject = new datastore.DatastoreObject(objectId); - datastoreObject.loadAsText(onLoaded); - }); - - waitsFor(function () { - return gotMetadata; - }, "should have got the object metadata"); - }); - - }); - - describe("datastore", function () { - - beforeEach(function () { - // FIXME: due to db initialization, - // the very first save() call may take a while - jasmine.getEnv().defaultTimeoutInterval = 10000; - spyOn(env, 'isStandalone').andReturn(false); - bus.listen(); - }); - - afterEach(function () { - jasmine.getEnv().defaultTimeoutInterval = defaultTimeoutInterval; - bus.close(); - }); - - it("should be able to create an object", function () { - var wasCreated; - - runs(function () { - wasCreated = false; - - function onCreated(error, objectId) { - expect(objectId).toEqual(jasmine.any(String)); - wasCreated = true; - } - - datastore.create({}, onCreated); - }); - - waitsFor(function () { - return wasCreated; - }, "the object should be created"); - }); - - it("should be able to set object metadata", function () { - var metadataSet; - var gotMetadata; - var objectId; - var testTitle = "hello"; - - runs(function () { - function onMetadataSet(error) { - expect(error).toBeNull(); - metadataSet = true; - } - - function onCreated(error, createdObjectId) { - objectId = createdObjectId; - - var metadata = { - title: testTitle - }; - datastore.setMetadata(objectId, metadata, onMetadataSet); - } - - metadataSet = false; - - datastore.create({}, onCreated); - }); - - waitsFor(function () { - return metadataSet; - }, "metadata should be set"); - - runs(function () { - function onGotMetadata(error, metadata) { - expect(metadata.title).toEqual(testTitle); - gotMetadata = true; - } - - gotMetadata = false; - - datastore.getMetadata(objectId, onGotMetadata); - }); - - waitsFor(function () { - return gotMetadata; - }, "should have got object metadata"); - }); - - it("should be able to get object metadata", function () { - var gotMetadata = false; - var testTitle = "hello"; - - runs(function () { - function onGotMetadata(error, metadata) { - expect(metadata.title).toEqual(testTitle); - gotMetadata = true; - } - - function onCreated(error, objectId) { - datastore.getMetadata(objectId, onGotMetadata); - } - - datastore.create({ - title: testTitle - }, onCreated); - }); - - waitsFor(function () { - return gotMetadata; - }, "should have got object metadata"); - }); - - it("should be able to load an object", function () { - var wasLoaded = false; - var objectId = null; - var inputStream = null; - var objectData = null; - var testData = new Uint8Array([1, 2, 3, 4]); - - runs(function () { - function onStreamClose(error) { - expect(objectData).toEqual(testData.buffer); - wasLoaded = true; - } - - function onStreamRead(error, data) { - objectData = data; - } - - function onLoaded(error, metadata, loadedInputStream) { - inputStream = loadedInputStream; - inputStream.read(8192, onStreamRead); - inputStream.close(onStreamClose); - } - - function onClosed(error) { - datastore.load(objectId, onLoaded); - } - - function onSaved(error, outputStream) { - outputStream.write(testData); - outputStream.close(onClosed); - } - - function onCreated(error, createdObjectId) { - objectId = createdObjectId; - datastore.save(objectId, {}, onSaved); - } - - datastore.create({}, onCreated); - }); - - waitsFor(function () { - return wasLoaded; - }, "the object should be loaded"); - }); - }); -}); diff --git a/lib/sugar-web/test/functional/toolkitContractSpec.js b/lib/sugar-web/test/functional/toolkitContractSpec.js deleted file mode 100755 index 4de8bc02bb..0000000000 --- a/lib/sugar-web/test/functional/toolkitContractSpec.js +++ /dev/null @@ -1,50 +0,0 @@ -/** - * @license - * MusicBlocks v3.4.1 - * Copyright (C) 2015 Walter Bender - * - * 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -define(["sugar-web/env"], function (env) { - - 'use strict'; - - describe("Environment object", function () { - - it("should have valid properties", function () { - //FIXME: we shouldn't stub this here. - //current implementation of isStandalone fails with sugar-web-test - spyOn(env, 'isStandalone').andReturn(false); - - var expectedEnv; - - runs(function () { - env.getEnvironment(function (error, environment) { - expectedEnv = environment; - }); - }); - - waitsFor(function () { - return expectedEnv !== undefined; - }, "should get sugar environment"); - - runs(function () { - expect(expectedEnv.bundleId).not.toBeUndefined(); - expect(expectedEnv.activityId).not.toBeUndefined(); - expect(expectedEnv.activityName).not.toBeUndefined(); - }); - }); - }); -}); diff --git a/lib/sugar-web/test/graphics/iconSpec.js b/lib/sugar-web/test/graphics/iconSpec.js deleted file mode 100755 index 307fd744db..0000000000 --- a/lib/sugar-web/test/graphics/iconSpec.js +++ /dev/null @@ -1,78 +0,0 @@ -/** - * @license - * MusicBlocks v3.4.1 - * Copyright (C) 2015 Walter Bender - * - * 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -define(["sugar-web/graphics/icon"], function (icon) { - - 'use strict'; - - describe("icon", function () { - var wasLoaded; - var iconUrlResult; - - it("should be able to change icon more than once", function () { - var elem = document.createElement('div'); - var iconUrl; - - function callback(url) { - iconUrlResult = url; - wasLoaded = true; - } - - runs(function () { - wasLoaded = false; - iconUrl = "/base/graphics/icons/actions/dialog-ok-active.svg"; - var iconInfo = { - "uri": iconUrl, - "strokeColor": '#B20008', - "fillColor": '#FF2B34' - }; - icon.load(iconInfo, callback); - }); - - waitsFor(function () { - return wasLoaded; - }, "icon loaded"); - - runs(function () { - expect(iconUrlResult).not.toBe(iconUrl); - }); - - runs(function () { - wasLoaded = false; - iconUrl = iconUrlResult; - var iconInfo = { - "uri": iconUrl, - "strokeColor": '#FF2B34', - "fillColor": '#B20008' - }; - icon.load(iconInfo, callback); - }); - - waitsFor(function () { - return wasLoaded; - }, "icon loaded"); - - runs(function () { - expect(iconUrlResult).not.toBe(iconUrl); - }); - - }); - }); - -}); diff --git a/lib/sugar-web/test/graphics/menupaletteSpec.js b/lib/sugar-web/test/graphics/menupaletteSpec.js deleted file mode 100755 index b79aae7c1e..0000000000 --- a/lib/sugar-web/test/graphics/menupaletteSpec.js +++ /dev/null @@ -1,97 +0,0 @@ -/** - * @license - * MusicBlocks v3.4.1 - * Copyright (C) 2015 Walter Bender - * - * 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -define(["sugar-web/graphics/menupalette", "sugar-web/graphics/palette"], function (menupalette, palette) { - - 'use strict'; - - describe("menupalette", function () { - - var invoker; - var menuData; - var menuPalette; - - beforeEach(function () { - invoker = document.createElement('button'); - - menuData = [ - { - label: "One", - id: "one-button", - icon: true - }, - { - label: "Two", - id: "two-button", - icon: true - }, - { - label: "Three", - id: "three-button", - icon: true - } - ]; - - menuPalette = new menupalette.MenuPalette(invoker, undefined, - menuData); - }); - - it("should have a fixed number of clickable items", function () { - var buttons = menuPalette.getPalette(). - querySelectorAll('.container button'); - expect(buttons.length).toBe(menuData.length); - }); - - it("should emit a signal with the clicked item", function () { - var button; - var buttonSelected; - - function onItemSelected(event) { - button = event.detail.target; - buttonSelected = true; - } - - runs(function () { - buttonSelected = false; - menuPalette.addEventListener('selectItem', onItemSelected); - - var buttons = menuPalette.getPalette(). - querySelectorAll('.container button'); - buttons[1].click(); - }); - - waitsFor(function () { - return buttonSelected; - }, "should have selected a button"); - - runs(function () { - expect(button.id).toBe("two-button"); - }); - }); - - it("should be an instance of the child class", function () { - expect(menuPalette instanceof menupalette.MenuPalette).toBe(true); - }); - - it("should be an instance of the parent class", function () { - expect(menuPalette instanceof palette.Palette).toBe(true); - }); - - }); -}); diff --git a/lib/sugar-web/test/graphics/paletteSpec.js b/lib/sugar-web/test/graphics/paletteSpec.js deleted file mode 100755 index fc59eb9ffd..0000000000 --- a/lib/sugar-web/test/graphics/paletteSpec.js +++ /dev/null @@ -1,55 +0,0 @@ -/** - * @license - * MusicBlocks v3.4.1 - * Copyright (C) 2015 Walter Bender - * - * 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -define(["sugar-web/graphics/palette"], function (palette) { - - 'use strict'; - - describe("palette", function () { - it("should start down", function () { - var invoker = document.createElement('button'); - var myPalette = new palette.Palette(invoker); - expect(myPalette.isDown()).toBe(true); - }); - - it("should toggle", function () { - var invoker = document.createElement('button'); - var myPalette = new palette.Palette(invoker); - myPalette.toggle(); - expect(myPalette.isDown()).toBe(false); - myPalette.toggle(); - expect(myPalette.isDown()).toBe(true); - }); - - it("if one palette in a group popups, the others popdown", function () { - var invokerA = document.createElement('button'); - var invokerB = document.createElement('button'); - var myPaletteA = new palette.Palette(invokerA); - var myPaletteB = new palette.Palette(invokerB); - myPaletteA.toggle(); - expect(myPaletteA.isDown()).toBe(false); - expect(myPaletteB.isDown()).toBe(true); - myPaletteB.toggle(); - expect(myPaletteA.isDown()).toBe(true); - expect(myPaletteB.isDown()).toBe(false); - }); - - }); - -}); diff --git a/lib/sugar-web/test/graphics/radiobuttonsgroupSpec.js b/lib/sugar-web/test/graphics/radiobuttonsgroupSpec.js deleted file mode 100755 index f0e1a79f2e..0000000000 --- a/lib/sugar-web/test/graphics/radiobuttonsgroupSpec.js +++ /dev/null @@ -1,116 +0,0 @@ -/** - * @license - * MusicBlocks v3.4.1 - * Copyright (C) 2015 Walter Bender - * - * 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -define(["sugar-web/graphics/radiobuttonsgroup"], function ( - radioButtonsGroup) { - - 'use strict'; - - var elem1; - var elem2; - var elem3; - - beforeEach(function () { - elem1 = document.createElement('button'); - elem2 = document.createElement('button'); - elem3 = document.createElement('button'); - }); - - describe("radioToolButton", function () { - var wasClicked; - - it("should construct", function () { - var radio = new radioButtonsGroup.RadioButtonsGroup( - [elem1, elem2, elem3]); - expect(radio.elems.length).toBe(3); - }); - - it("should start active the first by default", function () { - var radio = new radioButtonsGroup.RadioButtonsGroup( - [elem1, elem2, elem3]); - expect(radio.getActive()).toBe(elem1); - }); - - it("should start active the first with 'active' class", function () { - elem2.className = "active red"; - elem3.className = "active blue"; - var radio = new radioButtonsGroup.RadioButtonsGroup( - [elem1, elem2, elem3]); - expect(radio.getActive()).toBe(elem2); - }); - - it("should add 'active' class to the selected item", function () { - var radio = new radioButtonsGroup.RadioButtonsGroup( - [elem1, elem2, elem3]); - var elem = radio.getActive(); - expect(elem.classList.contains('active')).toBe(true); - }); - - it("should change the active one on click", function () { - var radio = new radioButtonsGroup.RadioButtonsGroup( - [elem1, elem2, elem3]); - - // let's click elem2 - - runs(function () { - wasClicked = false; - - elem2.onclick = function () { - wasClicked = true; - }; - - elem2.click(); - }); - - waitsFor(function () { - return wasClicked; - }, "the element should be clicked"); - - runs(function () { - var elem = radio.getActive(); - expect(elem).toBe(elem2); - expect(elem.classList.contains('active')).toBe(true); - }); - - // now let's click elem1 - - runs(function () { - wasClicked = false; - - elem1.onclick = function () { - wasClicked = true; - }; - - elem1.click(); - }); - - waitsFor(function () { - return wasClicked; - }, "the element should be clicked"); - - runs(function () { - var elem = radio.getActive(); - expect(elem).toBe(elem1); - expect(elem.classList.contains('active')).toBe(true); - }); - }); - - }); - -}); diff --git a/lib/sugar-web/test/karma-shared.conf.js b/lib/sugar-web/test/karma-shared.conf.js deleted file mode 100755 index 9ff061f0ed..0000000000 --- a/lib/sugar-web/test/karma-shared.conf.js +++ /dev/null @@ -1,75 +0,0 @@ -// Karma configuration -// Generated on Mon May 13 2013 10:01:17 GMT-0300 (ART) - - -// list of files / patterns to load in the browser -module.exports = function (config) { - config.set({ - frameworks: ['jasmine', 'requirejs'], - - - // base path, that will be used to resolve files and exclude - basePath: '..', - - - files: [ - 'test/loader.js', - { - pattern: 'lib/**/*.js', - included: false - }, { - pattern: '*.js', - included: false - }, { - pattern: 'activity/**/*.js', - included: false - }, { - pattern: 'graphics/**/*', - included: false - } - ], - - - // list of files to exclude - exclude: [], - - - // test results reporter to use - // possible values: 'dots', 'progress', 'junit' - reporters: ['progress'], - - - // web server port - port: 9876, - - - // cli runner port - runnerPort: 9100, - - - // enable / disable colors in the output (reporters and logs) - colors: true, - - - // level of logging - // possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || - // LOG_DEBUG - logLevel: config.LOG_INFO, - - - // enable / disable watching file and executing tests whenever any file - // changes - autoWatch: true, - - - // If browser does not capture in given timeout [ms], kill it - captureTimeout: 60000, - - - // Continuous Integration mode - // if true, it capture browsers, run tests and exit - singleRun: false, - - preprocessors: {} - }); -}; diff --git a/lib/sugar-web/test/karma-unit.conf.js b/lib/sugar-web/test/karma-unit.conf.js deleted file mode 100755 index 889c20698f..0000000000 --- a/lib/sugar-web/test/karma-unit.conf.js +++ /dev/null @@ -1,19 +0,0 @@ -// Karma configuration for unit tests - -sharedConfig = require("./karma-shared.conf.js"); - -module.exports = function (config) { - var testFiles = [ - { - pattern: 'test/unit/*Spec.js', - included: false - }, { - pattern: 'test/graphics/*Spec.js', - included: false - }, - ]; - - sharedConfig(config); - - config.files = config.files.concat(testFiles); -}; diff --git a/lib/sugar-web/test/karma.conf.js b/lib/sugar-web/test/karma.conf.js deleted file mode 100755 index 9c2d69ed2c..0000000000 --- a/lib/sugar-web/test/karma.conf.js +++ /dev/null @@ -1,16 +0,0 @@ -// Karma configuration for all the tests - -sharedConfig = require("./karma-shared.conf.js"); - -module.exports = function (config) { - var testFiles = [ - { - pattern: 'test/**/*Spec.js', - included: false - } - ]; - - sharedConfig(config); - - config.files = config.files.concat(testFiles); -}; diff --git a/lib/sugar-web/test/loader.js b/lib/sugar-web/test/loader.js deleted file mode 100755 index aec983753d..0000000000 --- a/lib/sugar-web/test/loader.js +++ /dev/null @@ -1,21 +0,0 @@ -var tests = Object.keys(window.__karma__.files).filter(function (file) { - return (/Spec\.js$/).test(file); -}); - -requirejs.config({ - // Karma serves files from '/base' - baseUrl: "/base", - - paths: { - "sugar-web": ".", - "mustache": "lib/mustache", - "text": "lib/text", - "webL10n": "lib/webL10n" - }, - - // ask Require.js to load these files (all our tests) - deps: tests, - - // start test run, once Require.js is done - callback: window.__karma__.start -}); diff --git a/lib/sugar-web/test/unit/busSpec.js b/lib/sugar-web/test/unit/busSpec.js deleted file mode 100755 index d1c732d8ba..0000000000 --- a/lib/sugar-web/test/unit/busSpec.js +++ /dev/null @@ -1,175 +0,0 @@ -/** - * @license - * MusicBlocks v3.4.1 - * Copyright (C) 2015 Walter Bender - * - * 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -define(["sugar-web/bus"], function (bus) { - - 'use strict'; - - describe("bus requests", function () { - var client; - - function MockClient() { - this.result = []; - this.error = null; - } - - MockClient.prototype.send = function (data) { - var that = this; - setTimeout(function () { - var parsed = JSON.parse(data); - - var message = { - data: JSON.stringify({ - result: that.result, - error: that.error, - id: parsed.id - }) - }; - - that.onMessage(message); - }, 0); - }; - - MockClient.prototype.close = function () {}; - - beforeEach(function () { - client = new MockClient(); - bus.listen(client); - }); - - afterEach(function () { - bus.close(); - client = null; - }); - - it("should receive a response", function () { - var responseReceived; - - runs(function () { - responseReceived = false; - - function onResponseReceived(error, result) { - expect(error).toBeNull(); - expect(result).toEqual(["hello"]); - responseReceived = true; - } - - client.result = ["hello"]; - - bus.sendMessage("hello", [], onResponseReceived); - }); - - waitsFor(function () { - return responseReceived; - }, "a response should be received"); - }); - - it("should receive an error", function () { - var errorReceived; - - runs(function () { - errorReceived = false; - - function onResponseReceived(error, result) { - expect(error).toEqual(jasmine.any(Error)); - expect(result).toBeNull(); - - errorReceived = true; - } - - client.result = null; - client.error = new Error("error"); - - bus.sendMessage("hello", [], onResponseReceived); - }); - - waitsFor(function () { - return errorReceived; - }, "an error should be received"); - }); - - }); - - describe("bus notifications", function () { - var client; - - function MockClient() { - this.params = null; - } - - MockClient.prototype.send_notification = function (method, params) { - var that = this; - - setTimeout(function () { - var message = { - data: JSON.stringify({ - method: method, - params: that.params - }) - }; - - that.onMessage(message); - }, 0); - }; - - MockClient.prototype.close = function () {}; - - beforeEach(function () { - client = new MockClient(); - bus.listen(client); - }); - - afterEach(function () { - bus.close(); - client = null; - }); - - it("should receive a notification", function () { - var notificationReceived; - var notificationParams; - var originalParams = { - param1: true, - param2: "foo" - }; - - runs(function () { - notificationReceived = false; - notificationParams = null; - - function onNotificationReceived(params) { - notificationReceived = true; - notificationParams = params; - } - - bus.onNotification("hey.there", onNotificationReceived); - - client.params = originalParams; - client.send_notification("hey.there"); - }); - - waitsFor(function () { - return notificationReceived; - }, "a notification should be received"); - - runs(function () { - expect(notificationParams).toEqual(originalParams); - }); - }); - }); -}); diff --git a/lib/sugar-web/test/unit/datastoreSpec.js b/lib/sugar-web/test/unit/datastoreSpec.js deleted file mode 100755 index 7b1a469775..0000000000 --- a/lib/sugar-web/test/unit/datastoreSpec.js +++ /dev/null @@ -1,51 +0,0 @@ -/** - * @license - * MusicBlocks v3.4.1 - * Copyright (C) 2015 Walter Bender - * - * 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -define(["sugar-web/env", "sugar-web/datastore"], function (env, datastore) { - - 'use strict'; - - describe("Ensure the datastore object has an objectId", function () { - - // FIXME does not work in standalone mode - it("should have objectId", function () { - var objectId = "objectId"; - spyOn(env, "getObjectId").andCallFake(function (callback) { - setTimeout(function () { - callback(objectId); - }, 0); - }); - var callback = jasmine.createSpy(); - - var datastoreObject = new datastore.DatastoreObject(); - - runs(function () { - datastoreObject.ensureObjectId(callback); - }); - - waitsFor(function () { - return datastoreObject.objectId !== undefined; - }, "should have objectId received from the environment"); - - runs(function () { - expect(callback).toHaveBeenCalled(); - }); - }); - }); -}); diff --git a/lib/sugar-web/test/unit/dictstoreSpec.js b/lib/sugar-web/test/unit/dictstoreSpec.js deleted file mode 100755 index e05b3bbb1b..0000000000 --- a/lib/sugar-web/test/unit/dictstoreSpec.js +++ /dev/null @@ -1,73 +0,0 @@ -/** - * @license - * MusicBlocks v3.4.1 - * Copyright (C) 2015 Walter Bender - * - * 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -define(["sugar-web/dictstore", "sugar-web/env"], function (dictstore, env) { - - 'use strict'; - - describe("dictstore on standalone mode", function () { - - beforeEach(function () { - spyOn(env, 'isStandalone').andReturn(true); - }); - - describe("init method", function () { - - it("should execute callback", function () { - var callback = jasmine.createSpy(); - - dictstore.init(callback); - expect(callback).toHaveBeenCalled(); - }); - - it("should maintain localStorage", function () { - localStorage.testKey = "test"; - - dictstore.init(function () {}); - expect(localStorage.testKey).toBe("test"); - }); - }); - - describe("save method", function () { - - it("should just execute the callback", function () { - var callbackExecuted; - - localStorage.test_key = "test"; - - runs(function () { - callbackExecuted = false; - - dictstore.save(function () { - callbackExecuted = true; - }); - }); - - waitsFor(function () { - return callbackExecuted === true; - }, "The callback should executed"); - - runs(function () { - expect(localStorage.test_key).toBe("test"); - }); - }); - }); - - }); -}); diff --git a/lib/sugar-web/test/unit/envSpec.js b/lib/sugar-web/test/unit/envSpec.js deleted file mode 100755 index 9c819095cf..0000000000 --- a/lib/sugar-web/test/unit/envSpec.js +++ /dev/null @@ -1,156 +0,0 @@ -/** - * @license - * MusicBlocks v3.4.1 - * Copyright (C) 2015 Walter Bender - * - * 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -define(["sugar-web/env"], function (env) { - - 'use strict'; - - describe("getObjectId", function () { - - it("should return objectId from the sugar's environment", function () { - var environment = { - objectId: "objectId" - }; - spyOn(env, "getEnvironment").andCallFake(function (callback) { - setTimeout(function () { - callback(null, environment); - }, 0); - }); - var expected_objectId; - - runs(function () { - env.getObjectId(function (objectId) { - expected_objectId = objectId; - }); - }); - - waitsFor(function () { - return expected_objectId !== undefined; - }, "should return objectId"); - }); - }); - - describe("standalone mode", function () { - - it("should return true if in standalone mode", function () { - var noWebActivityURLScheme = "http:"; - spyOn(env, 'getURLScheme').andReturn(noWebActivityURLScheme); - - var isStandaloneMode = env.isStandalone(); - expect(isStandaloneMode).toBe(true); - }); - - it("should return false if not in standalone mode", function () { - var webActivityURLScheme = "activity:"; - spyOn(env, 'getURLScheme').andReturn(webActivityURLScheme); - - var isStandaloneMode = env.isStandalone(); - expect(isStandaloneMode).toBe(false); - }); - }); - - describe("getEnvironment", function () { - var sugarOrig; - - beforeEach(function () { - sugarOrig = JSON.parse(JSON.stringify(window.top.sugar)); - }); - - afterEach(function () { - window.top.sugar = sugarOrig; - }); - - describe("in sugar mode", function () { - - beforeEach(function () { - spyOn(env, 'isStandalone').andReturn(false); - }); - - describe("when env was already set", function () { - - it("should run callback with null error and env", function () { - var environment = {}; - window.top.sugar = { - environment: environment - }; - var callback = jasmine.createSpy(); - - runs(function () { - env.getEnvironment(callback); - }); - - waitsFor(function () { - return callback.wasCalled; - }, "callback should be executed"); - - runs(function () { - expect(callback).toHaveBeenCalledWith( - null, environment); - }); - }); - }); - - describe("when env was not set, yet", function () { - - beforeEach(function () { - window.top.sugar = undefined; - }); - - it("should set onEnvironmentSet handler", function () { - var sugar; - env.getEnvironment(function () {}); - sugar = window.top.sugar; - expect(sugar.onEnvironmentSet).not.toBeUndefined(); - }); - - it("should run callback on EnvironmentSet event", function () { - var callback = jasmine.createSpy(); - var expectedEnv = "env"; - - env.getEnvironment(callback); - window.top.sugar.environment = expectedEnv; - window.top.sugar.onEnvironmentSet(); - - expect(callback).toHaveBeenCalledWith(null, expectedEnv); - }); - }); - }); - - it("should return {} in standalone mode", function () { - window.top.sugar = undefined; - spyOn(env, 'isStandalone').andReturn(true); - var actualEnv; - - runs(function () { - env.getEnvironment(function (error, environment) { - actualEnv = environment; - }); - }); - - waitsFor(function () { - return actualEnv !== undefined; - }, "environment not to be undefined"); - - runs(function () { - expect(actualEnv).toEqual({}); - }); - - }); - }); -});