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