rffw 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/rffw/app/data/javascripts/application.js +117 -108
- data/lib/rffw/version.rb +1 -1
- metadata +1 -1
| @@ -1,110 +1,119 @@ | |
| 1 | 
            -
            (function(){
         | 
| 2 | 
            -
             | 
| 3 | 
            -
             | 
| 4 | 
            -
             | 
| 5 | 
            -
             | 
| 6 | 
            -
             | 
| 7 | 
            -
             | 
| 8 | 
            -
             | 
| 9 | 
            -
             | 
| 10 | 
            -
             | 
| 11 | 
            -
             | 
| 12 | 
            -
             | 
| 13 | 
            -
             | 
| 14 | 
            -
             | 
| 15 | 
            -
             | 
| 16 | 
            -
             | 
| 17 | 
            -
             | 
| 18 | 
            -
             | 
| 19 | 
            -
             | 
| 20 | 
            -
             | 
| 21 | 
            -
             | 
| 22 | 
            -
             | 
| 23 | 
            -
             | 
| 24 | 
            -
             | 
| 25 | 
            -
             | 
| 26 | 
            -
             | 
| 27 | 
            -
             | 
| 28 | 
            -
             | 
| 29 | 
            -
             | 
| 30 | 
            -
             | 
| 31 | 
            -
             | 
| 32 | 
            -
             | 
| 33 | 
            -
             | 
| 34 | 
            -
             | 
| 35 | 
            -
             | 
| 36 | 
            -
             | 
| 37 | 
            -
             | 
| 38 | 
            -
             | 
| 39 | 
            -
             | 
| 40 | 
            -
             | 
| 41 | 
            -
             | 
| 42 | 
            -
             | 
| 43 | 
            -
             | 
| 44 | 
            -
             | 
| 45 | 
            -
             | 
| 46 | 
            -
             | 
| 47 | 
            -
             | 
| 48 | 
            -
             | 
| 49 | 
            -
             | 
| 50 | 
            -
             | 
| 51 | 
            -
             | 
| 52 | 
            -
             | 
| 53 | 
            -
             | 
| 54 | 
            -
             | 
| 55 | 
            -
             | 
| 56 | 
            -
             | 
| 57 | 
            -
             | 
| 58 | 
            -
             | 
| 59 | 
            -
             | 
| 60 | 
            -
             | 
| 61 | 
            -
             | 
| 62 | 
            -
             | 
| 63 | 
            -
             | 
| 64 | 
            -
             | 
| 65 | 
            -
             | 
| 66 | 
            -
             | 
| 67 | 
            -
             | 
| 68 | 
            -
             | 
| 69 | 
            -
             | 
| 70 | 
            -
             | 
| 71 | 
            -
             | 
| 72 | 
            -
             | 
| 73 | 
            -
             | 
| 74 | 
            -
             | 
| 75 | 
            -
             | 
| 76 | 
            -
             | 
| 77 | 
            -
             | 
| 78 | 
            -
             | 
| 79 | 
            -
             | 
| 80 | 
            -
             | 
| 81 | 
            -
             | 
| 82 | 
            -
             | 
| 83 | 
            -
             | 
| 84 | 
            -
             | 
| 85 | 
            -
             | 
| 86 | 
            -
             | 
| 87 | 
            -
             | 
| 88 | 
            -
             | 
| 89 | 
            -
             | 
| 90 | 
            -
             | 
| 91 | 
            -
             | 
| 92 | 
            -
             | 
| 93 | 
            -
             | 
| 94 | 
            -
             | 
| 95 | 
            -
             | 
| 96 | 
            -
             | 
| 97 | 
            -
             | 
| 98 | 
            -
             | 
| 99 | 
            -
             | 
| 100 | 
            -
             | 
| 101 | 
            -
             | 
| 102 | 
            -
             | 
| 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 | 
             
            })();
         | 
    
        data/lib/rffw/version.rb
    CHANGED