Community Central
Community Central
(Created page with "/****************************** ******************************* ***** Color Select Module ***** ********* Created by ********** **** Ultimate Dark Carnage **** ***************...")
 
No edit summary
 
Line 8: Line 8:
   
 
window.colorSelectLoad = 0;
 
window.colorSelectLoad = 0;
if (colorSelectLoad < 1 && typeof colorSelectLoad != "undefined"){
+
if (colorSelectLoad < 1){
 
colorSelectLoad = 1;
 
colorSelectLoad = 1;
 
window.colorSelectHTML =
 
window.colorSelectHTML =
Line 21: Line 21:
 
'<div class="ColorSelectContent ColorSelectComponent FloatLeft">' +
 
'<div class="ColorSelectContent ColorSelectComponent FloatLeft">' +
 
'<form class="WikiaForm ColorSelectForm" method="" name="">' +
 
'<form class="WikiaForm ColorSelectForm" method="" name="">' +
'<table>' +
+
'<table style="width: 100%;">' +
 
'<tr>' +
 
'<tr>' +
'<td>' +
+
'<td colspan="2">' +
 
'<em>Color</em>' +
 
'<em>Color</em>' +
 
'<label class="ColorSelectLabel" for="RGBRed">Red: </label>' +
 
'<label class="ColorSelectLabel" for="RGBRed">Red: </label>' +
Line 30: Line 30:
 
'</tr>' +
 
'</tr>' +
 
'<tr>' +
 
'<tr>' +
'<td>' +
+
'<td colspan="2">' +
 
'<label class="ColorSelectLabel" for="RGBGreen">Green: </label>' +
 
'<label class="ColorSelectLabel" for="RGBGreen">Green: </label>' +
 
'<input type="range" id="RGBGreen" min="0" max="255" value="128" name="rgb" />' +
 
'<input type="range" id="RGBGreen" min="0" max="255" value="128" name="rgb" />' +
Line 36: Line 36:
 
'</tr>' +
 
'</tr>' +
 
'<tr>' +
 
'<tr>' +
'<td>' +
+
'<td colspan="2">' +
 
'<label class="ColorSelectLabel" for="RGBBlue">Blue: </label>' +
 
'<label class="ColorSelectLabel" for="RGBBlue">Blue: </label>' +
 
'<input type="range" id="RGBBlue" min="0" max="255" value="128" name="rgb" />' +
 
'<input type="range" id="RGBBlue" min="0" max="255" value="128" name="rgb" />' +
Line 46: Line 46:
 
'<label class="ColorSelectLabel" for="RGBAlphaDisable">Off: </label>' +
 
'<label class="ColorSelectLabel" for="RGBAlphaDisable">Off: </label>' +
 
'<input type="radio" id="RGBAlphaDisable" value="disable" name="rgb-alpha-init" checked />' +
 
'<input type="radio" id="RGBAlphaDisable" value="disable" name="rgb-alpha-init" checked />' +
'</td>' +
 
'<td>' +
 
 
'<label class="ColorSelectLabel" for"RGBAlphaEnable">On: </label>' +
 
'<label class="ColorSelectLabel" for"RGBAlphaEnable">On: </label>' +
 
'<input type="radio" id="RGBAlphaEnable" value="enable" name="rgb-alpha-init" />' +
 
'<input type="radio" id="RGBAlphaEnable" value="enable" name="rgb-alpha-init" />' +
Line 53: Line 51:
 
'</tr>' +
 
'</tr>' +
 
'<tr>' +
 
'<tr>' +
'<td>' +
+
'<td colspan="2">' +
 
'<label class="ColorSelectLabel" for="RGBAlpha">Alpha: </label>' +
 
'<label class="ColorSelectLabel" for="RGBAlpha">Alpha: </label>' +
'<input type="range" id="RGBAlpha" min="0" max="255" value="128" name="rgb" disabled />' +
+
'<input type="range" id="RGBAlpha" min="0" max="1" step="0.01" value="1" name="rgb" disabled />' +
 
'</td>' +
 
'</td>' +
 
'</tr>' +
 
'</tr>' +
Line 63: Line 61:
 
'<div class="ColorSelectComponent FloatRight">' +
 
'<div class="ColorSelectComponent FloatRight">' +
 
'<h2>Color: </h2>' +
 
'<h2>Color: </h2>' +
'<div class="ColorBox">' +
+
'<div class="ColorBox" style="width: 100px; height: 100px;">' +
 
'&nbsp;' +
 
'</div>' +
 
'</div>' +
 
'<ul class="ColorSelectStats">' +
 
'<ul class="ColorSelectStats">' +
'<li>RGBA: rgb(<span class="RGBIdentifier"></span>)</li>' +
+
'<li>RGBA: <code>rgb(<span class="RGBIdentifier"></span>)</code></li>' +
'<li>Hex: <span class="HexIdentifier"></span></li>' +
+
'<li>Hex: <code><span class="HexIdentifier"></span></code></li>' +
 
'</ul>' +
 
'</ul>' +
 
'</div>' +
 
'</div>' +
 
'</section>';
 
'</section>';
if ($('.ColorSelectNavigation li').hasClass('ColorSelectDisabled') == true){
+
if ($('.ColorSelectNavigation li').hasClass('ColorSelectDisabled') === true){
 
$(this).children('a').removeAttr('href');
 
$(this).children('a').removeAttr('href');
 
}
 
}
Line 78: Line 77:
 
var RGBGreen = $('#RGBGreen').val();
 
var RGBGreen = $('#RGBGreen').val();
 
var RGBBlue = $('#RGBBlue').val();
 
var RGBBlue = $('#RGBBlue').val();
var RGBAlpha = #('#RGBAlpha:not(:disabled)').val();
+
var RGBAlpha = $('#RGBAlpha').val();
 
 
 
$('.ColorSelectWrapper').append(colorSelectHTML);
if ($('#RGBAlpha').is(':disabled') == true){
 
$('.ColorSelectForm input[name="rgb"][type="range"]').on('change', function(){
 
$('.ColorSelect .ColorBox').css('background', 'rgb(' + RGBRed + ', ' + RGBGreen + ', ' + RGBBlue + ')');
 
});
 
}
 
 
 
 
$('.ColorSelect input[type="radio"][name="rgb"]').on('change', function(){
$('.ColorSelectWrapper').append(colorSelectHTML);
 
 
$('.ColorBox').css('background', 'rgba(' + RGBRed + ', ' + RGBGreen + ', ' + RGBBlue + ', ' + RGBAlpha + ')');
 
});
 
}
 
}

Latest revision as of 22:35, 22 September 2014

/******************************
*******************************
***** Color Select Module *****
********* Created by **********
**** Ultimate Dark Carnage ****
*******************************
******************************/

window.colorSelectLoad = 0;
if (colorSelectLoad < 1){
    colorSelectLoad = 1;
    window.colorSelectHTML = 
        '<section class="ColorSelect WikiaGrid clearfix module" id="ColorSelect">' +
            '<h1 class="ColorSelectHeading" id="ColorSelectHeading">Color Select</h1>' +
            '<nav class="ColorSelectNavigation">' +
                '<ul>' +
                    '<li class="ColorSelectActive"><a href="javascript:void(0);">Color</a></li>' +
                    '<li class="ColorSelectDisabled"><a href="javascript:void(0);">Gradient</a></li>' +
                '</ul>' +
            '</nav>' +
            '<div class="ColorSelectContent ColorSelectComponent FloatLeft">' +
                '<form class="WikiaForm ColorSelectForm" method="" name="">' +
                    '<table style="width: 100%;">' +
                        '<tr>' +
                            '<td colspan="2">' +
                                '<em>Color</em>' +
                                '<label class="ColorSelectLabel" for="RGBRed">Red: </label>' +
                                '<input type="range" id="RGBRed" min="0" max="255" value="128" name="rgb" />' +
                            '</td>' +
                        '</tr>' +
                        '<tr>' +
                            '<td colspan="2">' +
                                '<label class="ColorSelectLabel" for="RGBGreen">Green: </label>' +
                                '<input type="range" id="RGBGreen" min="0" max="255" value="128" name="rgb" />' +
                            '</td>' +
                        '</tr>' +
                        '<tr>' +
                            '<td colspan="2">' +
                                '<label class="ColorSelectLabel" for="RGBBlue">Blue: </label>' +
                                '<input type="range" id="RGBBlue" min="0" max="255" value="128" name="rgb" />' +
                            '</td>' +
                        '</tr>' +
                        '<tr>' +
                            '<td>' +
                                '<em>Alpha</em>' +
                                '<label class="ColorSelectLabel" for="RGBAlphaDisable">Off: </label>' +
                                '<input type="radio" id="RGBAlphaDisable" value="disable" name="rgb-alpha-init" checked />' +
                                '<label class="ColorSelectLabel" for"RGBAlphaEnable">On: </label>' +
                                '<input type="radio" id="RGBAlphaEnable" value="enable" name="rgb-alpha-init" />' +
                            '</td>' +
                        '</tr>' +
                        '<tr>' +
                            '<td colspan="2">' +
                                '<label class="ColorSelectLabel" for="RGBAlpha">Alpha: </label>' +
                                '<input type="range" id="RGBAlpha" min="0" max="1" step="0.01" value="1" name="rgb" disabled />' +
                            '</td>' +
                        '</tr>' +
                    '</table>' +
                '</form>' +
            '</div>' +
            '<div class="ColorSelectComponent FloatRight">' +
                '<h2>Color: </h2>' +
                '<div class="ColorBox" style="width: 100px; height: 100px;">' +
                    '&nbsp;' +
                '</div>' +
                '<ul class="ColorSelectStats">' +
                    '<li>RGBA: <code>rgb(<span class="RGBIdentifier"></span>)</code></li>' +
                    '<li>Hex: <code><span class="HexIdentifier"></span></code></li>' +
                '</ul>' +
            '</div>' +
        '</section>';
    if ($('.ColorSelectNavigation li').hasClass('ColorSelectDisabled') === true){
        $(this).children('a').removeAttr('href');
    }
 
    var RGBRed = $('#RGBRed').val();
    var RGBGreen = $('#RGBGreen').val();
    var RGBBlue = $('#RGBBlue').val();
    var RGBAlpha = $('#RGBAlpha').val();
 
    $('.ColorSelectWrapper').append(colorSelectHTML);
 
    $('.ColorSelect input[type="radio"][name="rgb"]').on('change', function(){
        $('.ColorBox').css('background', 'rgba(' + RGBRed + ', ' + RGBGreen + ', ' + RGBBlue + ', ' + RGBAlpha + ')');
    });
}