| 913 | |
| 914 | Wrapper = (function() { |
| 915 | function Wrapper(ws_url) { |
| 916 | this.reloadIframe = bind(this.reloadIframe, this); |
| 917 | this.setSizeLimit = bind(this.setSizeLimit, this); |
| 918 | this.updateModifiedPanel = bind(this.updateModifiedPanel, this); |
| 919 | this.sitePublish = bind(this.sitePublish, this); |
| 920 | this.siteSign = bind(this.siteSign, this); |
| 921 | this.onWrapperLoad = bind(this.onWrapperLoad, this); |
| 922 | this.onPageLoad = bind(this.onPageLoad, this); |
| 923 | this.onCloseWebsocket = bind(this.onCloseWebsocket, this); |
| 924 | this.onOpenWebsocket = bind(this.onOpenWebsocket, this); |
| 925 | this.handleMessage = bind(this.handleMessage, this); |
| 926 | this.cmd = bind(this.cmd, this); |
| 927 | this.onMessageInner = bind(this.onMessageInner, this); |
| 928 | this.handleMessageWebsocket = bind(this.handleMessageWebsocket, this); |
| 929 | this.onMessageWebsocket = bind(this.onMessageWebsocket, this); |
| 930 | this.verifyEvent = bind(this.verifyEvent, this); |
| 931 | this.log("Created!"); |
| 932 | this.loading = new Loading(this); |
| 933 | this.notifications = new Notifications($(".notifications")); |
| 934 | this.infopanel = new Infopanel($(".infopanel")); |
| 935 | this.infopanel.onClosed = (function(_this) { |
| 936 | return function() { |
| 937 | return _this.ws.cmd("siteSetSettingsValue", ["modified_files_notification", false]); |
| 938 | }; |
| 939 | })(this); |
| 940 | this.infopanel.onOpened = (function(_this) { |
| 941 | return function() { |
| 942 | return _this.ws.cmd("siteSetSettingsValue", ["modified_files_notification", true]); |
| 943 | }; |
| 944 | })(this); |
| 945 | this.fixbutton = new Fixbutton(); |
| 946 | window.addEventListener("message", this.onMessageInner, false); |
| 947 | this.inner = document.getElementById("inner-iframe").contentWindow; |
| 948 | this.ws = new ZeroWebsocket(ws_url); |
| 949 | this.ws.next_message_id = 1000000; |
| 950 | this.ws.onOpen = this.onOpenWebsocket; |
| 951 | this.ws.onClose = this.onCloseWebsocket; |
| 952 | this.ws.onMessage = this.onMessageWebsocket; |
| 953 | this.ws.connect(); |
| 954 | this.ws_error = null; |
| 955 | this.next_cmd_message_id = -1; |
| 956 | this.site_info = null; |
| 957 | this.server_info = null; |
| 958 | this.event_site_info = $.Deferred(); |
| 959 | this.inner_loaded = false; |
| 960 | this.inner_ready = false; |
| 961 | this.wrapperWsInited = false; |
| 962 | this.site_error = null; |
| 963 | this.address = null; |
| 964 | this.opener_tested = false; |
| 965 | this.announcer_line = null; |
| 966 | this.web_notifications = {}; |
| 967 | this.allowed_event_constructors = [window.MouseEvent, window.KeyboardEvent, window.PointerEvent]; |
| 968 | window.onload = this.onPageLoad; |
| 969 | window.onhashchange = (function(_this) { |
| 970 | return function(e) { |
| 971 | var src; |
| 972 | _this.log("Hashchange", window.location.hash); |