summaryrefslogtreecommitdiffstats
path: root/script
diff options
context:
space:
mode:
authorJan Holthuis <jan.holthuis@ruhr-uni-bochum.de>2020-01-17 17:37:05 +0100
committerJan Holthuis <jan.holthuis@ruhr-uni-bochum.de>2020-01-17 17:37:31 +0100
commitc8f17f8e0cbaabd68a5957733110f78b2642389a (patch)
tree4ec95fc5c55d477fcc2f09552ead3916389dbd1a /script
parentb5cad7246148aac64dc5bf814b6bcef299f5e094 (diff)
script: Fix various code style issues
Diffstat (limited to 'script')
-rw-r--r--script/console/__init__.js15
-rw-r--r--script/svg/__init__.js62
2 files changed, 36 insertions, 41 deletions
diff --git a/script/console/__init__.js b/script/console/__init__.js
index d18a0697f9..f81b4c105f 100644
--- a/script/console/__init__.js
+++ b/script/console/__init__.js
@@ -2,20 +2,19 @@ __setupPackage__(__extension__);
/**
* This is a fake Firebug console api. To debug scripts a few more like in
* javascript.
- *
+ *
* More info :
* http://blog.qt.digia.com/blog/2012/03/01/debugging-qt-quick-2-console-api/
- *
+ *
*/
-
console = {
- log : function(){
+ "log": function(){
var out = [],
i = 0;
- for( ; i<arguments.length; i++ ){
- out.push( JSON.stringify(arguments[i]) );
+ for (; i<arguments.length; i++){
+ out.push(JSON.stringify(arguments[i]));
}
- print(out.join(' '));
+ print(out.join(" "));
}
-}
+};
diff --git a/script/svg/__init__.js b/script/svg/__init__.js
index ee30315cef..98e16a3b1a 100644
--- a/script/svg/__init__.js
+++ b/script/svg/__init__.js
@@ -4,63 +4,59 @@ __setupPackage__(__extension__);
* the SVG parser.
*/
-function isNumber(n) {
+var isNumber = function(n) {
return !isNaN(parseFloat(n)) && isFinite(n);
-}
-
-
-
-(function(){
+};
+(function() {
svg.templateHooks = {};
svg.regexpQuote = function (str, delimiter) {
return String(str).replace(
new RegExp(
- '[.\\\\+*?\\[\\^\\]$(){}=!<>|:\\' + (delimiter || '') + '-]',
- 'g'
+ "[.\\\\+*?\\[\\^\\]$(){}=!<>|:\\" + (delimiter || "") + "-]",
+ "g"
),
- '\\$&'
+ "\\$&"
);
- }
+ };
svg.getHooksPattern = function(){
var hookNames = [];
- for( var i in this.templateHooks )
+ for (var i in this.templateHooks)
hookNames.push(i);
-
+
// hook_name( arg1 [, arg2]... )
- if( hookNames.length ){
- var pattern = "("+hookNames.join('|')+")\\(([^\\(\\)]+)\\)\\s*;?";
+ if (hookNames.length){
+ var pattern = "("+hookNames.join("|")+")\\(([^\\(\\)]+)\\)\\s*;?";
return pattern;
}
- }
+ };
var global = this;
- svg.templateHooks.variable = function( varName ){
- if( varName in global ){
+ svg.templateHooks.variable = function(varName){
+ if (varName in global){
return global[varName];
}
- return '';
- }
+ return "";
+ };
+
+ svg.templateHooks.prop = function(propName, varName){
+ var out = "";
- svg.templateHooks.prop = function( propName, varName ){
- var out = '';
-
- if( (varName in global) ){
+ if ((varName in global)){
var value = global[varName];
-
- if( isNumber(value) ){
- out = propName + ':' + value + ';';
- } else if( value.length ) {
- out = propName + ':' + value + ';';
+
+ if (isNumber(value)){
+ out = propName + ":" + value + ";";
+ } else if (value.length) {
+ out = propName + ":" + value + ";";
}
-
+
} else {
- console.log( 'Unable to find ' + varName + ' for prop hook.' );
+ console.log("Unable to find " + varName + " for prop hook.");
}
-
+
return out;
- }
+ };
})();
-