Skip to content

Commit

Permalink
lab2023#9 Added Flat UI
Browse files Browse the repository at this point in the history
  • Loading branch information
coskuntekin committed Jul 8, 2013
1 parent 366ec3d commit 1d76b56
Show file tree
Hide file tree
Showing 38 changed files with 4,831 additions and 4 deletions.
68 changes: 68 additions & 0 deletions source/assets/javascripts/vendor/application.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
// Some general UI pack related JS
// Extend JS String with repeat method
String.prototype.repeat = function(num) {
return new Array(num + 1).join(this);
};

(function($) {

// Add segments to a slider
$.fn.addSliderSegments = function (amount) {
return this.each(function () {
var segmentGap = 100 / (amount - 1) + "%"
, segment = "<div class='ui-slider-segment' style='margin-left: " + segmentGap + ";'></div>";
$(this).prepend(segment.repeat(amount - 2));
});
};

$(function() {

// Todo list
$(".todo li").click(function() {
$(this).toggleClass("todo-done");
});

// Custom Select
$("select[name='herolist']").selectpicker({style: 'btn-primary', menuStyle: 'dropdown-inverse'});

// Tooltips
$("[data-toggle=tooltip]").tooltip("show");

// Tags Input
$(".tagsinput").tagsInput();

// jQuery UI Sliders
var $slider = $("#slider");
if ($slider.length) {
$slider.slider({
min: 1,
max: 5,
value: 2,
orientation: "horizontal",
range: "min"
}).addSliderSegments($slider.slider("option").max);
}

// Placeholders for input/textarea
$("input, textarea").placeholder();

// Make pagination demo work
$(".pagination a").on('click', function() {
$(this).parent().siblings("li").removeClass("active").end().addClass("active");
});

$(".btn-group a").on('click', function() {
$(this).siblings().removeClass("active").end().addClass("active");
});

// Disable link clicks to prevent page scrolling
$('a[href="#fakelink"]').on('click', function (e) {
e.preventDefault();
});

// Switch
$("[data-toggle='switch']").wrap('<div class="switch" />').parent().bootstrapSwitch();

});

})(jQuery);
Loading

0 comments on commit 1d76b56

Please sign in to comment.