WIP refacto
This commit is contained in:
parent
324cd85a02
commit
c71306264b
11 changed files with 2146 additions and 1632 deletions
|
@ -1,8 +1,6 @@
|
|||
.card {
|
||||
width: 230px;
|
||||
height: 152px;
|
||||
xpadding: 5px; float: left;
|
||||
xmargin: 0 10px 10px 0;
|
||||
font-size: .9em;
|
||||
|
||||
|
||||
|
@ -32,7 +30,6 @@
|
|||
|
||||
.card-image {
|
||||
position: absolute;
|
||||
xtop: -10;
|
||||
left: -3px;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
|
1349
client/css/style.css
1349
client/css/style.css
File diff suppressed because it is too large
Load diff
150
client/script.js
150
client/script.js
|
@ -47,7 +47,7 @@ socket.on("connect", function () {
|
|||
|
||||
socket.on("disconnect", function () {
|
||||
blockUI("Serveur déconnecté. Veuillez rafraîchir la page pour essayer de vous reconnecter…")
|
||||
//$('.blockOverlay').click($.unblockUI);
|
||||
//$('.blockOverlay').on('click', $.unblockUI);
|
||||
})
|
||||
|
||||
socket.on("message", function (data) {
|
||||
|
@ -189,7 +189,7 @@ function getMessage(m) {
|
|||
}
|
||||
}
|
||||
|
||||
$(document).bind("keyup", function (event) {
|
||||
$(document).on("keyup", function (event) {
|
||||
keyTrap = event.which
|
||||
})
|
||||
|
||||
|
@ -229,7 +229,7 @@ function drawNewCard(id, text, x, y, rot, colour, sticker, animationspeed) {
|
|||
//we click on a card
|
||||
//The following doesn't work so we will do the bug
|
||||
//fix recommended in the above bug report
|
||||
// card.click( function() {
|
||||
// card.on('click', function() {
|
||||
// $(this).focus();
|
||||
// } );
|
||||
|
||||
|
@ -251,7 +251,7 @@ function drawNewCard(id, text, x, y, rot, colour, sticker, animationspeed) {
|
|||
})
|
||||
|
||||
//After a drag:
|
||||
card.bind("dragstop", function (event, ui) {
|
||||
card.on("dragstop", function (event, ui) {
|
||||
if (keyTrap == 27) {
|
||||
keyTrap = null
|
||||
return
|
||||
|
@ -323,7 +323,7 @@ function drawNewCard(id, text, x, y, rot, colour, sticker, animationspeed) {
|
|||
}
|
||||
)
|
||||
|
||||
card.children(".delete-card-icon").click(function () {
|
||||
card.children(".delete-card-icon").on("click", function () {
|
||||
$("#" + id).remove()
|
||||
//notify server of delete
|
||||
sendAction("deleteCard", {
|
||||
|
@ -415,11 +415,6 @@ function createCard(id, text, x, y, rot, colour) {
|
|||
}
|
||||
|
||||
function randomCardColour() {
|
||||
var choosed = $("#choose-card-color").val()
|
||||
if (choosed !== "random") {
|
||||
return choosed
|
||||
}
|
||||
|
||||
var colours = ["yellow", "green", "blue", "white"]
|
||||
|
||||
var i = Math.floor(Math.random() * colours.length)
|
||||
|
@ -726,16 +721,14 @@ function download(filename, text) {
|
|||
|
||||
element.style.display = "none"
|
||||
document.body.appendChild(element)
|
||||
|
||||
element.click()
|
||||
|
||||
document.body.removeChild(element)
|
||||
}
|
||||
|
||||
function addRevision(timestamp) {
|
||||
var li = $('<li id="revision-' + timestamp + '"></li>')
|
||||
var s1 = $("<span></span>")
|
||||
var s2 = $('<img src="../images/stickers/sticker-deletestar.png" alt="delete revision">')
|
||||
var s2 = $('<img src="/images/stickers/sticker-deletestar.png" alt="delete revision">')
|
||||
if (typeof timestamp === "string") {
|
||||
timestamp = parseInt(timestamp)
|
||||
}
|
||||
|
@ -745,13 +738,13 @@ function addRevision(timestamp) {
|
|||
li.append(s2)
|
||||
$("#revisions-list").append(li)
|
||||
|
||||
s1.click(function () {
|
||||
$('body').on("click", s1, function () {
|
||||
socket.json.send({
|
||||
action: "exportRevision",
|
||||
data: timestamp,
|
||||
})
|
||||
})
|
||||
s2.click(function () {
|
||||
$('body').on("click", s2, function () {
|
||||
socket.json.send({
|
||||
action: "deleteRevision",
|
||||
data: timestamp,
|
||||
|
@ -770,39 +763,29 @@ $(function () {
|
|||
|
||||
//setTimeout($.unblockUI, 2000);
|
||||
|
||||
$("#create-card").click(function () {
|
||||
$(".add-post-it").on("click", function () {
|
||||
var rotation = Math.random() * 10 - 5 //add a bit of random rotation (+/- 10deg)
|
||||
uniqueID = Math.round(Math.random() * 99999999) //is this big enough to assure uniqueness?
|
||||
var cardLeft = 150 + Math.random() * 400
|
||||
var cardTop = 20 + Math.random() * 50
|
||||
var uniqueID = Math.round(Math.random() * 99999999) //is this big enough to assure uniqueness?
|
||||
//alert(uniqueID);
|
||||
createCard(
|
||||
"card" + uniqueID,
|
||||
"",
|
||||
58,
|
||||
$("div.board-outline").height(), // hack - not a great way to get the new card coordinates, but most consistant ATM
|
||||
rotation,
|
||||
randomCardColour()
|
||||
)
|
||||
createCard("card" + uniqueID, "", cardLeft, cardTop, rotation, $(this).data("color"))
|
||||
})
|
||||
|
||||
// Style changer
|
||||
$("#smallify").click(function () {
|
||||
$("#smallify").on("click", function () {
|
||||
if (currentTheme == "bigcards") {
|
||||
changeThemeTo("smallcards")
|
||||
} else if (currentTheme == "smallcards") {
|
||||
changeThemeTo("bigcards")
|
||||
}
|
||||
/*else if (currentTheme == "nocards")
|
||||
{
|
||||
currentTheme = "bigcards";
|
||||
$("link[title=cardsize]").attr("href", "css/bigcards.css");
|
||||
}*/
|
||||
|
||||
sendAction("changeTheme", currentTheme)
|
||||
|
||||
return false
|
||||
})
|
||||
|
||||
$("#icon-col").hover(
|
||||
$("#icon-col").on(
|
||||
"hover",
|
||||
function () {
|
||||
$(".col-icon").fadeIn(10)
|
||||
},
|
||||
|
@ -811,29 +794,19 @@ $(function () {
|
|||
}
|
||||
)
|
||||
|
||||
$("#add-col").click(function () {
|
||||
$("#add-col").on("click", function () {
|
||||
createColumn("Nouveau")
|
||||
return false
|
||||
})
|
||||
|
||||
$("#delete-col").click(function () {
|
||||
$("#delete-col").on("click", function () {
|
||||
deleteColumn()
|
||||
return false
|
||||
})
|
||||
|
||||
// $('#cog-button').click( function(){
|
||||
// $('#config-dropdown').fadeToggle();
|
||||
// } );
|
||||
|
||||
// $('#config-dropdown').hover(
|
||||
// function(){ /*$('#config-dropdown').fadeIn()*/ },
|
||||
// function(){ $('#config-dropdown').fadeOut() }
|
||||
// );
|
||||
//
|
||||
|
||||
var user_name = getCookie("scrumscrum-username")
|
||||
|
||||
$("#yourname-input").focus(function () {
|
||||
$("#yourname-input").on("focus", function () {
|
||||
if ($(this).val() == "anonyme") {
|
||||
$(this).val("")
|
||||
}
|
||||
|
@ -841,7 +814,7 @@ $(function () {
|
|||
$(this).addClass("focused")
|
||||
})
|
||||
|
||||
$("#yourname-input").blur(function () {
|
||||
$("#yourname-input").on("blur", function () {
|
||||
if ($(this).val() === "") {
|
||||
$(this).val("anonyme")
|
||||
}
|
||||
|
@ -851,14 +824,14 @@ $(function () {
|
|||
})
|
||||
|
||||
$("#yourname-input").val(user_name)
|
||||
$("#yourname-input").blur()
|
||||
$("#yourname-input").trigger("blur")
|
||||
|
||||
$("#yourname-li").hide()
|
||||
|
||||
$("#yourname-input").keypress(function (e) {
|
||||
$("#yourname-input").on("keypress", function (e) {
|
||||
code = e.keyCode ? e.keyCode : e.which
|
||||
if (code == 10 || code == 13) {
|
||||
$(this).blur()
|
||||
$(this).trigger("blur")
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -879,13 +852,13 @@ $(function () {
|
|||
;(function () {
|
||||
var offsets
|
||||
|
||||
$(".board-outline").bind("resizestart", function () {
|
||||
$(".board-outline").on("resizestart", function () {
|
||||
offsets = calcCardOffset()
|
||||
})
|
||||
$(".board-outline").bind("resize", function (event, ui) {
|
||||
$(".board-outline").on("resize", function (event, ui) {
|
||||
adjustCard(offsets, false)
|
||||
})
|
||||
$(".board-outline").bind("resizestop", function (event, ui) {
|
||||
$(".board-outline").on("resizestop", function (event, ui) {
|
||||
boardResizeHappened(event, ui)
|
||||
adjustCard(offsets, true)
|
||||
})
|
||||
|
@ -901,7 +874,7 @@ $(function () {
|
|||
containment: "parent",
|
||||
})
|
||||
|
||||
$("#export-txt").click(function () {
|
||||
$("#export-txt").on("click", function () {
|
||||
$('.nav-tabs a[href="#scrumblr"]').tab("show")
|
||||
socket.json.send({
|
||||
action: "exportTxt",
|
||||
|
@ -909,7 +882,7 @@ $(function () {
|
|||
})
|
||||
})
|
||||
|
||||
$("#export-csv").click(function () {
|
||||
$("#export-csv").on("click", function () {
|
||||
$('.nav-tabs a[href="#scrumblr"]').tab("show")
|
||||
socket.json.send({
|
||||
action: "exportCsv",
|
||||
|
@ -917,7 +890,7 @@ $(function () {
|
|||
})
|
||||
})
|
||||
|
||||
$("#export-json").click(function () {
|
||||
$("#export-json").on("click", function () {
|
||||
socket.json.send({
|
||||
action: "exportJson",
|
||||
data: {
|
||||
|
@ -927,7 +900,7 @@ $(function () {
|
|||
})
|
||||
})
|
||||
|
||||
$("#import-file").click(function (evt) {
|
||||
$("#import-file").on("click", function (evt) {
|
||||
evt.stopPropagation()
|
||||
evt.preventDefault()
|
||||
|
||||
|
@ -943,7 +916,7 @@ $(function () {
|
|||
fr.readAsText(f)
|
||||
})
|
||||
|
||||
$("#create-revision").click(function () {
|
||||
$("#create-revision").on("click", function () {
|
||||
socket.json.send({
|
||||
action: "createRevision",
|
||||
data: {
|
||||
|
@ -1048,8 +1021,6 @@ $(document).ready(function () {
|
|||
}
|
||||
}, 500)
|
||||
|
||||
$(".names").css({ margin: "auto", width: "auto" }).addClass("pull-right")
|
||||
|
||||
$("#scrumblr")
|
||||
.append($(".names, .stickers, .buttons"))
|
||||
.after(
|
||||
|
@ -1065,7 +1036,6 @@ $(document).ready(function () {
|
|||
$("#about").append($("#tuto-faq, #le-logiciel, #jardin"))
|
||||
|
||||
// Style
|
||||
$("#create-card").addClass("vert fa-3x").css("opacity", "1")
|
||||
$("#smallify").on("click", function () {
|
||||
if (currentTheme == "bigcards") {
|
||||
$(this).children("i").removeClass("fa-search-plus").addClass("fa-search-minus")
|
||||
|
@ -1091,9 +1061,11 @@ $(document).ready(function () {
|
|||
}
|
||||
|
||||
// put URL in share input
|
||||
$("#taburl").val(location)
|
||||
var mainurl = location.toString().split('#')[0]
|
||||
$(".replace-url").val(mainurl)
|
||||
$(".share-iframe").text($(".share-iframe").text().replace('{{replace-url}}', mainurl))
|
||||
// copy URL to clipboard
|
||||
$("#copyurl").click(function (e) {
|
||||
$("#copyurl").on("click", function (e) {
|
||||
e.preventDefault()
|
||||
var node = document.getElementById("taburl")
|
||||
node.disabled = null
|
||||
|
@ -1115,7 +1087,7 @@ $(document).ready(function () {
|
|||
//Close with Escape Button
|
||||
window.onkeydown = function (event) {
|
||||
if (event.keyCode === 27) {
|
||||
document.getElementById("close").click()
|
||||
document.getElementById("close").on("click")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1155,3 +1127,53 @@ $(function () {
|
|||
})
|
||||
}
|
||||
})
|
||||
|
||||
$(function () {
|
||||
// Toggle Nav on Click
|
||||
$(".toggle-nav").on("click", function () {
|
||||
var target = $(this).attr("href")
|
||||
if (target === '#') {
|
||||
target = false
|
||||
} else {
|
||||
history.replaceState('', '', target);
|
||||
}
|
||||
toggleNav(target)
|
||||
return false
|
||||
})
|
||||
// When nav opened, a click on the canvas hides the menu
|
||||
$("body").on("click", ".show-nav #site-canvas main", function () {
|
||||
toggleNav(false)
|
||||
return false
|
||||
})
|
||||
$(".backgrounds .bg").on("click", function () {
|
||||
if ($(this).hasClass("selected")) {
|
||||
$("body").css("background-image", "none")
|
||||
$(this).removeClass("selected")
|
||||
} else {
|
||||
$(".selected").removeClass("selected")
|
||||
$('.bgurl').val('')
|
||||
$("body").css("background-image", 'url("/' + $(this).attr("src") + '")')
|
||||
$(this).addClass("selected")
|
||||
}
|
||||
})
|
||||
$('.bgurl').on('change', function() {
|
||||
var url = $(this).val()
|
||||
if (url) {
|
||||
$(".selected").removeClass("selected")
|
||||
$("body").css("background-image", 'url("' + url + '")')
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
function toggleNav(target) {
|
||||
if ($("#site-wrapper").hasClass("show-nav") && target === false) {
|
||||
$("#site-wrapper").removeClass("show-nav")
|
||||
} else {
|
||||
$("#share, #settings").hide()
|
||||
if (target !== false) {
|
||||
$(target).show()
|
||||
}
|
||||
$("#site-wrapper").addClass("show-nav")
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue