Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 220 lines (176 sloc) 13.163 kB
4ee0a1c initial Turkish translation
Eli Mitchell authored
1 <!DOCTYPE html>
2 <html lang="en">
3 <head>
4 <meta charset="utf-8">
5 <style type="text/css">
b3ca05a implemented more efficient i18n
Eli Mitchell authored
6 @import 'styles/styles.css';
7 @import 'styles/special.css';
4ee0a1c initial Turkish translation
Eli Mitchell authored
8 </style>
9 <title>Fix the Web</title>
10 </head>
f396580 lots of fixes and optimizations, some work on the i18n design
Eli Mitchell authored
11 <body class="loading" id="popup">
b3ca05a implemented more efficient i18n
Eli Mitchell authored
12 <p id="login-notice" data-i18n>{{login_notice}}</p>
4ee0a1c initial Turkish translation
Eli Mitchell authored
13
14 <form action="" method="post" id="report-site-form">
b3ca05a implemented more efficient i18n
Eli Mitchell authored
15 <h1 data-i18n>{{report_site_problem}}</h1>
16 <p id="form-begins">
17 <label for="page-address" data-i18n>{{page}}: </label><input type="url" required="required" id="page-address" name="page_address" placeholder="{{url_required}}" data-i18n-attr="placeholder" />
4ee0a1c initial Turkish translation
Eli Mitchell authored
18 </p>
19
b3ca05a implemented more efficient i18n
Eli Mitchell authored
20 <label data-i18n>{{which_category}}</label>
4ee0a1c initial Turkish translation
Eli Mitchell authored
21 <p>
22 <input required="required" type="radio" name="category" id="category-1" value="1" class="category" />
b3ca05a implemented more efficient i18n
Eli Mitchell authored
23 <label for="category-1" data-i18n>{{minor_annoyance}}</label>
4ee0a1c initial Turkish translation
Eli Mitchell authored
24
25 <input type="radio" name="category" id="category-2" value="2" class="category" />
b3ca05a implemented more efficient i18n
Eli Mitchell authored
26 <label for="category-2" data-i18n>{{major_problem}}</label>
4ee0a1c initial Turkish translation
Eli Mitchell authored
27
28 <input type="radio" name="category" id="category-3" value="3" class="category" />
b3ca05a implemented more efficient i18n
Eli Mitchell authored
29 <label for="category-3" data-i18n>{{site_unusable}}</label>
4ee0a1c initial Turkish translation
Eli Mitchell authored
30 </p>
31
32 <p>
b3ca05a implemented more efficient i18n
Eli Mitchell authored
33 <label for="error-report-description" data-i18n>{{error_details}}:</label>
34 <textarea rows="5" cols="30" id="error-report-description" required="required" name="description" placeholder="{{error_details_info}}" data-i18n-attr="placeholder"></textarea>
4ee0a1c initial Turkish translation
Eli Mitchell authored
35 </p>
36
b3ca05a implemented more efficient i18n
Eli Mitchell authored
37 <div class="pad_bottom"><em id="additional-information-details-panel-opener" data-i18n>{{additional_details}}...</em><input type="submit" value="{{submit_report}} &gt;" data-i18n-attr="value" />
4ee0a1c initial Turkish translation
Eli Mitchell authored
38 <p id="additional-information-details-panel">
b3ca05a implemented more efficient i18n
Eli Mitchell authored
39 <input type="text" id="OS" name="OS" placeholder="{{operating_system}}" data-i18n-attr="placeholder" />
40 <input type="text" id="opera-version" name="opera_version" placeholder="Opera {{version}}" data-i18n-attr="placeholder" />
41 <input type="text" id="opera-build-number" name="opera_build_number" placeholder="Opera {{build_number}}" data-i18n-attr="placeholder" />
42 <textarea id="additional-information" name="additional_information" cols="35" rows="4" placeholder="{{plugins_placeholder}}" data-i18n-attr="placeholder"></textarea>
4ee0a1c initial Turkish translation
Eli Mitchell authored
43 </p>
44 </div>
45 </form>
46
b3ca05a implemented more efficient i18n
Eli Mitchell authored
47 <ul id="link-related-with-the-site" data-i18n>
48 <li><a href="#" id="open-comment-panel">{{view_problems}}</a></li>
49 <li><a href="reports.html" target="_blank">{{view_recent_bug_reports}}</a></li>
4ee0a1c initial Turkish translation
Eli Mitchell authored
50 </ul>
51
b3ca05a implemented more efficient i18n
Eli Mitchell authored
52 <script src="scripts/jquery-1.6.4.min.js"></script>
53 <script src="scripts/jsOAuth-1.3.3.min.js"></script>
54 <script src="scripts/misc.js"></script>
55 <script src="scripts/locale.js"></script>
56 <script src="scripts/translate.js"></script>
57 <script>
4ee0a1c initial Turkish translation
Eli Mitchell authored
58 // check if the user is authenticated
59 if ( opera.extension.bgProcess.isLoggedIn() )
60 $('body').attr('class', 'logged_in')
61 else
b3ca05a implemented more efficient i18n
Eli Mitchell authored
62 $('body').attr('class', 'login')
4ee0a1c initial Turkish translation
Eli Mitchell authored
63
64 window.addEventListener("DOMContentLoaded", function() {
65 document.getElementById('open-comment-panel').innerText = 'View problems reported on this '
66 + (widget.preferences['display-reports-by'] && widget.preferences['display-reports-by'] == 'domain' ? 'site' : 'page')
67
68 // get the current tab's URL
69 var tab = opera.extension.bgProcess.opera.extension.tabs.getFocused();
70
71 if (tab) document.getElementById('page-address').value = tab.url;
72
73 // when "Vew problems reported on this site" is clicked, open the comments panel
74 document.getElementById('open-comment-panel').addEventListener("click", function() {
75 opera.extension.bgProcess.opera.extension.tabs.getFocused().postMessage({
76 load_comments_frame : true
77 }); // trigger the comments frame's creation
78
79 window.close(); // closes the popup window - doesn't work in developer mode
80
81 return false; // keep link from following the default action
82 }, false);
83
84 // function show_message() shows an error or success message above the form
85 function show_message (text, message_mode) { // message_mode: 'error' or 'success'
86 var message = document.querySelector('#error, #success'),
87 first_form_element = document.getElementById('form-begins');
88
89 if (message) message.parentNode.removeChild(message); // remove old messages before displaying a new one
90
91 var element = document.createElement('div');
92 element.id = message_mode;
93 element.innerHTML = text;
94
95 first_form_element.parentNode.insertBefore(element, first_form_element);
96 }
97
98 // process the form when it is submitted
99 document.getElementById('report-site-form').onsubmit = function() {
100 var error_message = document.getElementById('error');
101 if (error_message) error_message.parentNode.removeChild(error_message);
102
103 var error_form = document.getElementById('report-site-form'),
104 domain_name = /:\/\/([^\/]+)\/?/.test(error_form.page_address.value) ? error_form.page_address.value.match(/:\/\/([^\/]+)\/?/)[1] : '', // get the second item in the result's array which is the matched text in the parentheses
105 params = {
106 mode : 'submit error', // this is to select the correct form handler in ajax_request_handler.php
1b90f25 some basic fixes
Eli Mitchell authored
107 url : error_form.page_address.value.replace(/\/$/ig, ''),
4ee0a1c initial Turkish translation
Eli Mitchell authored
108 domain : domain_name,
109 category : (document.querySelector('input.category:checked') ? document.querySelector('input.category:checked').value : false),
110 description : error_form.description.value,
111 system : error_form.OS.value,
112 version : error_form.opera_version.value,
113 build : error_form.opera_build_number.value,
114 misc : error_form.additional_information.value,
b3ca05a implemented more efficient i18n
Eli Mitchell authored
115 language : i18n.language_abbreviation.toUpperCase()
4ee0a1c initial Turkish translation
Eli Mitchell authored
116 };
117
b3ca05a implemented more efficient i18n
Eli Mitchell authored
118 if (!params.url.length) show_message ( i18n.no_url_error, 'error' );
119 else if (!(/^(1|2|3)$/).test(params.category)) show_message ( i18n.no_category_error, 'error' );
120 else if (!params.description.length) show_message ( i18n.no_description_error, 'error' );
4ee0a1c initial Turkish translation
Eli Mitchell authored
121 else {
122 // send report asynchronously to the server with the ajax_request_handler.php file on it
123 // see the "Fix the Web Server Side" repo on Github (http://github.com/cyberstream/Fix-the-Web-Server-Side) for that file
124 // validate and process the form request in ajax_request_handler.php
125
126 $('#report-site-form').fadeTo(600, 0.4);
127
128 try {
129 opera.extension.bgProcess.getUserName(function(data) {
130 var parsedResponse = data && data.text && data.text != '' && JSON.parse(data.text) ? JSON.parse(data.text) : {}
131
132 params.username = parsedResponse.screen_name;
133
134 if (!params.username || !params.username.length) show_message ( 'There was an error retrieving your username.', 'error' );
135 else {
136 opera.extension.bgProcess.sendRequest('GET', 'ajax_request_handler.php', function(message) {
137 $('#report-site-form').fadeTo(600, 1);
138
b3ca05a implemented more efficient i18n
Eli Mitchell authored
139 if (message == 'true') show_message (i18n.report_submitted_message, 'success');
4ee0a1c initial Turkish translation
Eli Mitchell authored
140 else if (message.length > 0) show_message (message, 'error');
b3ca05a implemented more efficient i18n
Eli Mitchell authored
141 else show_message (i18n.report_submission_error, 'error');
4ee0a1c initial Turkish translation
Eli Mitchell authored
142 }, params, true);
143 }
144 });
145 } catch (e) {
b3ca05a implemented more efficient i18n
Eli Mitchell authored
146 show_message (i18n.report_connect_error, 'error');
4ee0a1c initial Turkish translation
Eli Mitchell authored
147 }
148 }
149
150 return false; // prevent the form from actually submitting
151 }
152
153 // Toggle additional information panel by clicking the text "Additional information"
154 document.getElementById("additional-information-details-panel-opener").addEventListener("click",function(){
155
156 var state = document.getElementById("additional-information-details-panel").style.display;
157
158 switch(state){
159
160 // if #additional-information-panel is hidden, it will be indicated
161 case "block":
162 document.getElementById("additional-information-details-panel").style.display="none";
163 break;
164 // if #additional-information-panel is visible, it will disappear
165 case "none":
166 case "":
167 document.getElementById("additional-information-details-panel").style.display="block";
168 break;
169
170 }
171
172 },false);
173
174 if ((window.opera) && (opera.buildNumber)){
175 // learn and write version into hidden element (#opera-version)
176 document.getElementById("opera-version").value = opera.version();
177
178 // learn and write version of Opera into hidden element (#opera-build-number)
179 document.getElementById("opera-build-number").value = opera.buildNumber();
180 }
181
182 // seperator will split additional information to different parts
183 var separator = "\r\n===========\r\n";
184
185 // cache (#additional-information) element
186 var bug = document.getElementById('additional-information');
187
188 // learn what plugins is installed and write them into hidden element (#additional-information)
b3ca05a implemented more efficient i18n
Eli Mitchell authored
189 bug.value += i18n.plugins.toUpperCase() + ":" + separator;
4ee0a1c initial Turkish translation
Eli Mitchell authored
190
191 // navigator.plugins stores what plugins is installed and which are activated
192 if (navigator.plugins) {
193 for (var i = 0; i < navigator.plugins.length; i++) {
194 // for each plugin obtain its name, description and file name. Then write them into hidden element (#additional-information)
195 var plugin = navigator.plugins[i];
196 bug.value += "* " + plugin.name + " ("+plugin.description+") "+plugin.filename+"\r\n";
197 }
198 }
199
200 // learn screen resolution write them into hidden element (#additional-information)
b3ca05a implemented more efficient i18n
Eli Mitchell authored
201 bug.value += "\n\n" +i18n.screen.toUpperCase()+ ":" + separator;
4ee0a1c initial Turkish translation
Eli Mitchell authored
202 if ((typeof(screen.width) != "undefined") && (screen.width && screen.height))
b3ca05a implemented more efficient i18n
Eli Mitchell authored
203 bug.value += i18n.resolution.toUpperCase() + ': ' + screen.width + 'x' + screen.height + "\n";
4ee0a1c initial Turkish translation
Eli Mitchell authored
204
205 // learn color depth and write them into hidden element (#additional-information)
206 if ((typeof(screen.colorDepth) != "undefined") && (screen.colorDepth))
b3ca05a implemented more efficient i18n
Eli Mitchell authored
207 bug.value += i18n.color_depth.toUpperCase() + ': ' + screen.colorDepth + "\r\n";
4ee0a1c initial Turkish translation
Eli Mitchell authored
208
209 // platform states whether the system is Win32, 64-bit build, mac or linux
210 document.getElementById("OS").value = navigator.platform // default system form field value, but it is overwritten if this next thing works....
211
212 opera.extension.onmessage = function(e) {
213 if (e.data && e.data.system) document.getElementById("OS").value = e.data.system // ...if data arrives via messaging from the bgProcess, and it's the system info, then put it into the system field of the form.
214 }
215
216 var system = opera.extension.bgProcess.getOS(); // call the function
217 },false);
218 </script>
219 </body>
220 </html>
Something went wrong with that request. Please try again.