function toggleBusServiceBookmark() {
    $('#bookmarkButton').button('toggle');
    if ($('#bookmarkButton').attr('data-bookmarked') == "true") {
        var tempArr = JSON.parse(busServiceCookies);
        var index = tempArr.findIndex(function(element) {
            return element.serviceNo == $('#bookmarkButton').data('serviceno').toString() &&
            element.direction == $('#bookmarkButton').data('direction').toString();
        });
        if (index > -1 ) {
            tempArr.splice(index, 1);
        }

        Cookies.set('busservice',JSON.stringify(tempArr));
        busServiceCookies = Cookies.get('busservice');
        $('#bookmarkButton').attr('data-bookmarked','false');
        $('#bookmarkButton').text("Bookmark");
    } else {
        var tempArr = JSON.parse(busServiceCookies);
        tempArr.push({serviceNo:$('#bookmarkButton').data('serviceno').toString(),direction:$('#bookmarkButton').data('direction').toString()});
        Cookies.set('busservice',JSON.stringify(tempArr));
        busServiceCookies = Cookies.get('busservice');
        $('#bookmarkButton').attr('data-bookmarked','true');
        $('#bookmarkButton').text("Remove Bookmark");
    }

}
// Information Modal and Bus Arrival Information
Information Modal and Bus Arrival Information
Information Modal and Bus Arrival Information
function toggleBusServiceBookmark() {
    $('#bookmarkButton').button('toggle');
    if ($('#bookmarkButton').attr('data-bookmarked') == "true") {
        var tempArr = JSON.parse(busServiceCookies);
        var index = tempArr.findIndex(function(element) {
            return element.serviceNo == $('#bookmarkButton').data('serviceno').toString() &&
            element.direction == $('#bookmarkButton').data('direction').toString();
        });
        if (index > -1 ) {
            tempArr.splice(index, 1);
        }
        Cookies.set('busservice',JSON.stringify(tempArr));
        busServiceCookies = Cookies.get('busservice');
        $('#bookmarkButton').attr('data-bookmarked','false');
        $('#bookmarkButton').text("Bookmark");
    } else {
        var tempArr = JSON.parse(busServiceCookies);
        tempArr.push({serviceNo:$('#bookmarkButton').data('serviceno').toString(),direction:$('#bookmarkButton').data('direction').toString()});
        Cookies.set('busservice',JSON.stringify(tempArr));
        busServiceCookies = Cookies.get('busservice');
        $('#bookmarkButton').attr('data-bookmarked','true');
        $('#bookmarkButton').text("Remove Bookmark");
    }
}
function toggleBusServiceBookmark ( ) { $ ( '#bookmarkButton' ) . button ( 'toggle' ) ; if ( $ ( '#bookmarkButton' ) . attr ( 'data-bookmarked' ) == "true" ) { var tempArr = JSON . parse ( busServiceCookies ) ; var index = tempArr . findIndex ( function ( element ) { return element . serviceNo == $ ( '#bookmarkButton' ) . data ( 'serviceno' ) . toString ( ) && element . direction == $ ( '#bookmarkButton' ) . data ( 'direction' ) . toString ( ) ; } ) ; if ( index > - 1 ) { tempArr . splice ( index , 1 ) ; } Cookies . set ( 'busservice' , JSON . stringify ( tempArr ) ) ; busServiceCookies = Cookies . get ( 'busservice' ) ; $ ( '#bookmarkButton' ) . attr ( 'data-bookmarked' , 'false' ) ; $ ( '#bookmarkButton' ) . text ( "Bookmark" ) ; } else { var tempArr = JSON . parse ( busServiceCookies ) ; tempArr . push ( { serviceNo : $ ( '#bookmarkButton' ) . data ( 'serviceno' ) . toString ( ) , direction : $ ( '#bookmarkButton' ) . data ( 'direction' ) . toString ( ) } ) ; Cookies . set ( 'busservice' , JSON . stringify ( tempArr ) ) ; busServiceCookies = Cookies . get ( 'busservice' ) ; $ ( '#bookmarkButton' ) . attr ( 'data-bookmarked' , 'true' ) ; $ ( '#bookmarkButton' ) . text ( "Remove Bookmark" ) ; } }
Information Modal and Bus Arrival Information
Information Modal and Bus Arrival Information