open popup window (again) on submit query
authorWolfram Schneider <wosch@indexdata.dk>
Thu, 10 Jul 2014 10:48:10 +0000 (10:48 +0000)
committerWolfram Schneider <wosch@indexdata.dk>
Thu, 10 Jul 2014 10:48:10 +0000 (10:48 +0000)
examples/htdocs/popup.html
src/mkws-popup.js

index fd96eb5..4213c01 100644 (file)
   <body>
     <h3>MKWS widgets in a popup window</h3>
 
-    <div class="mkwsCredo PopupWindow" popup_width="900" popup_height="700" popup_autoOpen="1" autosearch="!param!q">
-      mkwsCredo result will appear here
-    </div>
-
-    <div class="mkwsReference PopupWindow" popup_width="800" popup_height="500" popup_autoOpen="1" sentences="1" autosearch="!param!q">
-      mkwsReference result will appear here
-    </div>
-
-    <div class="PopupWindow" popup_width="1024" popup_height="650" popup_modal="0" popup_autoOpen="1">
+    <div class="mkwsSearch"></div>
+    <div class="PopupWindow" popup_width="1024" popup_height="650" popup_modal="0" popup_autoOpen="0" popup_button="input.mkwsButton">
       <div class="mkwsSwitch"></div>
-      <div class="mkwsSearch"></div>
       <div class="mkwsLang"></div>
       <div class="mkwsResults"></div>
       <div class="mkwsTargets"></div>
       <div class="mkwsStat"></div>
-    </div
+    </div>
+
+    <div class="mkwsCredo PopupWindow" popup_width="1024" popup_height="800" popup_autoOpen="1" autosearch="!param!q">
+      mkwsCredo result will appear here
+    </div>
+
+    <div class="mkwsReference PopupWindow" popup_width="700" popup_height="600" popup_autoOpen="1" sentences="1" autosearch="!param!q">
+      mkwsReference result will appear here
+    </div>
 
   </body>
 </html>
index 48b5059..275d541 100644 (file)
@@ -22,6 +22,7 @@ $(document).ready(function () {
         debug("found popup windows: " + popup_window.length);
     }
 
+    // more than one widget on a page are possible
     popup_window.each(function (i) {
         var that = $(this);
 
@@ -45,5 +46,13 @@ $(document).ready(function () {
             },
             close: function () {}
         });
+
+        // open at search query submit
+        var id_botton = that.attr("popup_button");
+        if (id_botton) {
+            $(id_botton).button().click(function () {
+                that.dialog("open");
+            });
+        }
     });
 });