function phpAds_settings_cp_map()
{
    static $done = false;
    if (!$done) {
        $done = true;
        ?>
<script language="JavaScript">
<!--
var current_cp = null;
var current_cp_oldval = null;
var current_box = null;

function c_pick(value)
{
	if (current_cp)
	{
		current_cp.value = value;
		c_update();
	}
}

function c_update()
{
	if (!current_cp.value.match(/^#[0-9a-f]{6}$/gi))
	{
		current_cp.value = current_cp_oldval;
		return;
	}
	
	current_cp.value.toUpperCase();
	current_box.style.backgroundColor = current_cp.value;
}

// -->
</script>
<?php 
        echo "<map name=\"colorpicker\">\n";
        $x = 2;
        for ($i = 1; $i <= 255 * 6; $i += 8) {
            if ($i > 0 && $i <= 255 * 1) {
                $incColor = '#FF' . toHex($i) . '00';
            } elseif ($i > 255 * 1 && $i <= 255 * 2) {
                $incColor = '#' . toHex(255 - ($i - 255)) . 'FF00';
            } elseif ($i > 255 * 2 && $i <= 255 * 3) {
                $incColor = '#00FF' . toHex($i - 2 * 255);
            } elseif ($i > 255 * 3 && $i <= 255 * 4) {
                $incColor = '#00' . toHex(255 - ($i - 3 * 255)) . 'FF';
            } elseif ($i > 255 * 4 && $i <= 255 * 5) {
                $incColor = '#' . toHex($i - 4 * 255) . '00FF';
            } elseif ($i > 255 * 5 && $i < 255 * 6) {
                $incColor = '#FF00' . toHex(255 - ($i - 5 * 255));
            }
            echo "<area shape='rect' coords='{$x},0," . ($x + 1) . ",9' href='javascript:c_pick(\"{$incColor}\")'>\n";
            $x++;
        }
        $x = 2;
        for ($j = 0; $j < 255; $j += 1.34) {
            $i = round($j);
            $incColor = '#' . toHex($i) . toHex($i) . toHex($i);
            echo "<area shape='rect' coords='{$x},11," . ($x + 1) . ",20' href='javascript:c_pick(\"{$incColor}\")'>\n";
            $x++;
        }
        echo "</map>";
    }
}
示例#2
0
文件: mobile.php 项目: nanfs/lt
function rgb2hex($r, $g, $b)
{
    return toHex($r) . toHex($g) . toHex($b);
}
            continue;
        }
        $f = new stdClass();
        $f->name = substr($l, 5 + is_numeric($l[5]), $i - 5 - is_numeric($l[5]));
        while (($l = fgets($a)) && strpos($l, 'ret') === false) {
            if (strpos($l, 'leaq') !== false) {
                $f->addr = hexdec(substr($l, 6, strpos($l, '(') - 6));
            }
            if (!isset($f->ports) && strpos($l, "movb\t\$") !== false) {
                $f->ports = hexdec(substr($l, strpos($l, '$'), strpos($l, ',') - strpos($l, '$'))) & 0xff;
            }
            if (strpos($l, 'jl') !== false) {
                $i = hexdec(substr($l, 4));
            }
            if (strpos($l, 'jmp') !== false) {
                $i = hexdec(substr($l, 4)) + 0x1a;
            }
        }
        $f->addr += $i;
        echo "{$f->name} ({$f->ports}) @ 0x" . dechex($f->addr) . "\n";
        $t = $p = array();
        fseek($b, $f->addr);
        while ($f->ports-- > 0) {
            $p[] = $ctype[substr($t[] = toHex(fread($b, 16)), 0, 8)];
        }
        echo implode(', ', $p) . "\n";
        echo implode("\n", $t) . "\n\n";
    }
    pclose($a);
    fclose($b);
}