Add support for removing line numbers using the jQuery API and stopped it publishing that change back if the param is set

pull/85/merge
John McLear 2011-08-13 18:37:44 +01:00
parent fb593c1d5c
commit 8db0c12bbe
1 changed files with 27 additions and 10 deletions

View File

@ -17,6 +17,7 @@
/* global $, window */ /* global $, window */
var socket; var socket;
var LineNumbersDisabled = false;
$(document).ready(function() $(document).ready(function()
{ {
@ -74,6 +75,7 @@ function getParams()
var showControls = getUrlVars()["showControls"]; var showControls = getUrlVars()["showControls"];
var showChat = getUrlVars()["showChat"]; var showChat = getUrlVars()["showChat"];
var userName = getUrlVars()["userName"]; var userName = getUrlVars()["userName"];
var showLineNumbers = getUrlVars()["showLineNumbers"];
if(showControls) if(showControls)
{ {
if(showControls == "false") if(showControls == "false")
@ -85,11 +87,20 @@ function getParams()
if(showChat) if(showChat)
{ {
if(showChat == "false"){$('#chaticon').hide();} if(showChat == "false")
{
//cake $('#chaticon').hide();
}
} }
if(showLineNumbers)
{
if(showLineNumbers == "false")
{
// pad.changeViewOption('showLineNumbers', false);
LineNumbersDisabled = true;
}
}
} }
function getUrlVars() function getUrlVars()
@ -138,7 +149,6 @@ function handshake()
"token": token, "token": token,
"protocolVersion": 2 "protocolVersion": 2
}; };
socket.json.send(msg); socket.json.send(msg);
}); });
@ -159,8 +169,12 @@ function handshake()
clientVars.collab_client_vars.clientAgent = "Anonymous"; clientVars.collab_client_vars.clientAgent = "Anonymous";
pad.init(); pad.init();
initalized = true; initalized = true;
if (LineNumbersDisabled == true)
{
// cake
pad.changeViewOption('showLineNumbers', false); $
}
} }
//This handles every Message after the clientVars //This handles every Message after the clientVars
else else
@ -374,12 +388,15 @@ var pad = {
}; };
options.view[key] = value; options.view[key] = value;
pad.handleOptionsChange(options); pad.handleOptionsChange(options);
pad.collabClient.sendClientMessage( if (key != "showLineNumbers")
{ {
type: 'padoptions', pad.collabClient.sendClientMessage(
options: options, {
changedBy: pad.myUserInfo.name || "unnamed" type: 'padoptions',
}); options: options,
changedBy: pad.myUserInfo.name || "unnamed"
});
}
}, },
handleOptionsChange: function(opts) handleOptionsChange: function(opts)
{ {