Merge branch 'master' of ssh://git.indexdata.com/home/git/pub/mkws
authorMike Taylor <mike@indexdata.com>
Mon, 13 Oct 2014 16:02:20 +0000 (17:02 +0100)
committerMike Taylor <mike@indexdata.com>
Mon, 13 Oct 2014 16:02:20 +0000 (17:02 +0100)
doc/mkws-manual.markdown
src/mkws-widget-main.templates/Ranking.handlebars
test/phantom/screenshot.js

index ac8ea6f..c1290b3 100644 (file)
@@ -62,12 +62,11 @@ The following is a complete MKWS-based searching application:
       </body>
     </html>
 
-Go ahead, try it! You don't even need a web-server. Just copy and
-paste this HTML into a file on your computer -- `/tmp/magic.html`,
-say -- and point your web-browser at it:
-`file:///tmp/magic.html`. Just like that, you have working
-metasearching.
-
+Go ahead, try it! Simply put the above in a file (e.g index.html),
+drop it into a folder accessible with an ordinary web-server (e.g Apache)
+and load it in your web browser (and no, usually, you can't just load the file
+directly from disk as some browsers, e.g Chrome, won't allow storing cookies).
+Just like that, you have working metasearching.
 
 How the example works
 ---------------------
index b651957..1c823bb 100644 (file)
@@ -36,7 +36,7 @@ perPage
         {{/if}}
       {{/each}}  
     </select>
-    {{{mkws-translate "per page."}}}
+    {{{mkws-translate "per page"}}}
   {{~/if~}}
 </form>
 
index 40f9937..5bec386 100644 (file)
@@ -5,11 +5,23 @@ var url = system.args[1] || 'http://www.indexdata.com/';
 var file_png = system.args[2] || 'indexdata.png';
 var timeout = system.args[5] ? system.args[5] : 0.2;
 
-if (system.args.length === 1) {
-    console.log('Usage: screenshot.js <some URL> <file.png>');
+function usage (message) {
+    if (message) {
+        console.log(message + "\n");
+    }
+    console.log('Usage: screenshot.js <some URL> <file.png> <width px> <height px> <timeout sec>');
     phantom.exit();
 }
 
+if (system.args.length === 1) {
+    usage();
+}
+
+if (!file_png.match(/\.png$/)) {
+    usage("File name has no .png extension: '" + file_png + "'");
+}
+
+
 // page.zoomFactor = 1.0;
 page.viewportSize = {
     width: system.args[3] ? system.args[3] : 1200,
@@ -28,3 +40,5 @@ page.open(url, function () {
         phantom.exit();
     }, timeout * 1000);
 });
+
+// EOF