Remove individual settings in `pad2.js` from global.
This commit is contained in:
parent
50d304022d
commit
0f7e6feda1
|
@ -23,12 +23,14 @@
|
|||
/* global $, window */
|
||||
|
||||
var socket;
|
||||
var LineNumbersDisabled = false;
|
||||
var noColors = false;
|
||||
var useMonospaceFontGlobal = false;
|
||||
var globalUserName = false;
|
||||
var hideQRCode = false;
|
||||
var rtlIsTrue = false;
|
||||
|
||||
var settings = {};
|
||||
settings.LineNumbersDisabled = false;
|
||||
settings.noColors = false;
|
||||
settings.useMonospaceFontGlobal = false;
|
||||
settings.globalUserName = false;
|
||||
settings.hideQRCode = false;
|
||||
settings.rtlIsTrue = false;
|
||||
|
||||
$(document).ready(function()
|
||||
{
|
||||
|
@ -101,7 +103,7 @@ function getParams()
|
|||
{
|
||||
if(IsnoColors == "true")
|
||||
{
|
||||
noColors = true;
|
||||
settings.noColors = true;
|
||||
$('#clearAuthorship').hide();
|
||||
}
|
||||
}
|
||||
|
@ -124,20 +126,20 @@ function getParams()
|
|||
{
|
||||
if(showLineNumbers == "false")
|
||||
{
|
||||
LineNumbersDisabled = true;
|
||||
settings.LineNumbersDisabled = true;
|
||||
}
|
||||
}
|
||||
if(useMonospaceFont)
|
||||
{
|
||||
if(useMonospaceFont == "true")
|
||||
{
|
||||
useMonospaceFontGlobal = true;
|
||||
settings.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.
|
||||
globalUserName = unescape(userName);
|
||||
settings.globalUserName = unescape(userName);
|
||||
}
|
||||
if(hideQRCode)
|
||||
{
|
||||
|
@ -147,7 +149,7 @@ function getParams()
|
|||
{
|
||||
if(rtl == "true")
|
||||
{
|
||||
rtlIsTrue = true
|
||||
settings.rtlIsTrue = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -298,33 +300,33 @@ function handshake()
|
|||
initalized = true;
|
||||
|
||||
// If the LineNumbersDisabled value is set to true then we need to hide the Line Numbers
|
||||
if (LineNumbersDisabled == true)
|
||||
if (settings.LineNumbersDisabled == true)
|
||||
{
|
||||
pad.changeViewOption('showLineNumbers', false);
|
||||
}
|
||||
|
||||
// If the noColors value is set to true then we need to hide the backround colors on the ace spans
|
||||
if (noColors == true)
|
||||
if (settings.noColors == true)
|
||||
{
|
||||
pad.changeViewOption('noColors', true);
|
||||
}
|
||||
|
||||
if (rtlIsTrue == true)
|
||||
if (settings.rtlIsTrue == true)
|
||||
{
|
||||
pad.changeViewOption('rtl', true);
|
||||
}
|
||||
|
||||
// If the Monospacefont value is set to true then change it to monospace.
|
||||
if (useMonospaceFontGlobal == true)
|
||||
if (settings.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)
|
||||
if (settings.globalUserName !== false)
|
||||
{
|
||||
pad.notifyChangeName(globalUserName); // Notifies the server
|
||||
pad.myUserInfo.name = globalUserName;
|
||||
$('#myusernameedit').attr({"value":globalUserName}); // Updates the current users UI
|
||||
pad.notifyChangeName(settings.globalUserName); // Notifies the server
|
||||
pad.myUserInfo.name = settings.globalUserName;
|
||||
$('#myusernameedit').attr({"value":settings.globalUserName}); // Updates the current users UI
|
||||
}
|
||||
}
|
||||
//This handles every Message after the clientVars
|
||||
|
|
|
@ -68,7 +68,7 @@ var padeditor = (function()
|
|||
pad.changeViewOption('useMonospaceFont', $("#viewfontmenu").val() == 'monospace');
|
||||
});
|
||||
|
||||
noColors = !noColors; // Inversed so we can pass it to showauthorcolors
|
||||
settings.noColors = !settings.noColors; // Inversed so we can pass it to showauthorcolors
|
||||
},
|
||||
setViewOptions: function(newOptions)
|
||||
{
|
||||
|
@ -93,9 +93,9 @@ var padeditor = (function()
|
|||
self.ace.setProperty("textface", (v ? "monospace" : "Arial, sans-serif"));
|
||||
$("#viewfontmenu").val(v ? "monospace" : "normal");
|
||||
|
||||
self.ace.setProperty("showsauthorcolors", noColors);
|
||||
self.ace.setProperty("showsauthorcolors", settings.noColors);
|
||||
|
||||
self.ace.setProperty("rtlIsTrue", rtlIsTrue);
|
||||
self.ace.setProperty("rtlIsTrue", settings.rtlIsTrue);
|
||||
},
|
||||
initViewZoom: function()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue