Beautified html, sticky chat, dynamic inputs, beautified qr-code, fixed chat bug

This commit is contained in:
Robin 2012-01-26 17:22:44 +01:00
parent 622068183a
commit 57075d1545
8 changed files with 371 additions and 421 deletions

View file

@ -21,18 +21,17 @@
*/
var padutils = require('/pad_utils').padutils;
var browser = require('/ace2_common').browser;
var chat = (function()
{
var isStuck = false;
var bottomMargin = "0px";
var sDuration = 500;
var hDuration = 750;
var chatMentions = 0;
var title = document.title;
if ($.browser.mobile){
sDuration = 0;
hDuration = 0;
if (browser.mobile){
sDuration = hDuration = 0;
}
var self = {
show: function ()
@ -57,11 +56,12 @@ var chat = (function()
{
$("#focusprotector").hide();
if($.browser.mobile)
bottommargin = "32px";
$("#chatbox").css({right: "20px", bottom: bottomMargin, left: "", top: ""});
if(browser.mobile) {
$("#chatbox").css({right: "0px", bottom: "32px", left: "", top: ""});
} else {
$("#chatbox").css({right: "20px", bottom: "0px", left: "", top: ""});
}
self.scrollDown();
}
});
@ -73,18 +73,18 @@ var chat = (function()
{
console.log(isStuck);
chat.show();
if(!isStuck){ // Stick it to
$('#chatbox').css({"right":"0px", "top":"35px", "border-radius":"0px", "height":"auto"});
if(!isStuck) { // Stick it to
$('#chatbox').css({"right":"0px", "top":"36px", "border-radius":"0px", "height":"auto", "border-right":"none", "border-left":"1px solid #ccc", "border-top":"none", "background-color":"#f1f1f1"});
$('#chattext').css({"top":"0px"});
$('#editorcontainer').css({"right":"170px", "width":"auto"});
isStuck = true;
}
else{ // Unstick it
$('#chatbox').css({"right":"20px", "top":"auto", "border-top-left-radius":"5px", "border-top-right-radius":"5px", "height":"200px"});
} else { // Unstick it
$('#chatbox').css({"right":"20px", "top":"auto", "border-top-left-radius":"5px", "border-top-right-radius":"5px", "border-right":"1px solid #999", "height":"200px", "border-top":"1px solid #999", "background-color":"#f7f7f7"});
$('#chattext').css({"top":"25px"});
$('#editorcontainer').css({"right":"0px", "width":"100%"});
isStuck = false;
}
}
,
},
hide: function ()
{
$("#chatcounter").text("0");
@ -194,3 +194,4 @@ var chat = (function()
}());
exports.chat = chat;

View file

@ -108,17 +108,20 @@ var padeditbar = (function()
{
self.toogleDropDown("users");
}
else if (cmd == 'settings')
{
self.toogleDropDown("settingsmenu");
}
else if (cmd == 'embed')
{
self.setEmbedLinks();
$('#embedinput').focus().select();
$('#linkinput').focus().select();
self.toogleDropDown("embed");
}
else if (cmd == 'import_export')
{
self.toogleDropDown("importexport");
}
else if (cmd == 'save')
{
padsavedrevs.saveNow();
@ -165,7 +168,7 @@ var padeditbar = (function()
},
toogleDropDown: function(moduleName)
{
var modules = ["embed", "users", "readonly", "importexport"];
var modules = ["embed", "users", "readonly", "importexport", "settingsmenu"];
//hide all modules
if(moduleName == "none")

View file

@ -87,6 +87,11 @@ var padeditor = (function()
if (value == "false") return false;
return defaultValue;
}
self.ace.setProperty("showsauthorcolors", settings.noColors);
self.ace.setProperty("rtlIsTrue", settings.rtlIsTrue);
var v;
v = getOption('showLineNumbers', true);
@ -100,10 +105,6 @@ var padeditor = (function()
v = getOption('useMonospaceFont', false);
self.ace.setProperty("textface", (v ? "monospace" : "Arial, sans-serif"));
$("#viewfontmenu").val(v ? "monospace" : "normal");
self.ace.setProperty("showsauthorcolors", settings.noColors);
self.ace.setProperty("rtlIsTrue", settings.rtlIsTrue);
},
initViewZoom: function()
{

View file

@ -110,24 +110,6 @@ var padutils = {
var x = ua.split(' ')[0];
return clean(x);
},
// "func" is a function over 0..(numItems-1) that is monotonically
// "increasing" with index (false, then true). Finds the boundary
// between false and true, a number between 0 and numItems inclusive.
binarySearch: function(numItems, func)
{
if (numItems < 1) return 0;
if (func(0)) return 0;
if (!func(numItems - 1)) return numItems;
var low = 0; // func(low) is always false
var high = numItems - 1; // func(high) is always true
while ((high - low) > 1)
{
var x = Math.floor((low + high) / 2); // x != low, x != high
if (func(x)) high = x;
else low = x;
}
return high;
},
// e.g. "Thu Jun 18 2009 13:09"
simpleDateTime: function(date)
{
@ -489,4 +471,6 @@ window.onerror = function test (msg, url, linenumber)
return false;
};
padutils.binarySearch = require('/ace2_common').binarySearch;
exports.padutils = padutils;