fixed js path and javascript code to allow the dropdowns to load. Logging in and editing still do not work. You can go to the log in or edit page, but when you click "Log in" or "Save," nothing happens

This commit is contained in:
scmb1 2013-06-11 15:58:26 -04:00
parent d98eeb173f
commit c76666a447
3 changed files with 51 additions and 18 deletions

View file

@ -19,14 +19,19 @@ class SkinScratchWikiSkin extends SkinTemplate{
$template = 'ScratchWikiSkinTemplate';
function initPage(OutputPage $out) {
parent::initpage($out);
parent::initPage( $out );
}
function setupSkinUserCss(OutputPage $out) {
global $wgLocalStylePath;
parent::setupSkinUserCss($out);
$out->addStyle('scratchwikiskin/main.css', 'screen');
$out->addHeadItem('skinscript', "<script type='text/javascript' src='../skins/scratchwikiskin/skin.js'></script>");
$out->addHeadItem('skinscript', "<script type='text/javascript' src='$wgLocalStylePath/scratchwikiskin/skin.js'></script>");
}
}
@ -62,6 +67,7 @@ class ScratchWikiSkinTemplate extends BaseTemplate{
<!-- user links -->
<?php if (!$wgUser->isLoggedIn()) { ?>
<!--<li class = last><a href=" Special:Userlogin">Log in to the Wiki</a></li>-->
<li class = last><a href="<?php if (isset($this->data['personal_urls']['anonlogin'])){echo $this->data['personal_urls']['anonlogin']['href'];}else{echo $this->data['personal_urls']['login']['href'];}?>">Log in to the Wiki</a></li>
<?php } else { ?>
<li id=userfcttoggle class="user-name dropdown-toggle"><a><?=htmlspecialchars($wgUser->mName)?></a></li>

View file

@ -18,7 +18,7 @@ header {
-moz-box-shadow: 0 1px 1px #ccc;
-o-box-shadow: 0 1px 1px #ccc;
box-shadow: 0 1px 1px #ccc;
z-index: 1;
z-index: 3;
}
@ -268,7 +268,7 @@ opacity: .8;
overflow: hidden;
border-radius: 5px;
border-top-right-radius: 0;
box-shadow: 0px 0px 5px #888a85;
box-shadow: 0px 1px 1px #888a85;
}
.dropdownmenu li {
float: none;
@ -313,7 +313,7 @@ opacity: .8;
}
#pagefctdropdown{
margin-left: 554px; //temporary solution
margin-left: 555px; //temporary solution
}
#pagefctdropdown li a {
color: #888;

53
skin.js
View file

@ -4,17 +4,29 @@ Scratch Wiki Skin script
*/
//get the element from an id, with functions to write, add, show, hide, addclass, delclass
function el(id) {
var h = document.getElementById(id);
//if no element exists with that id, return null
if(!h){
return h;
}
h.write = function(o) {this.innerHTML = o;};
h.add = function(o) {this.innerHTML += o;};
h.show = function(o) {this.style.display = 'block';};
h.hide = function(o) {this.style.display = 'none';};
h.addclass = function(c) {this.className+=' '+c;this.className=this.className.trim();};
h.delclass = function(c) {this.className=this.className.replace(c,'').replace(' ',' ').trim();};
return h;
}
window.onload = function() {
//when pencil icon clicked, display dropdown
el('pagefctbtn').onclick = function() {
if (el('pagefctdropdown').style.display!='block') {
el('pagefctbtn').addclass('open');
@ -24,6 +36,8 @@ window.onload = function() {
el('pagefctdropdown').hide();
}
}
//when mouse moved away, hide dropdown
el('pagefctdropdown').onmouseout = function(e) {
if (!e) var e = window.event;
if (!e.toElement) e.toElement = e.relatedTarget;
@ -32,23 +46,36 @@ window.onload = function() {
el('pagefctdropdown').hide();
}
}
el('userfcttoggle').onclick = function() {
if (el('userfctdropdown').style.display!='block') {
el('userfcttoggle').addclass('open');
el('userfctdropdown').show();
} else {
el('userfcttoggle').delclass('open');
el('userfctdropdown').hide();
}
}
el('userfctdropdown').onmouseout = function(e) {
if (!e) var e = window.event;
if (!e.toElement) e.toElement = e.relatedTarget;
if (' ul li img a'.indexOf(e.toElement.tagName.toLowerCase())<0) {
//if user is logged in and toggle is showing, add dropdown functions
if(el('userfcttoggle')){
//if username toggle clicked, display dropdown
el('userfcttoggle').onclick = function() {
if (el('userfctdropdown').style.display!='block') {
el('userfcttoggle').addclass('open');
el('userfctdropdown').show();
} else {
el('userfcttoggle').delclass('open');
el('userfctdropdown').hide();
}
}
//when mouse moved away, hide dropdown
el('userfctdropdown').onmouseout = function(e) {
if (!e) var e = window.event;
if (!e.toElement) e.toElement = e.relatedTarget;
if (' ul li img a'.indexOf(e.toElement.tagName.toLowerCase())<0) {
el('userfcttoggle').delclass('open');
el('userfctdropdown').hide();
}
};
}
}
/*
function showpersonallinks() {