From 008aa90756b4262ae5785bebd1da802556e66997 Mon Sep 17 00:00:00 2001 From: Amit Gupta Date: Thu, 17 May 2018 19:59:00 +0530 Subject: [PATCH] Copy paste pattern - show snakebar when weighted pattern is copied to card with different weight - copy button : to copy single card pattern without weight - Shit+copy button : to copy multiple card pattern with weight - paste button to apply selected patterns - --- index.html | 1 + static/css/snackbar.css | 46 ++++++++ static/js/app.js | 14 ++- tags/decktemplate.tag | 183 ++++++++++++++++++++++++++------ tags/review.tag | 54 +++------- tags/tags.js | 225 +++++++++++++++++++++++++++------------- 6 files changed, 372 insertions(+), 151 deletions(-) create mode 100644 static/css/snackbar.css diff --git a/index.html b/index.html index 2d6f307..d7e0ab7 100644 --- a/index.html +++ b/index.html @@ -20,6 +20,7 @@ + diff --git a/static/css/snackbar.css b/static/css/snackbar.css new file mode 100644 index 0000000..123ae7b --- /dev/null +++ b/static/css/snackbar.css @@ -0,0 +1,46 @@ +/* The snackbar - position it at the bottom and in the middle of the screen */ +#snackbar { + visibility: hidden; /* Hidden by default. Visible on click */ + min-width: 250px; /* Set a default minimum width */ + margin-left: -125px; /* Divide value of min-width by 2 */ + background-color: #333; /* Black background color */ + color: #fff; /* White text color */ + text-align: center; /* Centered text */ + border-radius: 2px; /* Rounded borders */ + padding: 16px; /* Padding */ + position: fixed; /* Sit on top of the screen */ + z-index: 1; /* Add a z-index if needed */ + left: 50%; /* Center the snackbar */ + bottom: 30px; /* 30px from the bottom */ +} + +/* Show the snackbar when clicking on a button (class added with JavaScript) */ +#snackbar.show { + visibility: visible; /* Show the snackbar */ + +/* Add animation: Take 0.5 seconds to fade in and out the snackbar. +However, delay the fade out process for 2.5 seconds */ + -webkit-animation: fadein 0.5s, fadeout 0.5s 2.5s; + animation: fadein 0.5s, fadeout 0.5s 2.5s; +} + +/* Animations to fade the snackbar in and out */ +@-webkit-keyframes fadein { + from {bottom: 0; opacity: 0;} + to {bottom: 30px; opacity: 1;} +} + +@keyframes fadein { + from {bottom: 0; opacity: 0;} + to {bottom: 30px; opacity: 1;} +} + +@-webkit-keyframes fadeout { + from {bottom: 30px; opacity: 1;} + to {bottom: 0; opacity: 0;} +} + +@keyframes fadeout { + from {bottom: 30px; opacity: 1;} + to {bottom: 0; opacity: 0;} +} \ No newline at end of file diff --git a/static/js/app.js b/static/js/app.js index 6c27148..53e87db 100644 --- a/static/js/app.js +++ b/static/js/app.js @@ -70,19 +70,23 @@ function rotateSymbolsRandomly(elements){ * @param {boolean} maintainRatio * @param {*} desiredSize : desired size whould be bigger for big cards, small for small cards */ -function resizeSymbolsRandomly(elements, maintainRatio, desiredSize){ +function resizeSymbolsRandomly(elements, randomEnable, maintainRatio, desiredSize){ elements.each(function(){ var originalSize = { width : $(this).attr("w"), height : $(this).attr("h") } - var size = transformSize(originalSize,true,maintainRatio, desiredSize); + var size = transformSize(originalSize,randomEnable,maintainRatio, desiredSize); //$(this).width(size.width).height(size.height); - $(this).css({width: size.width, height : size.height }); - $(this).find(".ui-wrapper").css({width: size.width, height : size.height }); - $(this).find(".ui-wrapper img").css({width: size.width, height : size.height }); + resizeSymbol($(this), size); }); } + +function resizeSymbol(symbol,size){ + $(symbol).css({width: size.width, height : size.height }); + $(symbol).find(".ui-wrapper").css({width: size.width, height : size.height }); + $(symbol).find(".ui-wrapper img").css({width: size.width, height : size.height }); +} /* calculate new width and height for a symbol on the basis of original size. Maintains ratio if selected diff --git a/tags/decktemplate.tag b/tags/decktemplate.tag index b49c316..fbb3dff 100644 --- a/tags/decktemplate.tag +++ b/tags/decktemplate.tag @@ -17,8 +17,8 @@ - - + +