So,
zuerst der Code für das Plugin, das auf der rechten Seite eine Reihe von ListButtons darstellt. Tatsächlich werden immer nur max. 9 dargestellt, beim
Scrollen wird lediglich der Inhalt verändert.
<html>
<head>
<title>Page Title</title>
<link rel="STYLESHEET" type="text/css" href="Main.css">
<script src="BasicFunctions.js" type="text/javascript"></script>
<script src="Scrolling.js" type="text/javascript"></script>
<script src="MoveFocus.js" type="text/javascript"></script>
<script>
var TopListButton=1;
var MaxListButtons, OldMaxListButtons=0;
var ListButtonsDisplayed;
var FolderID="x";
var Dummy="1";
function pageLoadFunctions()
{
setBGColor("#666666");
checkSVP();
setCounter();
setArray();
startFocus();
}
function doSelect()
{
/* This function determines what your buttons do when they are selected
(navigate, call a function, etc.). This function will get called whenever user
clicks a focusable item, or selects it with "OK" button on remote. Make sure to
include a case below for each focusable item on the page */
var url = ""
switch(oCurFocus.id)
{
case "ListButton1": url = URL(1); break;
case "ListButton2": url = URL(2); break;
case "ListButton3": url = URL(3); break;
case "ListButton4": url = URL(4); break;
case "ListButton5": url = URL(5); break;
case "ListButton6": url = URL(6); break;
case "ListButton7": url = URL(7); break;
case "ListButton8": url = URL(8); break;
case "ListButton9": url = URL(9); break;
}
if (url != "")
{
MAPI.ShutDown();
window.navigate(url);
}
}
</script>
</head>
<body id="body" MCFocusStart="btnMenuPg" onload="pageLoadFunctions()" onkeydown="myonRemoteEvent(window.event.keyCode)">
<span ID="ruler" style="visibility:hidden;FONT-WEIGHT: bold; FONT-SIZE: 20pt; font-family: arial;"></span>
<!-- Start span used as stand-in for Shared Viewport -->
<span style="position: absolute; top: 0; left: 0; height: 100%;">
<table style="position: absolute; top: 0; left: 0; height: 100%;" cellspacing="0" cellpadding="0">
<tr><td valign="bottom" height="100%">
<span id="SVP" style="width: 308; height: 216; vertical-align: bottom" MCFocusable="true"></span>
</td></tr>
</table>
</span>
<!-- End span used as stand-in for Shared Viewport -->
<span id="FolderName" class="text1" style="position: absolute; top: 94; left: 345; width: 610;"></span>
<!-- Item counter at lower right. Displays only if button menu is scrollable -->
<span id="itemCounterSpan" style="font: 20pt Arial; color: #f2f2f2; width: 610; Height: 42; text-align: right; display: block; position: absolute; top: 644; left: 119;">
<span id="counterNum">1</span> of <span id="counterTotal"></span>
<span id="arrowUp" class="arrowUp" onclick = "pageUpDown('up')"></span>
<span id="arrowDown" class="arrowDown" onclick = "pageUpDown('down')"></span>
</span>
<!-- End item counter at lower right -->
<table id="listTable" border="0" cellpadding="0" cellspacing="3" style="position: absolute; top: 138; left: 10;">
<tr><td><span id="Left1" class="button1" MCFocusable="true">Back</span> </td></tr>
<tr><td><span id="Left2" class="button1" MCFocusable="true">Delete</span></td></tr>
<tr><td><span id="Left3" class="button1" MCFocusable="true">Sort by Subject</span></td></tr>
</table>
<!-- Start of "scrolling" span -->
<span id="scrollspan" ListButtons="true" MCScrollable="true" style="position: absolute; top: 138; left: 300; width: 700; height: 485; overflow: hidden">
<table id="listTable" border="0" cellpadding="0" cellspacing="3">
<tr><td ID="ListButton1" class="button2" MCFocusable="true"></td></tr>
<tr><td ID="ListButton2" class="button2" MCFocusable="true"></td></tr>
<tr><td ID="ListButton3" class="button2" MCFocusable="true"></td></tr>
<tr><td ID="ListButton4" class="button2" MCFocusable="true"></td></tr>
<tr><td ID="ListButton5" class="button2" MCFocusable="true"></td></tr>
<tr><td ID="ListButton6" class="button2" MCFocusable="true"></td></tr>
<tr><td ID="ListButton7" class="button2" MCFocusable="true"></td></tr>
<tr><td ID="ListButton8" class="button2" MCFocusable="true"></td></tr>
<tr><td ID="ListButton9" class="button2" MCFocusable="true"></td></tr>
<script>
</script>
</table>
</span>
<div id="xxx"></div>
<script>
function showfocus()
{
document.all.xxx.innerHTML=oCurFocus.id+" "+TopListButton+" *"+oCurFocus.innerHTML+"* "+PixelWidth(oCurFocus.innerHTML)+" "+MaxListButtons;
}
//interval=window.setInterval("showfocus()",500);
function UpdateListButtons()
{
MAPI.GetFolders(FolderID);
MAPI.GetFolderItems(FolderID);
FolderCount = MAPI.FolderCount();
ItemCount = MAPI.ItemCount();
MaxListButtons= FolderCount + ItemCount;
if (MaxListButtons>=9)
{
ListButtonsDisplayed=9;
} else
{
ListButtonsDisplayed=MaxListButtons;
}
if ((OldMaxListButtons!=0) && (OldMaxListButtons>MaxListButtons))
{
while (TopListButton-1+ListButtonsDisplayed > MaxListButtons)
TopListButton--;
}
if (OldMaxListButtons!=MaxListButtons)
{
for (i=1;i<=ListButtonsDisplayed;i++)
document.getElementById("ListButton"+i).style.visibility="visible";
for (i=ListButtonsDisplayed+1;i<=9;i++)
document.getElementById("ListButton"+i).style.visibility="hidden";
}
OldMaxListButtons=MaxListButtons;
for (i=1;i<=ListButtonsDisplayed;i++)
{
if (i-1+TopListButton<=FolderCount)
{
SubFolderID=MAPI.FolderEntryID(i-1+TopListButton)
Caption=MAPI.FolderName(SubFolderID);
Caption="<IMG SRC='folder.gif'> "+Caption;
} else
{
ItemID=MAPI.ItemEntryID(i-1+TopListButton-FolderCount)
Caption=MAPI.Subject(ItemID);
if (MAPI.ItemOpened(ItemID)==1)
Caption="<IMG SRC='mailread.gif'> "+Caption;
else
Caption="<IMG SRC='mail.gif'> "+Caption;
}
Caption=CropString(Caption,650);
document.getElementById("ListButton"+i).innerHTML=Caption;
}
}
function URL(ListButton)
{
if (ListButton-1+TopListButton<=FolderCount)
{
return "Default"+(Dummy*1+1)+".htm?ID="+MAPI.FolderEntryID(ListButton-1+TopListButton)+"&Dummy="+(Dummy*1+1);
} else
{
return "eMailView.htm?ID="+MAPI.ItemEntryID(ListButton-1+TopListButton-FolderCount);
}
}
function ParseParameters()
{
var strSearch = location.search.substring( 1 ); // remove '?'
var astrAllParam = strSearch.split( '&' );
for ( var index = 0; index < astrAllParam.length; index++ )
{
var astrTemp = astrAllParam[index].split( '=' );
var paramName = astrTemp[0];
var paramValue = astrTemp[1];
if (paramName=="ID")
FolderID=paramValue;
if (paramName=="Dummy")
Dummy=paramValue;
}
}
function myonRemoteEvent(keyCode)
{
if ((oCurFocus.id!="ListButton1") && (oCurFocus.id!="ListButton"+ListButtonsDisplayed))
UpdateListButtons();
onRemoteEvent(keyCode);
}
function PixelWidth(s)
{
ruler.innerHTML=s;
while (ruler.readyState!="complete")
{
}
return ruler.offsetWidth;
}
function CropString(s,width)
{
while (PixelWidth(s)>width)
s=s.substring(0,s.length-1);
return s;
}
MAPI = new ActiveXObject("MCELook.MapiHelper");
MAPI.Startup();
ParseParameters();
if (FolderID=="x")
{
FolderID=MAPI.StartFolderID();
}
document.all.FolderName.innerHTML=MAPI.FolderName(FolderID);
UpdateListButtons();
</script>
<span id="pagetext" style="FONT-SIZE: 100pt; FILTER: alpha(opacity=30); LEFT: -15px; WIDTH: 300px; COLOR: #ffffff; POSITION: absolute; TOP: -40px; FONT-FAMILIY: Tahoma">
<FONT face="Tahoma">email</FONT></span>
</body>
</html>
Hier die Veränderung im SDK, ich hoffe, ich habe nicht noch mehr Veränderungen vorgenommen
Basicfunctions.js: (einfach die beiden Case-Anweisungen verändern)
case 38: // Up button selected
if ((oCurFocus.id == "ListButton1") && (TopListButton>1))
{
TopListButton--;
updateCounter();
UpdateListButtons();
} else
changeFocus("up");
break;
case 40: // Down button selected
if (oCurFocus.id == "ListButton"+ListButtonsDisplayed)
{
if (TopListButton+ListButtonsDisplayed-1<MaxListButtons)
{
TopListButton++;
updateCounter();
UpdateListButtons();
}
} else
changeFocus("down");
break;
Scrolling.js:
function pageUpDown(direction)
{
// This function determines what to do if the user presses the Page Up (+) or Page Down (-) key
if ((oCurFocus.id=="ListButton"+ListButtonsDisplayed) && (direction=="down"))
{
TopListButton+=10;
while (TopListButton-1+ListButtonsDisplayed>MaxListButtons)
TopListButton--;
oCurFocus=document.getElementById("ListButton"+ListButtonsDisplayed);
oCurFocus.focus();
UpdateListButtons();
updateCounter();
return;
}
if ((oCurFocus.id=="ListButton1") && (direction=="up"))
{
TopListButton-=10;
if (TopListButton<1)
{
TopListButton=1;
}
oCurFocus=document.getElementById("ListButton1");
oCurFocus.focus();
UpdateListButtons();
updateCounter();
return;
}
// Call the getScrollParent function to find the scrollable parent object
var oScrollParent = getScrollParent()
if (oScrollParent == null)
{
return
}
// find correct button to focus on
var oScrollToBtn = getScrollToButton(oScrollParent, direction);
oCurFocus = oScrollToBtn;
oCurFocus.focus();
// check if scrolling has taken place, and update positions of scrollable elements if needed
if (didScroll())
{
updateScrollPositions()
}
}
function updateCounter()
{
/* this function updates the numeric value for the item counter found at the lower right of
each scrollable menu in the templates, to indicate which item currently has focus. */
if (isCounter != true)
{
// if there is no counter on the page, return
return
}
// variable to track whether focus is in scrollable menu
var bFocusInMenu = false
//Loop through all focusable items in scrolling menu
for (i=0; i<aScrollBtnsArray.length; i++)
{
// if item currently has focus ...
if (aScrollBtnsArray[i] == oCurFocus)
{
if (scrollspan.ListButtons == "true")
counterNum.innerHTML = (i+TopListButton);
else
// set counter number to show which item has focus
counterNum.innerHTML = (i + 1);
// update variable to indicate focus is in scrollable menu
bFocusInMenu = true
}
}
// if focus in in menu, make sure arrows are not grayed out.
if (bFocusInMenu == true)
{
itemCounterSpan.style.filter = "none"
}
// Else gray out arrows to indicate disabled state.
else
{
itemCounterSpan.style.filter = "alpha(opacity=50)"
}
}
Das sollte es gewesen sein. Der Code sollte sich von selbst erklären.
Viel Spass und schick mir mal ein paar von Deinen Plugins zu
M.
Intel DG41TY | Intel Core 2 Duo E8400 | 4GB RAM | 3.5 TB HD | Cine 2 mit Flex-Erweiterung | Windows 7 | 2 x XBOX