urturn-cli 0.6.2 → 0.6.3
Sign up to get free protection for your applications and to get access to all the features.
data/bin/urturn
CHANGED
@@ -3,8 +3,7 @@
|
|
3
3
|
* is to puts all your code in the camelcased version of your expression system name.
|
4
4
|
*
|
5
5
|
* /!\ Your expression might be loaded multiple time in the
|
6
|
-
* same page so you should always limit your DOM queries to
|
7
|
-
* expression.getElement().
|
6
|
+
* same page so you should always limit your DOM queries to expression.getElement().
|
8
7
|
*/
|
9
8
|
|
10
9
|
var <%= system_name.gsub(/\-/,'_').camelcase %> = function(expression){
|
@@ -14,28 +13,26 @@ var <%= system_name.gsub(/\-/,'_').camelcase %> = function(expression){
|
|
14
13
|
|
15
14
|
var self = this;
|
16
15
|
// display the image.
|
17
|
-
this.expression.
|
18
|
-
if(imageResource){
|
19
|
-
self.displayImage(imageResource);
|
20
|
-
}
|
21
|
-
});
|
16
|
+
self.displayImage(this.expression.storage.getItem('picture'));
|
22
17
|
|
23
18
|
// display the name.
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
});
|
19
|
+
if(self.nameWrapper){
|
20
|
+
self.nameWrapper.innerHTML = this.expression.storage.getItem('myName');
|
21
|
+
}
|
22
|
+
self.expression.container.autoResize();
|
29
23
|
};
|
30
24
|
|
31
25
|
<%= system_name.gsub(/\-/,'_').camelcase %>.prototype.displayImage = function(imageResource) {
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
26
|
+
if(!imageResource){
|
27
|
+
return;
|
28
|
+
}
|
29
|
+
if (!this.img) {
|
30
|
+
this.img = document.createElement('img');
|
31
|
+
this.imageWrapper.appendChild(this.img);
|
32
|
+
var self = this;
|
33
|
+
this.img.addEventListener('load', function(event){
|
34
|
+
self.expression.container.autoResize();
|
35
|
+
});
|
36
|
+
}
|
37
|
+
this.img.src = imageResource.url;
|
41
38
|
};
|
@@ -12,34 +12,31 @@
|
|
12
12
|
this.displayImage = function(imageResource) {
|
13
13
|
playerDisplayImage.call(this, imageResource);
|
14
14
|
this.editorDisplayImage();
|
15
|
-
}
|
15
|
+
};
|
16
16
|
if(this.img){
|
17
17
|
this.editorDisplayImage();
|
18
18
|
}
|
19
19
|
|
20
20
|
var self = this;
|
21
21
|
// display text in editor
|
22
|
-
this.expression.
|
23
|
-
if(item){
|
24
|
-
self.nameEditor.value = item.value;
|
25
|
-
}
|
26
|
-
});
|
22
|
+
self.nameEditor.value = this.expression.storage.getItem('myName', "");
|
27
23
|
|
28
24
|
// save text on post
|
29
25
|
this.expression.post(function(doPostCallback){
|
30
|
-
self.expression.
|
31
|
-
|
32
|
-
|
26
|
+
self.expression.storage.setItem('myName', self.nameEditor.value);
|
27
|
+
self.expression.storage.save();
|
28
|
+
doPostCallback();
|
33
29
|
});
|
34
30
|
};
|
35
31
|
|
36
32
|
<%= system_name.gsub(/\-/,'_').camelcase %>.prototype.bindChooseImage = function() {
|
37
33
|
var self = this;
|
38
34
|
return function(event) {
|
39
|
-
self.expression.medias.imageDialog(function(imageResource)
|
35
|
+
self.expression.medias.imageDialog(function(imageResource){
|
40
36
|
// Directly save image upon selection
|
41
|
-
self.expression.
|
37
|
+
self.expression.storage.setItem('picture', imageResource);
|
42
38
|
self.displayImage(imageResource);
|
39
|
+
self.expression.readyToPost(true);
|
43
40
|
});
|
44
41
|
};
|
45
42
|
};
|
@@ -47,4 +44,4 @@
|
|
47
44
|
<%= system_name.gsub(/\-/,'_').camelcase %>.prototype.editorDisplayImage = function() {
|
48
45
|
this.img.addEventListener('click', this.bindChooseImage());
|
49
46
|
this.chooseImageButton.className += ' hidden';
|
50
|
-
}
|
47
|
+
};
|
data/lib/webdoc-cli/version.rb
CHANGED