OSDN Git Service

git-svn-id: https://svn.sourceforge.jp/svnroot/nucleus-jp/nucleus-jp/trunk@905 1ca29b...
[nucleus-jp/nucleus-jp-ancient.git] / utf8 / nucleus / javascript / bookmarklet.js
1 /**
2   * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/) 
3   * Copyright (C) 2002-2009 The Nucleus Group
4   *
5   * This program is free software; you can redistribute it and/or
6   * modify it under the terms of the GNU General Public License
7   * as published by the Free Software Foundation; either version 2
8   * of the License, or (at your option) any later version.
9   * (see nucleus/documentation/index.html#license for more info)
10   *  
11   * Some JavaScript code for the bookmarklets
12   *
13   * $Id: bookmarklet.js,v 1.5 2007-02-04 06:28:45 kimitake Exp $
14   * $NucleusJP: bookmarklet.js,v 1.4 2006/07/12 07:11:47 kimitake Exp $
15   */
16
17 /**
18  * On browsers that have DOM support, the non-visible tabs of the bookmarklet are 
19  * initially hidden. This is not defined in the CSS stylesheet since this causes 
20  * problems with Opera (which does not seem to be sending form data for input
21  * fields which are in a hidden block)
22  */
23 function initStyles() {
24         hideBlock('more');
25         hideBlock('options');
26         hideBlock('preview');
27         
28         // in browsers that do not support DOM (like opera), the buttons used
29         // to switch tabs are useless and can be hidden
30         document.getElementById('switchbuttons').style.display = 'inline';
31 }
32
33 /**
34  * To be called with id='body','more','options' or 'preview'
35  * Hides all other tabs and makes the chosen one visible
36  */
37 function flipBlock(id) {
38
39         showBlock(id);
40         
41         if (id != 'body')
42                 hideBlock('body');
43         if (id != 'more')
44                 hideBlock('more');
45         if (id != 'options')
46                 hideBlock('options');
47         if (id != 'preview')
48                 hideBlock('preview');           
49         
50 }
51
52 /**
53  * Hides one element (tab)
54  */
55 function hideBlock(id) {
56         document.getElementById(id).style.display = "none";
57 }
58
59 /**
60  * Makes an element (tab) visible
61  */
62 function showBlock(id) {
63         document.getElementById(id).style.display = "block";
64 }
65
66 function help(url) {
67         popup = window.open(url,'helpwindow','status=no,toolbar=yes,scrollbars=yes,resizable=yes,width=500,height=500,top=0,left=0');
68         if (popup.focus) popup.focus();
69         if (popup.GetAttention) popup.GetAttention();
70         return false;
71 }