Added support for monospace font to be passed as a parameter in the URL

This commit is contained in:
John McLear 2011-08-13 22:10:58 +01:00
parent 4b77dd8c7a
commit db3ee19ced

View file

@ -18,6 +18,7 @@
var socket;
var LineNumbersDisabled = false;
var useMonospaceFontGlobal = false;
var globalUserName = false;
$(document).ready(function()
@ -77,6 +78,7 @@ function getParams()
var showChat = getUrlVars()["showChat"];
var userName = getUrlVars()["userName"];
var showLineNumbers = getUrlVars()["showLineNumbers"];
var useMonospaceFont = getUrlVars()["useMonospaceFont"];
if(showControls)
{
if(showControls == "false")
@ -102,6 +104,15 @@ function getParams()
}
}
if(useMonospaceFont)
{
if(useMonospaceFont == "true")
{
useMonospaceFontGlobal = true;
}
}
if(userName)
{
// If the username is set as a parameter we should set a global value that we can call once we have initiated the pad.
@ -183,6 +194,12 @@ function handshake()
pad.changeViewOption('showLineNumbers', false);
}
// If the Monospacefont value is set to true then change it to monospace.
if (useMonospaceFontGlobal == true)
{
pad.changeViewOption('useMonospaceFont', true);
}
// if the globalUserName value is set we need to tell the server and the client about the new authorname
if (globalUserName !== false)
{
@ -403,7 +420,8 @@ var pad = {
};
options.view[key] = value;
pad.handleOptionsChange(options);
if (key != "showLineNumbers")
// if the request isn't to hide line numbers then broadcast this to other users
if (key != "showLineNumbers" && key != "useMonospaceFont")
{
pad.collabClient.sendClientMessage(
{