snippets / language / javascript

All snippets for language javascript (69)

  1. hasErrorLoginUIManipulation(outputLoc,key)

    hasErrorLoginUIManipulation(outputLoc,key)

     1 function hasErrorLoginUIManipulation(outputLoc,key) {
    2
    3 $('loginPage').style.display = 'block';
    4
    5 if (getResourceString(key).indexOf('undefine:') == -1) {
    6 errorHandling('login_error_msg', getResourceString(key), 'block');
    7 } else {
    8 errorHandling('login_error_msg', outputLoc["description"], 'block');
    9 }
    10
    11 }
  2. blockContact

    blockContact

     1 function blockContact(fulladd) {
    2
    3 if (connectionObj.forcedLogout) {
    4 isDisconnectedForcedLogout();
    5 return false;
    6 }
    7
    8 var selFullAddress = fulladd;
    9 var paramBlockContact= 'blockContact='+'&contactID='+selFullAddress;
    10
    11 new Ajax.Request(contactBlockUrl, {
    12
    13 method : 'post',
    14 onComplete : function(xh) {
    15 var output = JSON.parse(xh.responseText);
    16
    17 if (!connectionObj.forcedLogout) {
    18 if (isDisconnectedForcedLogout(output)) {
    19 return false;
    20 }
    21 } else {
    22 isDisconnectedForcedLogout(output);
    23 return false;
    24 }
    25
    26 if (xh.responseText.toLowerCase().indexOf('error') == -1){
    27 blockContactActual(selFullAddress);
    28 }
    29
    30 },
    31 onFailure : function(xh) {
    32 alert("Oops, there's been an error.");
    33 },
    34 parameters : paramBlockContact
    35
    36 });
    37
    38 }
    Posted by willowdan to javascript blockcontact ... saved by 1 person ... 0 comments ... 6 months, 2 weeks
  3. viewContactInfoActual

    viewContactInfoActual

     1 function viewContactInfoActual(contactIDGlobal){
    2
    3 if (connectionObj.forcedLogout) {
    4 isDisconnectedForcedLogout();
    5 return false;
    6 }
    7
    8 selFullAddress = contactIDGlobal;
    9 var paramViewContactInfo= 'viewContactProfile='+'&contactID='+selFullAddress;
    10
    11 new Ajax.Request(viewContactInfoUrl, {
    12
    13 method : 'post',
    14 onSuccess : function(xh) {
    15 var output = JSON.parse(xh.responseText);
    16
    17 if (!connectionObj.forcedLogout) {
    18 if (isDisconnectedForcedLogout(output)) {
    19 return false;
    20 }
    21 } else {
    22 isDisconnectedForcedLogout(output);
    23 return false;
    24 }
    25
    26 viewContactInfo(output);
    27
    28 },
    29 onFailure : function(xh) {
    30 alert("Oops, there's been an error.");
    31 },
    32 parameters : paramViewContactInfo
    33
    34 });
    35 }
    Posted by willowdan to javascript viewcontactinfoactual ... saved by 1 person ... 0 comments ... 6 months, 2 weeks
  4. listContactsInEditChecked

    listContactsInEditChecked

     1 function listContactsInEditChecked(){
    2 var displayName = '';
    3 var editUserId = '';
    4 var editUserIdCurContact = '';
    5
    6 // initialize to empty
    7 chkdContactsArray = [];
    8
    9 for (var i = 0; i < contactsInContactList(defaultContactList).length; i++) {
    10
    11 for (var j = 0; j < contactsInContactList(curContactList).length;j++) {
    12
    13 if (!contactsInContactList(defaultContactList)[i].wcapUser.isBlocked) {
    14 editUserId = contactsInContactList(defaultContactList)[i].wcapUser.userID.userId;
    15 editUserIdCurContact = contactsInContactList(curContactList)[j].wcapUser.userID.userId;
    16 displayName = contactsInContactList(defaultContactList)[i].displayName;
    17
    18 if (editUserId == editUserIdCurContact) {
    19 $(editUserId+'_checkbox').checked = true;
    20 chkdContactsArray.push(contactsInContactList(curContactList)[j].wcapUser.userID.fullAddress);
    21 }
    22 }
    23 }
    24 }
    25
    26 }
    Posted by willowdan to javascript listcontactsineditchecked ... saved by 1 person ... 0 comments ... 6 months, 2 weeks
  5. updateContactList

    updateContactList

     1 function updateContactList(selectedContacts, newContactListDisplayName) {
    2
    3 if (connectionObj.forcedLogout) {
    4 isDisconnectedForcedLogout();
    5 return false;
    6 }
    7
    8 var fullAddresses = "";
    9 var contactListFullAddress = getContactListID(curContactList);
    10 var uniqueRef="";
    11 var curContactListLoc = curContactList;
    12
    13 for(var i=0; i < chkdContactsArray.length; i++) {
    14 fullAddresses += 'contactID='+ chkdContactsArray[i];
    15 if(i < (chkdContactsArray.length - 1)) {
    16 fullAddresses += '&';
    17 }
    18 }
    19
    20 var paramUpdateContactList = 'updateContactListAndContacts='+'&'+fullAddresses+'&userContactListName='+newContactListDisplayName+'&userContactListID='+contactListFullAddress;
    21
    22 new Ajax.Request(contactListBaseUrl, {
    23
    24 method : 'post',
    25 onSuccess : function(xh) {
    26
    27 var output = JSON.parse(xh.responseText);
    28
    29 if (!connectionObj.forcedLogout) {
    30 if (isDisconnectedForcedLogout(output)) {
    31 return false;
    32 }
    33 } else {
    34 isDisconnectedForcedLogout(output);
    35 return false;
    36 }
    37
    38 if (xh.responseText.toLowerCase().indexOf('error') == -1){
    39
    40 // if contactList displayName has been updated
    41 if (newContactListDisplayName != curContactListLoc) {
    42
    43 uniqueRefContactListGroup = curContactListLoc + '_group';
    44 uniqueRefContactListGroupTop = curContactListLoc + '_groupTop';
    45
    46 uniqueRefContactListGroup = uniqueRefContactListGroup.replace(/\s/, '_');
    47 uniqueRefContactListGroupTop = uniqueRefContactListGroupTop.replace(/\s/, '_');
    48
    49 // removal of all ul tags or all contactLists
    50 if ($(uniqueRefContactListGroup)) {
    51 $(uniqueRefContactListGroup).parentNode.removeChild($(uniqueRefContactListGroup));
    52 }
    53 if ($(uniqueRefContactListGroupTop)) {
    54 $(uniqueRefContactListGroupTop).parentNode.removeChild($(uniqueRefContactListGroupTop));
    55 }
    56
    57 } else {
    58 // if only the members have been edited
    59 for (var i = 0; i < getContactsInCurrentContactList().length; i++) {
    60
    61 uniqueRef = curContactListLoc+'_'+getContactsInCurrentContactList()[i].wcapUser.userID.userId+'_blItem';
    62 if ($(uniqueRef)) {
    63 $(uniqueRef).parentNode.removeChild($(uniqueRef));
    64 }
    65 }
    66
    67 }
    68
    69 // update the data layer
    70 updateContactListData(curContactListLoc, newContactListDisplayName, chkdContactsArray);
    71 }
    72
    73
    74 },
    75 onFailure : function(xh) {
    76 alert("Oops, there's been an error.");
    77 },
    78 parameters : paramUpdateContactList
    79
    80 });
    81
    82 }
    Posted by willowdan to javascript updatecontactlist ... saved by 1 person ... 0 comments ... 6 months, 3 weeks
  6. deleteContactListActual

    deleteContactListActual

     1 function deleteContactListActual() {
    2
    3 if (connectionObj.forcedLogout) {
    4 isDisconnectedForcedLogout();
    5 return false;
    6 }
    7
    8 var fullAddresses = "";
    9 var contactListFullAddress = getContactListID(curContactList);
    10 var uniqueRef="";
    11 var curContactListLoc = curContactList;
    12
    13 var paramDeleteContactList = 'deleteContactList='+'&userContactListID='+contactListFullAddress;
    14
    15 new Ajax.Request(contactListDeleteUrl, {
    16
    17 method : 'post',
    18 onLoading: function() {
    19 if (!$('splashCommonPage')) {
    20 showSplashCommon();
    21 }
    22
    23 },
    24 onSuccess : function(xh) {
    25
    26 hideSplashCommon();
    27
    28 var output = JSON.parse(xh.responseText);
    29
    30 if (!connectionObj.forcedLogout) {
    31 if (isDisconnectedForcedLogout(output)) {
    32 return false;
    33 }
    34 } else {
    35 isDisconnectedForcedLogout(output);
    36 return false;
    37 }
    38
    39 if (xh.responseText.toLowerCase().indexOf('error') == -1){
    40
    41 uniqueRefContactListGroup = curContactListLoc + '_group';
    42 uniqueRefContactListGroupTop = curContactListLoc + '_groupTop';
    43
    44 uniqueRefContactListGroup = uniqueRefContactListGroup.replace(/\s/, '_');
    45 uniqueRefContactListGroupTop = uniqueRefContactListGroupTop.replace(/\s/, '_');
    46
    47 // removal of all ul tags or all contactLists
    48 if ($(uniqueRefContactListGroup)) {
    49 $(uniqueRefContactListGroup).parentNode.removeChild($(uniqueRefContactListGroup));
    50 }
    51 if ($(uniqueRefContactListGroupTop)) {
    52 $(uniqueRefContactListGroupTop).parentNode.removeChild($(uniqueRefContactListGroupTop));
    53 }
    54
    55 deleteContactListID(contactListFullAddress);
    56 }
    57
    58
    59 },
    60 onFailure : function(xh) {
    61 alert("Oops, there's been an error.");
    62 },
    63 parameters : paramDeleteContactList
    64
    65 });
    66
    67 }
    Posted by willowdan to javascript deletecontactlistactual ... saved by 1 person ... 0 comments ... 6 months, 3 weeks
  7. createChatOnClick

    createChatOnClick

     1 function searchChatRoom(searchString, searchType) {
    2
    3 if (connectionObj.forcedLogout) {
    4 isDisconnectedForcedLogout();
    5 return false;
    6 }
    7
    8 var errMsg;
    9 params = "searchGroup=&query=" + searchString + "&queryType=" + searchType;
    10 var noSearchHitRoomNameError = getResourceString("imps.html.searchChatRoom.error.text.noSearchHitRoomName",searchString);
    11 var noSearchHitOwnerError = getResourceString("imps.html.searchChatRoom.error.text.noSearchHitOwner",searchString);
    12 if (searchType=="OWNER_USER_ID") {
    13 errMsg = noSearchHitOwnerError;
    14 } else {
    15 errMsg = noSearchHitRoomNameError;
    16 }
    17
    18 new Ajax.Request(groupSearchUrl, {
    19 method : 'post',
    20 onSuccess: function(xh) {
    21
    22 var output = JSON.parse(xh.responseText);
    23
    24 if (!connectionObj.forcedLogout) {
    25 if (isDisconnectedForcedLogout(output)) {
    26 return false;
    27 }
    28 } else {
    29 isDisconnectedForcedLogout(output);
    30 return false;
    31 }
    32
    33 if (output.code != null) {
    34 errorHandling('searchChatRoomErrorMsg',errMsg,'block');
    35 return false;
    36 } else if (output.length == 0) {
    37 errorHandling('searchChatRoomErrorMsg',errMsg,'block');
    38 return false;
    39 } else {
    40 Windows.close('searchCRoom');
    41 searchChatRoomObj=output;
    42 searchResultsChatRoom(searchChatRoomObj);
    43 }
    44 },
    45 parameters: params
    46 });
    47 }
    Posted by willowdan to javascript createchatonclick ... saved by 1 person ... 0 comments ... 6 months, 3 weeks
  8. 042908

    042908

     1 	+ login (add:
    2
    3 if (outputSpecificClientSettingsObj.setUserAvailabilityAtInactivityEnabled) {
    4 monitorInactivityID = setInterval(toAway, outputSpecificClientSettingsObj.userAvailabilityInactivityTimeout);
    5 }
    6
    7 after hideSplash();)
    8
    9 + openContactListWindow (add profPic.style.width = "50px"; last line of fxn)
    10 + addBuddyToList (add $(groupAddr+'_'+username+'_content').style.width = "50px"; last line of fxn)
    Posted by willowdan to javascript 042908 ... saved by 1 person ... 0 comments ... 6 months, 3 weeks
  9. deleteContactListActual

    deleteContactListActual

     1 function deleteContactListActual() {
    2 var fullAddresses = "";
    3 var contactListFullAddress = getContactListID(curContactList);
    4 var uniqueRef="";
    5 var curContactListLoc = curContactList;
    6
    7 var paramDeleteContactList = 'deleteContactList='+'&userContactListID='+contactListFullAddress;
    8
    9 new Ajax.Request(contactListDeleteUrl, {
    10
    11 method : 'post',
    12 onLoading: function() {
    13 if (!$('splashCommonPage')) {
    14 showSplashCommon();
    15 }
    16
    17 },
    18 onSuccess : function(xh) {
    19
    20 hideSplashCommon();
    21 if (xh.responseText.toLowerCase().indexOf('error') == -1){
    22
    23 uniqueRefContactListGroup = curContactListLoc + '_group';
    24 uniqueRefContactListGroupTop = curContactListLoc + '_groupTop';
    25
    26 uniqueRefContactListGroup = uniqueRefContactListGroup.replace(/\s/, '_');
    27 uniqueRefContactListGroupTop = uniqueRefContactListGroupTop.replace(/\s/, '_');
    28
    29 // removal of all ul tags or all contactLists
    30 if ($(uniqueRefContactListGroup)) {
    31 $(uniqueRefContactListGroup).parentNode.removeChild($(uniqueRefContactListGroup));
    32 }
    33 if ($(uniqueRefContactListGroupTop)) {
    34 $(uniqueRefContactListGroupTop).parentNode.removeChild($(uniqueRefContactListGroupTop));
    35 }
    36
    37 deleteContactListID(contactListFullAddress);
    38 }
    39
    40
    41 },
    42 onFailure : function(xh) {
    43 alert("Oops, there's been an error.");
    44 },
    45 parameters : paramDeleteContactList
    46
    47 });
    48
    49 }
    Posted by willowdan to javascript deletecontactlistactual ... saved by 1 person ... 0 comments ... 6 months, 3 weeks
  10. deleteContactID

    deleteContactID

     1 function deleteContactID(fullAddress,groupDisplayname) {
    2 if (removeAndBlock){
    3 for (var i=0;i<outputContactListObj.length;i++){
    4 for (var j = 0; j < (outputContactListObj[i].contactsList.length != 0? outputContactListObj[i].contactsList.length:1); j++) {
    5 if (outputContactListObj[i].contactsList.length == 0) continue;
    6 if (outputContactListObj[i].contactListID.address == groupDisplayname){
    7 if (outputContactListObj[i].contactsList[j].wcapUser.userID.address == fullAddress){
    8 outputContactListObj[i].contactsList.splice(j,1);
    9 }
    10 }
    11 else if (outputContactListObj[i].contactListID.address != groupDisplayname){
    12 if (outputContactListObj[i].contactsList[j].wcapUser.userID.address == fullAddress){
    13 if (!outputContactListObj[i].contactsList[j].wcapUser.isBlocked){
    14 outputContactListObj[i].contactsList[j].wcapUser.isBlocked = true;
    15 }
    16 }
    17 }
    18 }
    19 }
    20 } else {
    21 for (var i=0;i<outputContactListObj.length;i++){
    22 for (var j = 0; j < (outputContactListObj[i].contactsList.length != 0? outputContactListObj[i].contactsList.length:1); j++) {
    23 if (outputContactListObj[i].contactsList.length == 0) continue;
    24 //if (outputContactListObj[i].displayName == groupDisplayname){
    25 if (outputContactListObj[i].contactsList[j].wcapUser.userID.address == fullAddress){
    26 outputContactListObj[i].contactsList.splice(j,1);
    27 }
    28 //}
    29 }
    30 }
    31 }
    32
    33 updateContactsObjOnOfflineAlpha();
    34 contactsSorting=='sortAlpha'?sortMainAlpha(false):sortMain(false);
    35 renderContactsMain();
    36 rightClick();
    37 }
    Posted by willowdan to javascript deletecontactid ... saved by 1 person ... 0 comments ... 6 months, 3 weeks
showing 10, 25, 50 items per pages

Pages : 1 2 3 4 5 6 7