forked from lab2023/hierapolis
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
coskuntekin
committed
Jul 8, 2013
1 parent
366ec3d
commit 1d76b56
Showing
38 changed files
with
4,831 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
Oops, something went wrong.