Skip to content

Commit 8352c65

Browse files
committed
Refactored jscolor to include images with a stylesheet so assetgraph-builder understands it
1 parent 415ef3f commit 8352c65

File tree

2 files changed

+6
-21
lines changed

2 files changed

+6
-21
lines changed

public/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ <h2>Arrow configuration</h2>
6767

6868
<script src='https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js'></script>
6969
<script type="text/javascript" src="js/vendor/jscolor/jscolor.js"></script>
70+
<link rel="stylesheet" type="text/css" href="js/vendor/jscolor/jscolor.css">
7071

7172
<script src='js/lib/models/arrow.js'></script>
7273
<script src='js/lib/views/arrow_configuration_view.js'></script>

public/js/vendor/jscolor/jscolor.js

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,7 @@ var jscolor = {
596596
var p = jscolor.picker;
597597

598598
// controls interaction
599+
p.box.className = modeID ? 'value' : 'saturation';
599600
p.box.onmouseup =
600601
p.box.onmouseout = function() { target.focus(); };
601602
p.box.onmousedown = function() { abortBlur=true; };
@@ -637,6 +638,7 @@ var jscolor = {
637638
p.box.style.height = dims[1] + 'px';
638639

639640
// picker border
641+
p.boxB.className = 'jscolor';
640642
p.boxB.style.position = 'absolute';
641643
p.boxB.style.clear = 'both';
642644
p.boxB.style.left = x+'px';
@@ -647,6 +649,7 @@ var jscolor = {
647649
p.boxB.style.background = THIS.pickerFaceColor;
648650

649651
// pad image
652+
p.pad.className = 'pad';
650653
p.pad.style.width = jscolor.images.pad[0]+'px';
651654
p.pad.style.height = jscolor.images.pad[1]+'px';
652655

@@ -658,6 +661,7 @@ var jscolor = {
658661
p.padB.style.borderColor = THIS.pickerInsetColor;
659662

660663
// pad mouse area
664+
p.padM.className = 'cross';
661665
p.padM.style.position = 'absolute';
662666
p.padM.style.left = '0';
663667
p.padM.style.top = '0';
@@ -679,6 +683,7 @@ var jscolor = {
679683
p.sldB.style.borderColor = THIS.pickerInsetColor;
680684

681685
// slider mouse area
686+
p.sldM.className = 'arrow';
682687
p.sldM.style.display = THIS.slider ? 'block' : 'none';
683688
p.sldM.style.position = 'absolute';
684689
p.sldM.style.right = '0';
@@ -718,19 +723,6 @@ var jscolor = {
718723
};
719724
p.btnS.style.lineHeight = p.btn.style.height;
720725

721-
// load images in optimal order
722-
switch(modeID) {
723-
case 0: var padImg = 'hs.png'; break;
724-
case 1: var padImg = 'hv.png'; break;
725-
}
726-
p.padM.style.backgroundImage = "url('"+jscolor.getDir()+"cross.gif')";
727-
p.padM.style.backgroundRepeat = "no-repeat";
728-
p.sldM.style.backgroundImage = "url('"+jscolor.getDir()+"arrow.gif')";
729-
p.sldM.style.backgroundRepeat = "no-repeat";
730-
p.pad.style.backgroundImage = "url('"+jscolor.getDir()+padImg+"')";
731-
p.pad.style.backgroundRepeat = "no-repeat";
732-
p.pad.style.backgroundPosition = "0 0";
733-
734726
// place pointers
735727
redrawPad();
736728
redrawSld();
@@ -918,14 +910,6 @@ var jscolor = {
918910
};
919911
}
920912

921-
// require images
922-
switch(modeID) {
923-
case 0: jscolor.requireImage('hs.png'); break;
924-
case 1: jscolor.requireImage('hv.png'); break;
925-
}
926-
jscolor.requireImage('cross.gif');
927-
jscolor.requireImage('arrow.gif');
928-
929913
this.importColor();
930914
}
931915

0 commit comments

Comments
 (0)