diff --git a/src/js/storyJS.tw b/src/js/storyJS.tw index e7e6a886bda78ae3e4b6ecaee028bf1f3efc71b0..823f96318610de9b53a3ee29bfd20a52c65dcbfe 100644 --- a/src/js/storyJS.tw +++ b/src/js/storyJS.tw @@ -1983,4 +1983,11 @@ window.ngUpdateGenePool = function(genePool) { result.ID += 1200000; return result; }); -} \ No newline at end of file +} + +window.toJson = function(obj) { + var jsontext = JSON.stringify(obj); + jsontext = jsontext.replace(/^{/,""); + jsontext = jsontext.replace(/}$/,""); + return jsontext; +}; diff --git a/src/uncategorized/exportRule.tw b/src/uncategorized/exportRule.tw index d5e21c5de59c25a7499ff26eca0c9ef6012ff762..46ff48fade4251ac48a86c58118201ca70ed2b57 100644 --- a/src/uncategorized/exportRule.tw +++ b/src/uncategorized/exportRule.tw @@ -3,8 +3,10 @@ <<set $nextButton to "Continue">> <<set $nextLink to "Rules Assistant">> -//Copy the following block of code for importing// +//Copy the one of following blocks of code for importing later. Direct JSON method more automatical and guarantee to export ALL variables used in pregmod, but rely on browser JS process capability and may not work in some browsers. (Mostly old ones.)// <br><br> +__Default FC export method__: +<br> name: "$currentRule.name", activation: "$currentRule.activation", thresholdLower: <<if ndef $currentRule.thresholdLower or $currentRule.thresholdLower is "none">> "none", @@ -52,3 +54,8 @@ excludedSlaves: <<else>> $currentRule.excludedSlaves <</if>> +<br> +<br> __Direct JSON export__: <br> + +<<set _jsonText = toJson($currentRule)>> +_jsonText