$(document).ready(function(){
var getWebUrl = window.location.pathname.substring(0,3);
var ht = window.location.protocol;
var GetFullIURL =window.location.href.split(":");
var siteCheck = window.location.pathname;
siteCheck = siteCheck.substring(0,4);
var siteCheck_forum = window.location.pathname;
siteCheck_forum= siteCheck_forum.substring(0,7);
/*Dashboard*/
/*Row5*/
var emptyResults = "
Tiada Slider
";
var row5Html="";
var i=0;
var itemCount;
$().SPServices({
operation: "GetListItems",
async: false,
webURL: "/ms",
listName: "Custom Link",
CAMLRowLimit: 5,
CAMLViewFields: "
",
CAMLQuery:"
TopBar",
completefunc: function (xData, Status) {
itemCount = $(xData.responseXML).SPFilterNode('rs:data').attr("ItemCount");
//alert(itemCount);
$(xData.responseXML).SPFilterNode("z:row").each(function() {
//alert(itemCount);
if(siteCheck.toLowerCase() == "/ms/"){
if(GetFullIURL[0] == "http"){
var n = $(this).attr("ows_Link").toString().indexOf(","); //ms
var link = $(this).attr("ows_Link").substring(0,n); //ms
}
else if(GetFullIURL[0] == "https") {
var n = $(this).attr("ows_Registered_x0020_Link").toString().indexOf(",");
var link = $(this).attr("ows_Registered_x0020_Link").substring(0,n);
var SubstringLink =$(this).attr("ows_Registered_x0020_Link").toString().split(",");
if(SubstringLink[1].trim() == "WORKSPACE"){ //title ms
//alert("WORKSPACE");
var wp="";
if($(this).attr("ows_New_x0020_Tab").toString()=="Yes")
{
wp = "
"+$(this).attr("ows_Title")+"";
}else
{
wp = "
"+$(this).attr("ows_Title")+"";
}
$("#workspaceFetch").append(wp);
}
else if(SubstringLink[1].trim() == "My DASHBOARD"){
//alert("DASHBOARD");
var wp1="";
if($(this).attr("ows_New_x0020_Tab").toString()=="Yes")
{
wp1 = "
"+$(this).attr("ows_Title")+"";
}else
{
wp1 = "
"+$(this).attr("ows_Title")+"";
}
$("#mydashboardFetch").append(wp1);
}
else if(SubstringLink[1].trim() == "LAPORAN"){
//alert("LAPORAN");
var wp2="";
if($(this).attr("ows_New_x0020_Tab").toString()=="Yes"){
wp2 = "
"+$(this).attr("ows_Title")+"";
}else
{
wp2 = "
"+$(this).attr("ows_Title")+"";
}
$("#laporanFetch").append(wp2);
}
else if(SubstringLink[1].trim() == "ADMIN DASHBOARD"){
//alert("LAPORAN");
var wp3="";
if($(this).attr("ows_New_x0020_Tab").toString()=="Yes"){
wp3 = "
"+$(this).attr("ows_Title")+"";
}else{
wp3 = "
"+$(this).attr("ows_Title")+"";
}
//alert(wp);
$("#adminDashboard").append(wp3);
}
}
}
//en
if(siteCheck.toLowerCase() == "/en/"){
if(GetFullIURL[0] == "http"){
//var n = $(this).attr("ows_Link").toString().indexOf(","); //ms
//var link = $(this).attr("ows_Link").substring(0,n); //ms
var n = $(this).attr("ows_Public_x0020_Link").toString().indexOf(","); //en
var link = $(this).attr("ows_Public_x0020_Link").substring(0,n); //en
}
else if(GetFullIURL[0] == "https") {
var n = $(this).attr("ows_Registered_x0020_Link0").toString().indexOf(",");
var link = $(this).attr("ows_Registered_x0020_Link0").substring(0,n);
var SubstringLink =$(this).attr("ows_Registered_x0020_Link0").toString().split(",");
if(SubstringLink[1].trim() == "WORKSPACE"){ //title ms
//alert("WORKSPACE");
//alert($(this).attr("ows_Link").substring(0,n));
var wp4="";
if($(this).attr("ows_New_x0020_Tab").toString()=="Yes")
{
wp4 = "
"+$(this).attr("ows_Title0")+"";
}else
{
wp4 = "
"+$(this).attr("ows_Title0")+"";
}
$("#workspaceFetch").append(wp4);
}
else if(SubstringLink[1].trim() == "My DASHBOARD"){
//alert("DASHBOARD");
var wp5="";
if($(this).attr("ows_New_x0020_Tab").toString()=="Yes")
{
wp5 = "
"+$(this).attr("ows_Title0")+"";
}else
{
wp5 = "
"+$(this).attr("ows_Title0")+"";
}
$("#mydashboardFetch").append(wp5);
}
else if(SubstringLink[1].trim() == "LAPORAN"){
//alert("LAPORAN");
var wp6="";
if($(this).attr("ows_New_x0020_Tab").toString()=="Yes"){
wp6 = "
"+$(this).attr("ows_Title0")+"";
}else
{
wp6 = "
"+$(this).attr("ows_Title0")+"";
}
$("#laporanFetch").append(wp6);
}
else if(SubstringLink[1].trim() == "ADMIN DASHBOARD"){
//alert("LAPORAN");
var wp7="";
if($(this).attr("ows_New_x0020_Tab").toString()=="Yes"){
wp7 = "
"+$(this).attr("ows_Title0")+"";
}else{
wp7 = "
"+$(this).attr("ows_Title0")+"";
}
$("#adminDashboard").append(wp7);
}
}
}
//i++;
//alert(row5Html);
//forum
if(siteCheck_forum == "/forum/"){
if(GetFullIURL[0] == "http"){
var n = $(this).attr("ows_Link").toString().indexOf(","); //ms
var link = $(this).attr("ows_Link").substring(0,n); //ms
}
else if(GetFullIURL[0] == "https") {
var n = $(this).attr("ows_Registered_x0020_Link").toString().indexOf(",");
var link = $(this).attr("ows_Registered_x0020_Link").substring(0,n);
var SubstringLink =$(this).attr("ows_Registered_x0020_Link").toString().split(",");
if(SubstringLink[1].trim() == "WORKSPACE"){ //title ms
//alert("WORKSPACE");
var wp="";
if($(this).attr("ows_New_x0020_Tab").toString()=="Yes")
{
wp = "
"+$(this).attr("ows_Title")+"";
}else
{
wp = "
"+$(this).attr("ows_Title")+"";
}
$("#workspaceFetch").append(wp);
}
else if(SubstringLink[1].trim() == "My DASHBOARD"){
//alert("DASHBOARD");
var wp1="";
if($(this).attr("ows_New_x0020_Tab").toString()=="Yes")
{
wp1 = "
"+$(this).attr("ows_Title")+"";
}else
{
wp1 = "
"+$(this).attr("ows_Title")+"";
}
$("#mydashboardFetch").append(wp1);
}
else if(SubstringLink[1].trim() == "LAPORAN"){
//alert("LAPORAN");
var wp2="";
if($(this).attr("ows_New_x0020_Tab").toString()=="Yes"){
wp2 = "
"+$(this).attr("ows_Title")+"";
}else
{
wp2 = "
"+$(this).attr("ows_Title")+"";
}
$("#laporanFetch").append(wp2);
}
else if(SubstringLink[1].trim() == "ADMIN DASHBOARD"){
//alert("LAPORAN");
var wp3="";
if($(this).attr("ows_New_x0020_Tab").toString()=="Yes"){
wp3 = "
"+$(this).attr("ows_Title")+"";
}else{
wp3 = "
"+$(this).attr("ows_Title")+"";
}
//alert(wp);
$("#adminDashboard").append(wp3);
}
}
}
//forum
});
$("#row5Fetch").append(row5Html);
}
});
/*############### Chat Administrator#######################*/
var row5Html="";
var i=0;
var itemCount;
$().SPServices({
operation: "GetListItems",
async: false,
webURL: "/ms",
listName: "Custom Link",
CAMLRowLimit: 1,
CAMLViewFields: "
",
CAMLQuery:"
Chat",
completefunc: function (xData, Status) {
itemCount = $(xData.responseXML).SPFilterNode('rs:data').attr("ItemCount");
//alert(itemCount);
$(xData.responseXML).SPFilterNode("z:row").each(function() {
//alert(itemCount);
if(GetFullIURL[0] == "http"){
var n = $(this).attr("ows_Link").toString().indexOf(",");
var link = $(this).attr("ows_Link").substring(0,n);
}
else if(GetFullIURL[0] == "http") {
var n = $(this).attr("ows_Registered_x0020_Link").toString().indexOf(",");
var link = $(this).attr("ows_Registered_x0020_Link").substring(0,n);
}
i++;
var nt = "";
if($(this).attr("ows_New_x0020_Tab").toString()=="Yes"){
nt = "target='_blank''";
}
if($(this).attr("ows_Category") == "Chat"){
//alert("masuk");
//alert($(this).attr("ows_Link").substring(0,n));
var wp = "
"+$(this).attr("ows_Title")+"";
$("#chatAdministratorLink").append(wp);
}
//alert(row5Html);
});
$("#row5Fetch").append(row5Html);
}
});
var emptyResults = "
Tiada Slider
";
var row5Html="";
var i=0;
var itemCount;
$().SPServices({
operation: "GetListItems",
async: false,
webURL: "/ms",
listName: "Custom Link",
CAMLRowLimit: 5,
CAMLViewFields: "
",
CAMLQuery:"
LandingPage",
completefunc: function (xData, Status) {
itemCount = $(xData.responseXML).SPFilterNode('rs:data').attr("ItemCount");
$(xData.responseXML).SPFilterNode("z:row").each(function() {
//alert(itemCount);
if(GetFullIURL[0] == "http"){
var n = $(this).attr("ows_Link").toString().indexOf(",");
var link = $(this).attr("ows_Link").substring(0,n);
}
else if(GetFullIURL[0]=="https" ) {
var n = $(this).attr("ows_Registered_x0020_Link").toString().indexOf(",");
var link = $(this).attr("ows_Registered_x0020_Link").substring(0,n);
}
i++;
var nt = "";
if($(this).attr("ows_New_x0020_Tab").toString()=="Yes"){
nt = "target='_blank''";
}
row5Html+="
"+$(this).attr("ows_Title")+" ";
//alert(row5Html);
});
$("#row5Fetch").append(row5Html);
}
});
/*End Row5*/
/*############### #Pengumuman #########################*/
var emptyResults = "
Tiada Pengumuman Terkini
"; //2015-09-14T18:45:20Z
var count=0;
$().SPServices({
operation: "GetListItems",
async: false,
listName: "Pengumuman",
CAMLRowLimit: 5,
CAMLViewFields: "
",
CAMLQuery:"
",
completefunc: function (xData, Status) {
var itemCount = $(xData.responseXML).SPFilterNode('rs:data').attr("ItemCount");
//alert("Pengumuman"+itemCount);
$(xData.responseXML).SPFilterNode("z:row").each(function() {
//alert($(this).attr("ows_URL"));
//var nS = n.toString();
var annHtml = "
"+$(this).attr("ows_Title");
if($(this).attr("ows_URL")!=null ){
var n = $(this).attr("ows_URL").toString().indexOf(",");
annHtml +="Info Lanjut
";
}
else{
annHtml +="
";
}
$("#pengumumanBox").append(annHtml);
//count +=1;
//if(count % 2 == 0 && count <= 5){
// var annHtml = "
";
// $("#pengumumanBox").append(annHtml);
//}
//else if( count <= 5 ){
// var annHtml = "
";
// $("#pengumumanBox").append(annHtml);
//}
});
}
});
/*############### #Berita #########################*/
var emptyResults = "
";
var countB=0;
var newsHtml="";
var indicatorHtml = "";
var i=0;
var j=0;
var dot3="";
$().SPServices({
operation: "GetListItems",
async: false,
listName: "Berita",
CAMLRowLimit: 2,
CAMLViewFields: "
",
completefunc: function (xData, Status) {
var itemCount = $(xData.responseXML).SPFilterNode('rs:data').attr("ItemCount");
$(xData.responseXML).SPFilterNode("z:row").each(function() {
if(countB == 0){
if(i==0){
newsHtml +="