blob: c3d7b9ab34818664e8b23f0a4f6b3002d418f71e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
<?php
add_action( 'admin_print_scripts', 'switcher_scripts' );
function switcher_scripts() {
wp_enqueue_script('jquery');
}
function switcher_css() {
?>
<style type="text/css">
#switchermenu a {
font-size: 20px;
padding: 0 1.5em 0 10px;
display: block;
color: #c3def1;
}
#switchermenu a:hover {
background: #1a70b4;
color: #fff;
}
#switchermenu li {
margin: 0;
padding: 2px;
}
#switchermenu {
display: none;
list-style: none;
margin: 0;
padding: 0;
overflow: hidden;
border-top: 1px solid #1a70b4;
border-left: 1px solid #1a70b4;
position: absolute;
left: 0;
top: 1em;
background: #14568a;
z-index: 1;
}
</style>
<script type="text/javascript">
jQuery( function($) {
var switchTime;
var w = false;
var h = $( '#blog-title' )
.css({
background: 'transparent url( ../wp-content/mu-plugins/bullet_arrow_down.gif ) no-repeat scroll 100% .2em;',
padding: '0 25px 2px 5px',
cursor: 'pointer',
border: '1px solid #14568a'
})
.parent().css( { position: 'relative' }).end()
.append( $('#switchermenu') )
.hover( function() {
$(this).css({ border: '1px solid #1a70b4'});
switchTime = window.setTimeout( function() {
$('#switchermenu').fadeIn('fast').css( 'top', h ).find('a').width( w = w ? w : $('#switchermenu').width() );
}, 300 );
}, function() {
window.clearTimeout( switchTime );
$(this).css({ border: '1px solid #14568a' }) ;
$('#switchermenu').hide();
})
.height() - 3;
});
</script>
<?php
}
add_action( "admin_head", "switcher_css" );
function add_switcher() {
global $current_user;
$out = '<h1><span id="blog-title">' . wptexturize(get_bloginfo(("name"))) . '</span><span id="viewsite">(<a href="' . get_option("home") . "/" . '">' . __("View site »") . '</a>)</span></h1>';
$out .= '<ul id="switchermenu">';
$blogs = get_blogs_of_user($current_user->ID);
if ( ! empty($blogs) ) foreach ( $blogs as $blog ) {
$out .= '<li><a href="http://' . $blog->domain . $blog->path . 'wp-admin/">' . $blog->blogname . '</a></li>';
}
$out .= "</ul>";
?>
<script type="text/javascript">
document.getElementById('wphead').innerHTML = '<?php echo $out ?>'
</script>
<?php
}
add_action( 'admin_footer', 'add_switcher' );
?>
|