ソースを参照

Add a config option to by default show the controlbox

JC Brand 12 年 前
コミット
9b5c9138fb
4 ファイル変更28 行追加8 行削除
  1. 8 3
      converse.js
  2. 14 0
      docs/source/index.rst
  3. 5 5
      index.html
  4. 1 0
      main.js

+ 8 - 3
converse.js

@@ -78,16 +78,18 @@
     var converse = {};
     converse.initialize = function (settings) {
         // Default values
-        this.bosh_service_url = ''; // The BOSH connection manager URL. Required if you are not prebinding.
         this.animate = true;
         this.auto_list_rooms = false;
         this.auto_subscribe = false;
+        this.bosh_service_url = ''; // The BOSH connection manager URL. Required if you are not prebinding.
         this.hide_muc_server = false;
+        this.i18n = locales.en;
         this.prebind = false;
+        this.show_controlbox_by_default = false;
         this.xhr_user_search = false;
-        this.i18n = locales.en;
         _.extend(this, settings);
 
+
         var __ = function (str) {
             var t = converse.i18n.translate(str);
             if (arguments.length>1) {
@@ -2670,12 +2672,15 @@
         // This is the end of the initialize method.
         this.chatboxes = new this.ChatBoxes();
         this.chatboxesview = new this.ChatBoxesView({model: this.chatboxes});
-        $('a.toggle-online-users').bind(
+        $('toggle-online-users').bind(
             'click',
             $.proxy(function (e) {
                 e.preventDefault(); this.toggleControlBox();
             }, this)
         );
+        if (this.show_controlbox_by_default) {
+            this.toggleControlBox();
+        }
     };
     return converse;
 }));

+ 14 - 0
docs/source/index.rst

@@ -246,6 +246,20 @@ have to write a Javascript snippet to attach to the set up connection::
 The backend must authenticate for you, and then return a SID (session ID) and
 RID (Request ID), which you use when you attach to the connection.
 
+show_controlbox_by_default
+--------------------------
+
+Default = False
+
+The "controlbox" refers to the special chatbox containing your contacts roster,
+status widget, chatrooms and other controls.
+
+By default this box is hidden and can be toggled by clicking on any element in
+the page with class *toggle-online-users*.
+
+If this options is set to true, the controlbox will by default be shown upon
+page load.
+
 
 xhr_user_search
 ---------------

+ 5 - 5
index.html

@@ -5,9 +5,9 @@
     <meta http-equiv="X-UA-Compatible" content="chrome=1" />
     <meta name="description" content="Converse.js: Open Source Browser-Based Instant Messaging" />
     <link rel="stylesheet" type="text/css" media="screen" href="stylesheets/stylesheet.css">
-    <link rel="stylesheet" type="text/css" media="screen" href="converse.min.css">
-    <script src="converse.min.js"></script>
-    <!-- For development: <script data-main="main" src="Libraries/require-jquery.js"></script> -->
+    <link rel="stylesheet" type="text/css" media="screen" href="converse.css">
+    <!-- <script src="converse.min.js"></script> -->
+    <script data-main="main" src="Libraries/require-jquery.js"></script>
     <title>Converse.js</title>
 </head>
 
@@ -17,7 +17,7 @@
     <header class="inner">
         <a id="forkme_banner" href="https://github.com/jcbrand/converse.js">View on GitHub</a>
         <h1 id="project_title"><a href="http://conversejs.org">Converse.js</a></h1>
-        <h2 id="project_tagline">An XMPP chat client written in Javascript</h2>
+        <h2 id="project_tagline">An XMPP chat client for your website</h2>
         <section id="downloads">
             <a class="zip_download_link" href="https://github.com/jcbrand/converse.js/archive/v0.3.zip">Download the latest release as a .zip file</a>
             <a class="tar_download_link" href="https://github.com/jcbrand/converse.js/archive/v0.3.tar.gz">Download the latest release as a tar.gz file</a>
@@ -158,7 +158,7 @@
     <div id="collective-xmpp-chat-data"></div>
     <div id="toggle-controlbox">
         <a href="#" class="chat toggle-online-users">
-            <strong class="conn-feedback">Click here to chat</strong> <strong style="display: none" id="online-count">(0)</strong>
+            <strong class="conn-feedback">Toggle chat</strong> <strong style="display: none" id="online-count">(0)</strong>
         </a>
     </div>
 </div>

+ 1 - 0
main.js

@@ -8,6 +8,7 @@ require(["jquery", "converse"], function($, converse) {
         hide_muc_server: false,
         i18n: locales.en, // Refer to ./locale/locales.js to see which locales are supported
         prebind: false,
+        show_controlbox_by_default: true,
         xhr_user_search: false
     });
 });