Skip to content
Browse files

Fix a log of bugs. Now working

  • Loading branch information...
1 parent df9ce76 commit e736b879eb9bf035b63ddd4c288f1248f9bad423 @gcamp committed
Showing with 13 additions and 11 deletions.
  1. +1 −1 OpenRadarHelper.safariextension/GlobalPage.html
  2. +12 −10 OpenRadarHelper.safariextension/Main.js
View
2 OpenRadarHelper.safariextension/GlobalPage.html
@@ -4,7 +4,7 @@
<title>old extension bar page</title>
<script type="text/javascript">
- function respondToMessage(messageEvent) {
+ function respondToMessage(messageEvent) {
if (messageEvent.name == "getDuplicateValue") {
var value = localStorage.getItem(messageEvent.message);
var returnedValue = [messageEvent.message, value];
View
22 OpenRadarHelper.safariextension/Main.js
@@ -101,20 +101,22 @@ function fillDuplicateContent() {
}
function getMessage(msgEvent) { //The GlobalPage.html returned
- if (msgEvent.name == "wantsOpenRadar" && msgEvent.message !== "null") saveRadarNumberAndSubmit();
- else if (msgEvent.name == "wantsDuplicateRadar") {
- if (msgEvent.message == "yes") fillDuplicateContent();
- else overwriteSubmitButton();
+ if (msgEvent.name == "openRadar") {
+ if (msgEvent.message[0] == "wantsOpenRadar" && msgEvent.message[1] !== "null") saveRadarNumberAndSubmit();
+ else if (msgEvent.message[0] == "wantsDuplicateRadar") {
+ if (msgEvent.message[1] == "yes") fillDuplicateContent();
+ else overwriteSubmitButton();
+ }
+ else if (msgEvent.message[1] != "null") document.getElementsByName(msgEvent.message[0])[0].value = msgEvent.message[1];
}
- else if (msgEvent.name == "openRadar") document.getElementsByName(msgEvent.name)[0].value = msgEvent.message;
else if (msgEvent.name == "duplicate") {
- document.getElementById(msgEvent.name).value = msgEvent.message;
+ document.getElementById(msgEvent.message[0]).value = msgEvent.message[1];
}
}
+safari.self.addEventListener("message", getMessage, false);
+
if (document.URL == "http://openradar.appspot.com/myradars/add") fillContent(); //In OpenRadar bug reporter
else if (document.URL.indexOf("http://openradar.appspot.com/") != -1) addDuplicateButton(); //In OpenRadar, in description page
-else if (document.title.indexOf("New Problem") != -1) safari.self.tab.dispatchMessage("getDatabaseValue", "wantsDuplicateRadar"); //In Apple bug reporter, in "New Problem" page.
-else if (document.title.indexOf("Home") != -1) safari.self.tab.dispatchMessage("getDatabaseValue", "wantsOpenRadar"); //In Apple bug reporter, in the submission confirmation.
-
-safari.self.addEventListener("message", getMessage, false);
+else if (document.title.indexOf("New Problem") != -1) safari.self.tab.dispatchMessage("getOpenRadarValue", "wantsDuplicateRadar"); //In Apple bug reporter, in "New Problem" page.
+else if (document.title.indexOf("Home") != -1) safari.self.tab.dispatchMessage("getOpenRadarValue", "wantsOpenRadar"); //In Apple bug reporter, in the submission confirmation.

0 comments on commit e736b87

Please sign in to comment.
Something went wrong with that request. Please try again.