Permalink
Browse files

Doorways and Signposts

Got these displaying, but still don't communicate correctly with the
common code
  • Loading branch information...
1 parent 87d994a commit a81c851176bc2708886d06d0c379c889a48a2dd0 @Bnolin Bnolin committed May 5, 2012
@@ -19,7 +19,7 @@ function removeAllPopovers()
for(var i=0;i<safari.extension.popovers.length;i++)
{
var id = safari.extension.popovers[i].identifier;
- if( id == "StashBarrel" || id == "TrapPlaced" || id == "SpiderPlaced")
+ if( id == "StashBarrel" || id == "TrapPlaced" || id == "SpiderPlaced" || id == "DoorwayPlaced" || id == "SignpostPlaced")
{
safari.extension.popovers[i].hide();
}
@@ -29,6 +29,8 @@ function removeAllPopovers()
safari.extension.removePopover("TrapPlaced");
safari.extension.removePopover("StashBarrel");
safari.extension.removePopover("SpiderPlaced");
+ safari.extension.removePopover("SignpostPlaced");
+ safari.extension.removePopover("DoorwayPlaced");
@@ -48,7 +50,7 @@ function niClientApp_catchPopup(which) {
if (which == "nova_initia_tool_barrel") {
removeAllPopovers();
- var barrelPopover = safari.extension.createPopover("StashBarrel", safari.extension.baseURI + "popovers/StashBarrel.html",250,375);
+ var barrelPopover = safari.extension.createPopover("StashBarrel", safari.extension.baseURI + "popovers/StashBarrel.html",250,350);
_displayPopover.popover = barrelPopover;
_displayPopover.showPopover();
@@ -57,18 +59,19 @@ function niClientApp_catchPopup(which) {
// handle signposts
if (which == "nova_initia_tool_signpost") {
- var signpost_panel_popup_title = prompt("Enter title: ","");
- var signpost_panel_popup_comment = prompt("Enter comment: ","");
- var signpost_panel_popup_nsfw = false;
- window.NovaInitia.Toolbar.place_signpost(signpost_panel_popup_title,signpost_panel_popup_comment,signpost_panel_popup_nsfw);
+ removeAllPopovers();
+ var signpostPopover = safari.extension.createPopover("SignpostPlaced", safari.extension.baseURI + "popovers/SignpostPlaced.html",250, 185);
+ _displayPopover.popover = signpostPopover;
+ _displayPopover.showPopover();
+ //window.NovaInitia.Toolbar.place_signpost(signpost_panel_popup_title,signpost_panel_popup_comment,signpost_panel_popup_nsfw);
}
//handle doorways
if (which == "nova_initia_tool_doorway") {
- var doorway_popup_panel_URL = prompt("URL:","");
- var doorway_popup_panel_hint = prompt("Hint:","");
- var doorway_popup_panel_comment = prompt("Comment:", "");
- var doorway_popup_panel_nsfw = false;
- window.NovaInitia.Toolbar.open_doorway(doorway_popup_panel_URL, doorway_popup_panel_hint, doorway_popup_panel_comment, doorway_popup_panel_nsfw);
+ removeAllPopovers();
+ var doorwayPopover = safari.extension.createPopover("DoorwayPlaced", safari.extension.baseURI + "popovers/DoorwayPlaced.html",244,230);
+ _displayPopover.popover = doorwayPopover;
+ _displayPopover.showPopover();
+ //window.NovaInitia.Toolbar.open_doorway(doorway_popup_panel_URL, doorway_popup_panel_hint, doorway_popup_panel_comment, doorway_popup_panel_nsfw);
}
@@ -0,0 +1,102 @@
+<html>
+<head>
+ <style type="text/css">
+ body
+ {
+ background-image: url("../images/overlays/paper.png");
+ }
+ input[type="text"]
+ {
+ width: 160px;
+ }
+ </style>
+
+ <script type="text/javascript" src="../javascript/jquery-1.7.2.js"></script>
+ <script type="text/javascript" src="../javascript/Main.js"></script>
+
+
+ <script type="text/javascript">
+ const myBars = safari.extension.bars;
+ var barWindow = null;
+ //set the barWindow to our novaInitiaBar
+ for (var i = 0; i < myBars.length; ++i)
+ {
+ if(myBars[i].identifier == "")
+ {
+ barWindow = myBars[i].contentWindow;
+ }
+ }
+
+ var _displayPopover;
+ for(var i=0; i<safari.extension.toolbarItems.length; i++)
+ {
+ var item = safari.extension.toolbarItems[i];
+ if(item.identifier == "PopoverButton") _displayPopover = item;
+ }
+
+ function hidePopover()
+ {
+ for(var i=0;i<safari.extension.popovers.length;i++)
+ {
+ if(safari.extension.popovers[i].identifier == "DoorwayPlaced")
+ {
+ safari.extension.popovers[i].hide();
+ break;
+ }
+ }
+ }
+
+ function dismiss()
+ {
+ $("body").hide();
+ hidePopover;
+ }
+
+ function setDoor()
+ {
+ barWindow.placeDoor(
+ var doorway_popup_panel_URL = $("#url").val();
+ var doorway_popup_panel_hint = $("#hint").val();
+ var doorway_popup_panel_comment = $("#comment").val();
+ var doorway_popup_panel_nsfw = $("#nsfw").is(":checked");
+ window.NovaInitia.Toolbar.open_doorway(doorway_popup_panel_URL, doorway_popup_panel_hint, doorway_popup_panel_comment, doorway_popup_panel_nsfw);
+
+ );
+
+ $("form").hide();
+ //barWindow.animatePopover(null, 100);
+ }
+ </script>
+</head>
+<h3><center>Open a Doorway<center></h3>
+<body>
+<form action="setDoor()">
+ <table>
+ <tr>
+ <td>URL:</td>
+ <td><input id="url" type="text" value="http://www.nova-initia.com"></input></td>
+ </tr>
+ <tr>
+ <td>Hint:</td>
+ <td><input id="hint" type="text"></input></td>
+ </tr>
+ <tr>
+ <td style="vertical-align:top;">Comment:</td>
+ <td><textarea id="comment" style="width:160px;"></textarea></td>
+ </tr>
+ <tr>
+ <td style="text-align:right;">
+ <input type="checkbox" disabled="disabled"></input><br />
+ <input type="checkbox" id="nsfw"></input>
+ </td>
+ <td>Add to Existing Chain<br />NSFW?</td>
+ </tr>
+ <tr>
+ <td colspan="2" style="text-align: center;">
+ <input type="button" value="Open Doorway" onclick="setDoor()" />
+ <input type="reset" value="Cancel" onclick="dismiss()" />
+ </td>
+ </tr>
+ </table>
+</form>
+</body>
@@ -0,0 +1,89 @@
+<html>
+<head>
+ <style type="text/css">
+ body
+ {
+ background-image: url("../images/overlays/paper.png");
+ }
+ input[type="text"]
+ {
+ width: 150px;
+ }
+ textarea
+ {
+ width:150px;
+ }
+ </style>
+
+ <script type="text/javascript" src="../javascript/jquery-1.7.2.js"></script>
+ <script type="text/javascript" src="../javascript/Main.js"></script>
+
+ <script type="text/javascript">
+ const myBars = safari.extension.bars;
+ var barWindow = null;
+ //set the barWindow to our novaInitiaBar
+ for (var i = 0; i < myBars.length; ++i)
+ {
+ if(myBars[i].identifier == "novaInitiaBar")
+ {
+ barWindow = myBars[i].contentWindow;
+ }
+ }
+ // //get ni_button
+ // var ni_button;
+ // for(var i=0; i<safari.extension.toolbarItems.length; i++)
+ // {
+ // var item = safari.extension.toolbarItems[i];
+ // if(item.identifier == "nova-initia-button") ni_button = item;
+ // }
+
+ function dismiss()
+ {
+ for(var i=0;i<safari.extension.popovers.length;i++)
+ {
+ if(safari.extension.popovers[i].identifier == "placeSign")
+ {
+ safari.extension.popovers[i].hide();
+ break;
+ }
+ }
+ }
+ function setSign()
+ {
+ barWindow.placeSign(
+ $("#title").val(),
+ $("#comments").val(),
+ $("#nsfw").is(":checked")
+ );
+
+ $("form").hide();
+ barWindow.animatePopover(null, 100);
+ }
+ </script>
+</head>
+<h3>Place a Signpost</h3>
+<body>
+<form action="setSign()">
+ <table>
+ <tr>
+ <td>Title:</td>
+ <td><input type="text" id="title"></input></td>
+ </tr>
+ <tr>
+ <td style="vertical-align:top;">Comments:</td>
+ <td><textarea id="comments"></textarea></td>
+ </tr>
+ <tr>
+ <td>NSFW?</td>
+ <td><input type="checkbox" id="nsfw"></input></td>
+
+ </tr>
+ <tr>
+ <td colspan="2" style="text-align: center;">
+ <input type="button" value="Place Signpost" onclick="setSign()" />
+ <input type="reset" value="Cancel" onclick="dismiss()" />
+ </td>
+ </tr>
+ </table>
+</form>
+</body>
@@ -38,7 +38,7 @@
{
for(var i=0;i<safari.extension.popovers.length;i++)
{
- if(safari.extension.popovers[i].identifier == "placeBarrel")
+ if(safari.extension.popovers[i].identifier == "StashBarrel")
{
safari.extension.popovers[i].hide();
break;

0 comments on commit a81c851

Please sign in to comment.