Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemath
GitHub Repository: sagemath/sagecell
Path: blob/master/static/colorpicker/js/layout.js
447 views
1
(function($){
2
var initLayout = function() {
3
var hash = window.location.hash.replace('#', '');
4
var currentTab = $('ul.navigationTabs a')
5
.bind('click', showTab)
6
.filter('a[rel=' + hash + ']');
7
if (currentTab.size() == 0) {
8
currentTab = $('ul.navigationTabs a:first');
9
}
10
showTab.apply(currentTab.get(0));
11
$('#colorpickerHolder').ColorPicker({flat: true});
12
$('#colorpickerHolder2').ColorPicker({
13
flat: true,
14
color: '#00ff00',
15
onSubmit: function(hsb, hex, rgb) {
16
$('#colorSelector2 div').css('backgroundColor', '#' + hex);
17
}
18
});
19
$('#colorpickerHolder2>div').css('position', 'absolute');
20
var widt = false;
21
$('#colorSelector2').bind('click', function() {
22
$('#colorpickerHolder2').stop().animate({height: widt ? 0 : 173}, 500);
23
widt = !widt;
24
});
25
$('#colorpickerField1, #colorpickerField2, #colorpickerField3').ColorPicker({
26
onSubmit: function(hsb, hex, rgb, el) {
27
$(el).val(hex);
28
$(el).ColorPickerHide();
29
},
30
onBeforeShow: function () {
31
$(this).ColorPickerSetColor(this.value);
32
}
33
})
34
.bind('keyup', function(){
35
$(this).ColorPickerSetColor(this.value);
36
});
37
$('#colorSelector').ColorPicker({
38
color: '#0000ff',
39
onShow: function (colpkr) {
40
$(colpkr).fadeIn(500);
41
return false;
42
},
43
onHide: function (colpkr) {
44
$(colpkr).fadeOut(500);
45
return false;
46
},
47
onChange: function (hsb, hex, rgb) {
48
$('#colorSelector div').css('backgroundColor', '#' + hex);
49
}
50
});
51
};
52
53
var showTab = function(e) {
54
var tabIndex = $('ul.navigationTabs a')
55
.removeClass('active')
56
.index(this);
57
$(this)
58
.addClass('active')
59
.blur();
60
$('div.tab')
61
.hide()
62
.eq(tabIndex)
63
.show();
64
};
65
66
EYE.register(initLayout, 'init');
67
})(jQuery)
68