Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)
Paste
Pasted as Plain Text by Blaz ( 15 years ago )
<html>
<head>
<title>Color Picker</title>
<style type="text/css">
h1 {
color: #ffff00;
background: #ffdddd;
border:3px solid;
border-bottom-color:#0000FF;
border-left-color:#00CC00;
border-right-color:#FF0000;
border-top-color:transparent;}
</style>
[removed]
document.addEventListener('mouseup', function(e){opera.cpTarget = e.target;if(e && e.button == 0){opera.lastClickX = e.clientX; opera.lastClickY = e.clientY;}}, false);
function cp_createWindow(elemento){
var cpId = 'cpWindow';
var cpWindow = document.getElementById(cpId); if(cpWindow)cpWindow[removed].removeChild(cpWindow); cpWindow = document.createElement('div'); cpWindow.id = cpId;
var title = '<span style="color:#000099;font:16px Times New Roman;">Color Picker</span>';
var img = '<img title="Close" width="18" height="18">';
var cpBgColor = document.defaultView.getComputedStyle(elemento,null).getPropertyValue("background-color");
var cpBdColor = new Array();
cpBdColor[0] = elemento.currentStyle.borderLeftColor;
cpBdColor[1] = elemento.currentStyle.borderRightColor;
cpBdColor[2] = elemento.currentStyle.borderTopColor;
cpBdColor[3] = elemento.currentStyle.borderBottomColor;
var fnColor = document.defaultView.getComputedStyle(elemento,null).getPropertyValue("color");
if(cpBgColor == "transparent"){el=elemento;while(el=el[removed]){if(el.nodeType==1){cpBgColor = document.defaultView.getComputedStyle(el,null).getPropertyValue("background-color");if(cpBgColor!="transparent")break}}}
cpWindow[removed] = img+' '+title+
'<div style="margin-top:5px;display:block;font-family:Arial;font-size:10px;color:#000000;background:-o-skin(\\'Window Skin\\');text-align:center">' +
'<div style="border:1px solid transparent;margin:0 2px;width:50px;float:left;">BGround</div>'+
'<div style="border:1px solid transparent;margin:0 2px;width:50px;float:left;">Borders</div>'+
'<div style="border:1px solid transparent;margin:0 2px;width:50px;float:left;">Color</div>'+
'<div style="margin:0 2px;width:50px;float:left;height:20px;border:1px solid #999999;background-color:'+cpBgColor+'"></div>'+
'<div style="margin:0 2px;width:50px;float:left;height:20px;border:1px solid #999999;background-color:transparent">'+
'<div style="width:12px;float:left;height:20px;background-color:'+cpBdColor[0]+';cursor:pointer"></div>'+
'<div style="width:12px;float:left;height:20px;background-color:'+cpBdColor[1]+';cursor:pointer"></div>'+
'<div style="width:26px;float:left;height:10px;background-color:'+cpBdColor[2]+';cursor:pointer"></div>'+
'<div style="width:26px;float:left;height:10px;background-color:'+cpBdColor[3]+';cursor:pointer"></div>'+
'</div>'+
'<div style="margin:0 2px;width:50px;float:left;height:20px;border:1px solid #999999;background-color:'+fnColor+'"></div>'+
'<div style="margin:2px 2px;width:50px;float:left;height:16px;border:1px solid #FFFFFF;background-color:#FFFFFF;font-size:11px;cursor:text">'+cpBgColor.substr(0,7).toUpperCase()+'</div>'+
'<div style="margin:2px 2px;width:50px;float:left;height:16px;border:1px solid #FFFFFF;background-color:#FFFFFF;font-size:11px;cursor:text" id="cp_bordertext">'+cpBdColor[0].substr(0,7).toUpperCase()+'</div>'+
'<div style="margin:2px 2px;width:50px;float:left;height:16px;border:1px solid #FFFFFF;background-color:#FFFFFF;font-size:11px;cursor:text">'+fnColor.substr(0,7).toUpperCase()+'</div></div>';
cpWindow.setAttribute('style', 'position:fixed;display:block;visibility:hidden;left:0;top:0;height:auto;width:'+168+'px;background:-o-skin('Window Skin');font:16px Times New Roman;border:1px solid gray;padding:3px;z-index:9997;overflow:visible;cursor:move;');
cpWindow.addEventListener('mousedown', function(e){
if (e.target == cpWindow){
e.preventDefault(); cpWindow.style.zIndex = 9998;
var grabX = e.clientX; var grabY = e.clientY;
var origX = parseInt(cpWindow.style.left); var origY = parseInt(cpWindow.style.top);
var dnd = function(e){
cpWindow.style.left = origX+e.clientX-grabX+'px';
cpWindow.style.top = origY+e.clientY-grabY+'px';
if(opera && opera.version() >= 9 && opera.version() < 9.5){
if(cpWindow.style.zIndex <= 9999){cpWindow.style.zIndex++}else{cpWindow.style.zIndex--};
};
};
document.addEventListener('mousemove', dnd, false);
document.addEventListener('mouseup', function(e){document.removeEventListener('mousemove', dnd, false); cpWindow.style.zIndex = 9997}, false);
}
}, false);
document.documentElement.appendChild(cpWindow);
var halfWidth = parseInt(cpWindow.offsetWidth/2);
var strict = document.compatMode == 'CSS1Compat' && opera && opera.version() >= 9.5;
var mX = (strict ? document.documentElement.clientWidth : document.body.clientWidth)-cpWindow.offsetWidth;
var mY = (strict ? document.documentElement.clientHeight : document.body.clientHeight)-cpWindow.offsetHeight;
cpWindow.style.left = (opera && opera.lastClickX < mX+halfWidth) ? (opera.lastClickX > halfWidth ? (opera.lastClickX-halfWidth) : 0) : mX;
cpWindow.style.top = (opera && opera.lastClickY < mY) ? opera.lastClickY : mY;
cpWindow.style.visibility = 'visible'; return cpWindow;
};
function cp_getColor() {
var getTarget = function(w){if(w.opera.cpTarget)return true};
var findSelWin = function(w){var rez;try{if(getTarget(w)){rez = w}else{for(var i = 0, f; f = w.frames[i]; i++) {if(rez = findSelWin(f))break}}}catch(e){};return rez};
var w = findSelWin(window.top);
if(w)with(w){cp_createWindow(opera.cpTarget);}
}
[removed]
</head>
<body>
<h1 id="h1">
<p style="color: rgb(0, 204, 255);">Color Picker</p>
<p> tag into a </p>
</h1>
<h1> tag </h1>
</body>
</html>
Revise this Paste