rffw 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,110 +1,119 @@
1
- (function(){
2
-
3
-
4
-
5
-
6
- Element.prototype.css = function(object){
7
- for(property in object){
8
- this.style.setProperty(property, object[property]);
9
- }
10
- };
11
-
12
- Element.prototype.toggle = function(){
13
- if (window.getComputedStyle(this, 'display') == "none"){
14
- this.show();
15
- } else {
16
- this.hide();
17
- }
18
- };
19
-
20
-
21
- Element.prototype.show = function(){
22
- this.style.setProperty("display", "block");
23
- };
24
-
25
- Element.prototype.hide = function(){
26
- this.style.setProperty("display", "none");
27
- };
28
-
29
-
30
- window.info = function(message){
31
- var hover = document.getElementById('drop_the_file');
32
- if (message == undefined){
33
- hover.classList.remove("show");
34
-
35
- }else{
36
- hover.innerHTML = message;
37
- hover.classList.add("show");
38
- }
39
- }
40
- window.onload = function(){
41
-
42
- function S4() {
43
- return (((1+Math.random())*0x10000)|0).toString(16).substring(1);
44
- }
45
- function new_guid(){
46
- return (S4()+S4()+"-"+S4()+"-"+S4()+"-"+S4()+"-"+S4()+S4()+S4());
47
- }
48
-
49
- document.getElementById("progress_bar").css({"display": "none"});
50
-
51
-
52
- window.uuid = new_guid();
53
-
54
- form = document.getElementById("uploader_form")
55
- form.action = form.action+"?"+window.uuid;
56
-
57
- description_form = document.getElementById("description_form")
58
- description_form.action = description_form.action+"?"+window.uuid;
59
-
60
- function check_status(){
61
- setTimeout(function(){
62
- var req = new XMLHttpRequest();
63
- req.open('GET', '/upload_status.js?'+window.uuid, true);
64
- req.onreadystatechange = function (aEvt) {
65
- if (req.readyState == 4) {
66
- if(req.status == 200){
67
-
68
- record = JSON.parse(req.responseText);
69
- if (record.progress){
70
- var progress = record.progress.split("/");
71
- d(progress)
72
- var total = parseInt(progress[1]);
73
- var partial = parseInt(progress[0]);
74
- var porcentage = (100 * partial / total).toFixed();
75
- if (porcentage > 100) porcentage = 100;
76
-
77
- document.getElementById("porcentage").css({'width': porcentage+'%'});
78
- document.getElementById("total_uploaded").innerHTML = porcentage+'%';
79
- check_status();
80
- } else {
81
- document.getElementById("porcentage").css({'width': '100%'});
82
- document.getElementById("total_uploaded").innerHTML = "Uploaded!"
83
- }
84
- }
85
- else {
86
- d("Error loading page\n");
87
- }
88
- }
89
- };
90
- req.send(null);
91
- }, 200);
92
- }
93
-
94
- form.onchange = function(){
95
- form.submit();
96
- document.getElementById("file_input").css({"display": "none"});
97
- document.getElementById("progress_bar").css({"display": "block"});
98
- check_status();
99
- };
100
-
101
- window.d = function(msg){
102
- window.console.debug(msg)
103
- }
104
-
105
-
106
-
107
-
108
- }
1
+ (function() {
2
+
3
+
4
+
5
+
6
+ Element.prototype.css = function(object) {
7
+ for (property in object) {
8
+ this.style.setProperty(property, object[property]);
9
+ }
10
+ };
11
+
12
+ Element.prototype.toggle = function() {
13
+ if (window.getComputedStyle(this, 'display') == "none") {
14
+ this.show();
15
+ } else {
16
+ this.hide();
17
+ }
18
+ };
19
+
20
+ Element.prototype.show = function() {
21
+ this.style.setProperty("display", "block");
22
+ };
23
+
24
+ Element.prototype.hide = function() {
25
+ this.style.setProperty("display", "none");
26
+ };
27
+
28
+ window.info = function(message) {
29
+ var hover = document.getElementById('drop_the_file');
30
+ if (message == undefined) {
31
+ hover.classList.remove("show");
32
+
33
+ } else {
34
+ hover.innerHTML = message;
35
+ hover.classList.add("show");
36
+ }
37
+ };
38
+
39
+ window.onload = function() {
40
+
41
+ function S4() {
42
+ return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
43
+ }
44
+ function new_guid() {
45
+ return (S4() + S4() + "-" + S4() + "-" + S4() + "-" + S4() + "-" + S4() + S4() + S4());
46
+ }
47
+
48
+ document.getElementById("progress_bar").css({
49
+ "display": "none"
50
+ });
51
+
52
+
53
+ window.uuid = new_guid();
54
+
55
+ form = document.getElementById("uploader_form");
56
+ form.action = form.action + "?" + window.uuid;
57
+
58
+ description_form = document.getElementById("description_form");
59
+ description_form.action = description_form.action + "?" + window.uuid;
60
+
61
+ function check_status() {
62
+ setTimeout(function() {
63
+ var req = new XMLHttpRequest();
64
+ req.open('GET', '/upload_status.js?' + window.uuid, true);
65
+ req.onreadystatechange = function(aEvt) {
66
+ if (req.readyState == 4) {
67
+ if (req.status == 200) {
68
+
69
+ record = JSON.parse(req.responseText);
70
+ if (record.progress) {
71
+ var progress = record.progress.split("/");
72
+ var total = parseInt(progress[1],10);
73
+ var partial = parseInt(progress[0],10);
74
+ var porcentage = (100 * partial / total).toFixed();
75
+ if (porcentage > 100) porcentage = 100;
76
+
77
+ document.getElementById("porcentage").css({
78
+ 'width': porcentage + '%'
79
+ });
80
+ document.getElementById("total_uploaded").innerHTML = porcentage + '%';
81
+ check_status();
82
+ } else {
83
+ document.getElementById("porcentage").css({
84
+ 'width': '100%'
85
+ });
86
+ document.getElementById("total_uploaded").innerHTML = "Uploaded!";
87
+ }
88
+ }
89
+ else {
90
+ d("Error loading page\n");
91
+ }
92
+ }
93
+ };
94
+ req.send(null);
95
+ },
96
+ 200);
97
+ }
98
+
99
+ form.onchange = function() {
100
+ form.submit();
101
+ document.getElementById("file_input").css({
102
+ "display": "none"
103
+ });
104
+ document.getElementById("progress_bar").css({
105
+ "display": "block"
106
+ });
107
+ check_status();
108
+ };
109
+
110
+ window.d = function(msg) {
111
+ window.console.debug(msg);
112
+ };
113
+
114
+
115
+
116
+
117
+ };
109
118
 
110
119
  })();
@@ -1,3 +1,3 @@
1
1
  module RFFW
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rffw
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: