]> iEval git - mindcoding-template-patches.git/blobdiff - js/scripts.js
Fix yardi logo for hopefully the last time
[mindcoding-template-patches.git] / js / scripts.js
index fc421abf857cb25aaf509066c3c696f606cf81e8..6e0827d502cbfd8f76c77e025bca4c824c0ed27c 100644 (file)
@@ -1,3 +1,10 @@
+function set_style(name){
+       $('#stylesheet').attr("href", "/css/" + name + ".var");
+       localStorage.setItem("theme", name);
+
+       $('#yardi').attr('src', name == "slate" || name == "cyborg" ? "/img/yardi-white.png" : "/img/yardi-blue.png");
+}
+
 $( document ).ready(function() {
     var txt = $('#comments');
     hiddenDiv = $(document.createElement('div')),
@@ -9,14 +16,24 @@ $( document ).ready(function() {
     $('body').append(hiddenDiv);
 
     $(".form-control").on('keyup', function () {
+               content = $(this).val();
 
-    content = $(this).val();
-
-    content = content.replace(/\n/g, '<br>');
-    hiddenDiv.html(content + '<br class="lbr">');
-
-    $(this).css('height', hiddenDiv.height()+23);
+               content = content.replace(/\n/g, '<br>');
+               hiddenDiv.html(content + '<br class="lbr">');
 
+               $(this).css('height', hiddenDiv.height()+23);
        });
 
-});
\ No newline at end of file
+       $('#theme_slate'   ).on('click', function () { set_style("slate"); });
+       $('#theme_cerulean').on('click', function () { set_style("cerulean"); });
+       $('#theme_cyborg'  ).on('click', function () { set_style("cyborg"); });
+       $('#theme_cosmo'   ).on('click', function () { set_style("cosmo"); });
+});
+
+var theme = localStorage.getItem("theme");
+if(theme) {
+       set_style(theme);
+       $(document).ready(function(){
+               $('#yardi').attr('src', theme == "slate" || theme == "cyborg" ? "/img/yardi-white.png" : "/img/yardi-blue.png");
+       })
+}
This page took 0.018084 seconds and 4 git commands to generate.