//////////////////////////////////////////////////////////// // GEEVEE.JS // //////////////////////////////////////////////////////////// /* ORDER OF THE JSes 1-geevee.js 2-login.js 3-advanced_search.js 4-flashplayer.js 5-videodiscussion.js 6-browse.js 7-upload.js 8-clan.js 9-flagvid.js 10-facebook.js 11-userdiscussion.js */ var base_url = 'http://www.gamevee.com'; //////////////////////// // 1-geevee.js //////////////////////// function radioButton2(num, id, toggle, group, unselectedDivClass, selectedDivClass, unselectedLinkClass, selectedLinkClass) // toggle: Tells the function if the group of radio buttons must always have 1 button active at all times or if the buttons can be toggled on or off. 0 = always active 1 = on/off { var selected = document.getElementById(group+'_SEL'); var clicked = document.getElementById(group+'_val_'+id); if (selected.value == clicked.value && toggle == 1) { selected.value = ""; } else if (selected.value != clicked.value) { selected.value = clicked.value; } for (var i = 0; i Add Comment or Highlight'; } } if (mode == "save"){ if(document.forms[form].addCommentText.value.match(/([A-Za-z0-9]|\!|\@|\#|\$|\%|\^|\&|\*|\(|\)|\_|\+|\-|\=|\||\\|\}|\{|\;|\:|\'|\"|\?|\>|\<|\,|\.|\/|\\|\`){1,}/gi)){ Effect.BlindUp(field, {duration:0.0}); Effect.BlindDown ('addCommentLink', {duration:0.0}); new Ajax.Request(base_url+"videodiscussioncontroller/save/"+escape(new Date().getTime()), opt); } else { alert("Please leave a comment."); } } else { Effect.BlindUp(field, {duration:0.0}); Effect.BlindDown ('addCommentLink', {duration:0.0}); //new Ajax.Request(base_url+"videodiscussioncontroller/delete/", opt); document.getElementById('addCommentText').innerHTML = ""; document.getElementById('commentHref').innerHTML = ' Add Comment or Highlight'; } } function voteVideoDiscussion(dissid,videoid,vote) { var opt= { method: 'get', onSuccess: function(t) { getVideoDiscussion('ajaxCommentDiv', videoid,'new'); } } new Ajax.Request(base_url+"videodiscussioncontroller/vote/"+dissid+"/"+vote, opt); } /* Get new video comment form */ function getNewVideoCommentForm(field, videoId, discussionId, mode, div, date){ document.getElementById('commentHref').innerHTML = '
Add Comment or Highlight
'; new Ajax.Updater(field, base_url+"videodiscussioncontroller/add/"+ videoId + "/" + discussionId + "/" + mode + "/" + escape(new Date().getTime()), { onSuccess: function(t) { Effect.BlindDown(field, {afterFinish:initialize}); Effect.BlindUp('addCommentLink', {duration:0.0}); } }); } /* Get new video comment form */ function getNewVideoReplyCommentForm(field, videoId, discussionId, mode, div){ document.getElementById(div).innerHTML = ' permalink'; new Ajax.Updater(field, base_url+"videodiscussioncontroller/add/"+ videoId + "/" + discussionId + "/" + mode + "/" + escape(new Date().getTime()), { onSuccess: function(t) { Effect.BlindDown(field, {afterFinish:initialize}); } }); } function saveDissHL(dissid,id,start,end,desc,date){ document.forms['discussionForm'].highlightstart.value=start; document.forms['discussionForm'].highlightend.value=end; document.forms['discussionForm'].highlightdesc.value=desc; document.forms['discussionForm'].highlightid.value=id; } function saveEditVideoHL(vidid,id,start,end,desc,date){ var formName = 'video'+vidid; if(document.forms[formName]) { document.forms[formName].highlightstart.value=start; document.forms[formName].highlightend.value=end; document.forms[formName].highlightdesc.value=desc; document.forms[formName].highlightid.value=id } else { document.getElementById('HLstart'+vidid).value = start; document.getElementById('HLend'+vidid).value = end; document.getElementById('HLid'+vidid).value = id; document.getElementById('HLdesc'+vidid).value = desc; } //alert("updated "+ formName); } /* Get new all video comments */ function getVideoDiscussion(field, videoId, sort, date) { // new Ajax.Updater(field, base_url+"videodiscussioncontroller/show/"+ videoId + "/" + sort + "/" + escape(new Date().getTime()),{ // method: 'get' //}); var vdTempDiv = document.createElement("div"); document.getElementById(field).innerHTML=" "; var opt= { method: 'get', onSuccess: function(t) { vdTempDiv.innerHTML = t.responseText; document.getElementById(field).appendChild(vdTempDiv); } } var opt2= { method: 'get', onSuccess: function(t) { var response = t.responseText; eval(response); } } new Ajax.Request(base_url+"videodiscussioncontroller/show/"+ videoId + "/" + sort + "/" + escape(new Date().getTime()), opt); new Ajax.Request(base_url+"videodiscussioncontroller/timer/"+ videoId+"/"+sort, opt2); } //GETS THE EDIT DISCUSSION REPLY FORM function editVideoDiscussion(field1,field2,discussionId,videoId,mode){ new Ajax.Updater(field2, base_url+"videodiscussioncontroller/edit/"+ videoId+"/"+discussionId + "/" + mode + "/" + escape(new Date().getTime()), { method: 'get', onSuccess: function(t) { document.getElementById(field1).style.display = 'none'; Effect.BlindDown(field2, {duration:0.0}); } }); } function cancelVideoDiscussion(field1,field2) { document.getElementById(field1).style.display = 'none'; document.getElementById(field2).style.display = 'block'; } function clipDis(text2copy) { myregexp = new RegExp("#(.*)$", "i"); var holdDom = location.href.replace(myregexp, ""); //alert(holdDom); text2copy = holdDom + '#' + text2copy; if (window.clipboardData) { window.clipboardData.setData("Text",text2copy); } else { //alert("window.clipboardData: "+window.clipboardData); var flashcopier = 'flashcopier'; if(!document.getElementById(flashcopier)) { var divholder = document.createElement('div'); divholder.id = flashcopier; document.body.appendChild(divholder); } document.getElementById(flashcopier).innerHTML = ''; var divinfo = ''; document.getElementById(flashcopier).innerHTML = divinfo; } } function CopyPlusSelect(FData) { var dataVal = eval('document.'+FData); dataVal.focus(); dataVal.select(); var copyText = dataVal.value; if (window.clipboardData) { // IE send-to-clipboard method. window.clipboardData.setData('Text', copyText); } else if (window.netscape) { // You have to sign the code to enable this or allow the action in about:config by changing user_pref("signed.applets.codebase_principal_support", true); netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); // Store support string in an object. var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString); if (!str) return false; str.data=copyText; // Make transferable. var trans = Components.classes["@mozilla.org/widget/transferable;1"].createInstance(Components.interfaces.nsITransferable); if (!trans) return false; // Specify what datatypes we want to obtain, which is text in this case. trans.addDataFlavor("text/unicode"); trans.setTransferData("text/unicode",str,copyText.length*2); var clipid=Components.interfaces.nsIClipboard; var clip = Components.classes["@mozilla.org/widget/clipboard;1"].getService(clipid); if (!clip) return false; clip.setData(trans,null,clipid.kGlobalClipboard); } } function countdown(fd, secs, removeDiv){ if (secs<=0){ secs=0; if (document.getElementById(removeDiv)){ document.getElementById(removeDiv).innerHTML = " "; } } else { secs -= 1; setTimeout("countdown('" + fd + "', " + secs + ", '" + removeDiv + "')",1000); if(document.getElementById(fd)){ if (document.getElementById(fd).childNodes[0]) { document.getElementById(fd).childNodes[0].nodeValue=secs; }else if (document.getElementById(fd).value){ document.getElementById(fd).value=secs; } else { document.getElementById(fd).innerHTML=secs; } } } } //////////////////////// // 6-browse.js //////////////////////// function toggleBrowseCategory(prefix, length, id) { Effect.Appear('loadergifbrowse', {duration:0.2}); //reset pagination document.getElementById('paginationPage').value = "1"; fieldName = prefix + id; input = document.getElementById(fieldName); buttonName = prefix + "BUTTON_" + id; button = document.getElementById(buttonName) if(input.value == 0) { input.value = 1; button.className = "long" + length + "active"; } else { input.value = 0; button.className = "long" + length; } updateBrowseCategoryList(); } function toggleBrowseCategoryPopular(value) { Effect.Appear('loadergifbrowse', {duration:0.2}); document.getElementById('paginationPage').value = "1"; document.getElementById('popularRecentSort').value = value; var otherValue = "recent"; if(value == "recent") otherValue = "popular"; document.getElementById(value + "SortTab").className = "tabactive"; document.getElementById(otherValue + "SortTab").className = "tab"; updateBrowseCategoryList(); } function setBrowseCategoryPagination(number) { Effect.Appear('loadergifbrowse', {duration:0.2}); document.getElementById('paginationPage').value = number; updateBrowseCategoryList(); } function updateBrowseCategoryList() { var opt = { method:'post', parameters: $('browseForm').serialize(true), onSuccess:function(t) { Effect.Fade('loadergifbrowse', {duration:0.2}); } } new Ajax.Updater('browseVideoListDiv', base_url + 'videocontroller/ajaxBrowseCategorySort', opt); } function openBrowseButtons() { Effect.Appear('filterButtonsDiv', {duration:1.0}); Effect.Appear('filterButtonsTabs', {duration:1.0}); } function runBrowsePlatformUpdate() { Effect.Appear('loadergifbrowse', {duration:0.2}); document.getElementById('paginationPage').value = "1"; updateBrowsePlatformList(); } function toggleBrowsePlatformPopular(value) { Effect.Appear('loadergifbrowse', {duration:0.2}); document.getElementById('paginationPage').value = "1"; document.getElementById('popularRecentSort').value = value; var otherValue = "recent"; if(value == "recent") otherValue = "popular"; document.getElementById(value + "SortTab").className = "tabactive"; document.getElementById(otherValue + "SortTab").className = "tab"; updateBrowsePlatformList(); } function setBrowsePlatformPagination(number) { Effect.Appear('loadergifbrowse', {duration:0.2}); document.getElementById('paginationPage').value = number; updateBrowsePlatformList(); } function updateBrowsePlatformList() { var opt = { method:'post', parameters: $('browsePlatformForm').serialize(true), onSuccess: function(t) { Effect.Fade('loadergifbrowse', {duration:0.2}); } } new Ajax.Updater('browseVideoListDiv', base_url + 'videocontroller/ajaxBrowsePlatformSort', opt); } function toggleBrowseGamePopular(value) { Effect.Appear('loadergifbrowse', {duration:0.2}); document.getElementById('paginationPage').value = "1"; document.getElementById('popularRecentSort').value = value; var otherValue = "recent"; if(value == "recent") otherValue = "popular"; document.getElementById(value + "SortTab").className = "tabactive"; document.getElementById(otherValue + "SortTab").className = "tab"; updateBrowseGameList(); } function setBrowseGamePagination(number) { Effect.Appear('loadergifbrowse', {duration:0.2}); document.getElementById('paginationPage').value = number; updateBrowseGameList(); } function updateBrowseGameList() { var opt = { method:'post', parameters: $('browseGameForm').serialize(true), onSuccess: function(t) { Effect.Fade('loadergifbrowse', {duration:0.2}); } } new Ajax.Updater('browseVideoListDiv', base_url + 'videocontroller/ajaxBrowseGameSort', opt); } //////////////////////// // 7-upload.js //////////////////////// function openProgressBar() { document.getElementById('ProgressBar1').className = "loaderparent"; document.getElementById('ProgressBar3').className = "loadertransparent"; Effect.Appear('ProgressBar2', {duration:0.4}); } function checkIfTheySelectedOther(id, idOfOther) { if(document.getElementById('game' + id).value == idOfOther) Effect.BlindDown('selectedOtherDiv' + id, {duration:0.2}); else Effect.BlindUp('selectedOtherDiv' + id, {duration:0.0}); } function addCertainUploadGrab(val) { if(document.getElementById('usernameshare').value == '') { alert("You didn't enter anything."); } else { list = document.getElementById('friendsIdList'); if(list.value == "") { list.value = val; } else { list.value = list.value + "," + val; } updateCertainUploadGrab(); document.getElementById('usernameshare').value = ''; } } function ajaxRemoveUploadGrab(id) { var field = document.getElementById("friendsIdList"); var value = field.value; newValue = value.replace("," + id, ""); if(newValue == value) { newValue = value.replace(id + ",", ""); } if(newValue == value) { newValue = value.replace(id, ""); } field.value = newValue; updateCertainUploadGrab() } function updateCertainUploadGrab() { var value = document.getElementById('friendsIdList').value; new Ajax.Updater("sharefriendslist", base_url + 'grabcontroller/ajaxUpdateMyUploadGrab/', {method: 'post', parameters:{name:value}}); } function openUploadGrabShare() { var val = document.getElementById('share').value; if (val == 'certainfriends') { Effect.BlindDown('shareFriends', {duration:0.2}); Effect.BlindUp('sharePublic',{duration:0.0}); } else { Effect.BlindUp('shareFriends',{duration:0.0}); } if (val == 'public') { Effect.BlindDown('sharePublic', {duration:0.2}); Effect.BlindUp('shareFriends',{duration:0.0}); } else { Effect.BlindUp('sharePublic',{duration:0.0}); } } function checkUploadForm(stuff) { var errors = ""; if(getE('upload1').value == "" && getE('upload2').value == "" && getE('upload3').value == "") { errors += "You must select a video to upload."; } if(getE('upload1').value != "" || getE('upload2').value != "" || getE('upload3').value != "" ) { for(i = 1; i < 4; i++) { if(getE('upload' + i).value != "") { if(getE('videotitle' + i).value == "" || getE('videotitle' + i).value == "video title") { errors += "Video #" + i + " - Video Title is required.\n"; } if(getE('description' + i).value == "") { errors += "Video #" + i + " - Description is required.\n"; } if(getE('game' + i).value == "") { errors += "Video #" + i + " - Game Title is required.\n"; } if(getE('otherGameTitleID').value == getE('game' + i).value) { if( getE('customGameTitle' + i).value == "" ) { errors += "Video #" + i + " - Game Title is required.\n"; } } if(getE('category' + i).value == "") { errors += "Video #" + i + " - Category is required.\n"; } if(getE('platform' + i).value == "") { errors += "Video #" + i + " - Platform is required.\n"; } } } } if(errors.length > 0) { alert(errors); return false; } else { document.getElementById('uploadButton').style.visibility = 'hidden'; openProgressBar(); UploadProgressMeter_Start(stuff); return true; } } function addCertainUploadFriend(num, val) { if(document.getElementById('usernameshare'+num).value == '') { alert("You didn't enter anything."); } else { list = document.getElementById('friendsIdList' + num); if(list.value == "") { list.value = val; } else { var myString = list.value; if(myString.indexOf(val) == -1) list.value = list.value + "," + val; } updateCertainUploadFriends(num); document.getElementById('usernameshare'+num).value = ''; } } function ajaxRemoveUploadFriend(num, id) { var field = document.getElementById("friendsIdList" + num); var value = field.value; newValue = value.replace("," + id, ""); if(newValue == value) { newValue = value.replace(id + ",", ""); } if(newValue == value) { newValue = value.replace(id, ""); } field.value = newValue; updateCertainUploadFriends(num) } function updateCertainUploadFriends(num) { var value = document.getElementById('friendsIdList' + num).value; new Ajax.Updater("sharefriendslistAjax" + num, base_url + 'usercontroller/ajaxUpdateMyUploadFriends/' + num, {method: 'post', parameters:{name:value}}); } function openUploadShare(num) { var val = document.getElementById('share' + num).value; if (val == 'certainfriends' || val == 'certainclans') { Effect.BlindDown('shareFriends' + num, {duration:0.2}); Effect.BlindUp('sharePublic' + num,{duration:0.0}); } else { Effect.BlindUp('shareFriends' + num,{duration:0.0}); } if (val == 'public') { Effect.BlindDown('sharePublic' + num, {duration:0.2}); Effect.BlindUp('shareFriends' + num,{duration:0.0}); } else { Effect.BlindUp('sharePublic' + num,{duration:0.0}); } } function addCertainUploadClan(num, val) { if(document.getElementById('usernameshare'+num).value == '') { alert("You didn't enter anything."); } else { list = document.getElementById('friendsIdList' + num); if(list.value == "") { list.value = val; } else { var myString = list.value; alert(list.value); alert(val); if(myString.indexOf(val) == -1) list.value = list.value + "," + val; } updateCertainUploadClans(num); document.getElementById('usernameshare'+num).value = ''; } } function ajaxRemoveUploadClan(num, id) { var field = document.getElementById("friendsIdList" + num); var value = field.value; newValue = value.replace("," + id, ""); if(newValue == value) { newValue = value.replace(id + ",", ""); } if(newValue == value) { newValue = value.replace(id, ""); } field.value = newValue; updateCertainUploadClans(num) } function updateCertainUploadClans(num) { var value = document.getElementById('friendsIdList' + num).value; new Ajax.Updater("sharefriendslist" + num, base_url + 'clancontroller/ajaxUpdateMyUploadClans/' + num, {method: 'post', parameters:{name:value}}); } function openUploadClanShare(num) { var val = document.getElementById('share' + num).value; if (val == 'certainclans') { Effect.BlindDown('shareClans' + num, {duration:0.2}); Effect.BlindUp('sharePublic' + num,{duration:0.0}); } else { Effect.BlindUp('shareClans' + num,{duration:0.0}); } if (val == 'public') { Effect.BlindDown('sharePublic' + num, {duration:0.2}); Effect.BlindUp('shareClans' + num,{duration:0.0}); } else { Effect.BlindUp('sharePublic' + num,{duration:0.0}); } } function addCertainUploadClan(num, val) { if(document.getElementById('usernameshare'+num).value == '') { alert("You didn't enter anything."); } else { list = document.getElementById('friendsIdList' + num); if(list.value == "") { list.value = val; } else { list.value = list.value + "," + val; } updateCertainUploadClans(num); document.getElementById('usernameshare'+num).value = ''; } } function setHiddenTermsValue(val) { if(val == true) { document.getElementById('termsagree').value = 1; } else { document.getElementById('termsagree').value = ""; } } function setHiddenAgeValue(val) { if(val == true) { document.getElementById('agehidden').value = 1; } else { document.getElementById('agehidden').value = ""; } } function getE(id) { return document.getElementById(id); } function addUploadHighlight(id) { video = document.getElementById('uploadhighlight'+id); button = document.getElementById('highlightbutton'+id); link = document.getElementById('uploadhighlightlink'+id); if (video.value == "") { video.value = "on"; button.className = "edithighlightbuttonon"; link.innerHTML = "I am Highlighting this video..."; } else { video.value = ""; button.className = "edithighlightbutton"; link.innerHTML = "I want to Highlight this video..."; } } function ajaxMakeHighlight() { window.location = window.location; } function saveAndPost(videoid, divid) { if (divid == "") { if ((document.getElementById('videotitle').value == "") || (document.getElementById('videodesc').value == "") || (document.getElementById('game').value == "")) { alert('A video title and video description are required'); } else { var videotitle = document.getElementById('videotitle').value; var videodesc = document.getElementById('videodesc').value; var categoryid = document.getElementById('category').value; var share = document.getElementById('share' + videoid).value; var gameid = document.getElementById('game').value; var customGameTitle = document.getElementById('customGameTitle').value; var platformid = document.getElementById('platform').value; var HLstart = document.getElementById('HLstart'+videoid).value; var HLend = document.getElementById('HLend'+videoid).value; var HLid = document.getElementById('HLid'+videoid).value; var HLdesc = document.getElementById('HLdesc'+videoid).value; var opt = { method: 'post', parameters: {videoid:videoid, videotitle:videotitle, videodesc:videodesc, customGameTitle:customGameTitle, categoryid:categoryid, share:share, gameid:gameid, platformid:platformid, HLstart:HLstart, HLend:HLend, HLid:HLid, HLdesc:HLdesc}, onSuccess: function(t) { window.location = base_url; } } new Ajax.Request(base_url + 'usercontroller/submithighlight', opt); } } else { if ((document.getElementById('videotitle'+divid).value == "") || (document.getElementById('videodesc'+divid).value == "") || (document.getElementById('game'+divid).value == "")) { alert('A video title and video description are required'); } else { var videotitle = document.getElementById('videotitle'+divid).value; var videodesc = document.getElementById('videodesc'+divid).value; var categoryid = document.getElementById('category'+divid).value; var share = document.getElementById('share'+divid).value; var gameid = document.getElementById('game'+divid).value; var customGameTitle = document.getElementById('customGameTitle'+divid).value; var platformid = document.getElementById('platform'+divid).value; var HLstart = document.getElementById('HLstart'+videoid).value; var HLend = document.getElementById('HLend'+videoid).value; var HLid = document.getElementById('HLid'+videoid).value; var HLdesc = document.getElementById('HLdesc'+videoid).value; var opt = { method: 'post', parameters: {videoid:videoid, divid:divid, videotitle:videotitle, videodesc:videodesc, categoryid:categoryid, share:share, gameid:gameid, customGameTitle:customGameTitle, platformid:platformid, HLstart:HLstart, HLend:HLend, HLid:HLid, HLdesc:HLdesc}, onSuccess: function(t) { new Ajax.Updater('highlight'+divid, base_url + 'usercontroller/highlightcomplete'); } } new Ajax.Request(base_url + 'usercontroller/submithighlight', opt); } } } function cancelAndTrash(videoid) { var opt = { method: 'post', parameters: {videoid:videoid}, onSuccess: function(t) { window.location = base_url; } } new Ajax.Request(base_url + 'usercontroller/ajaxDeleteVideo', opt); } //////////////////////// // 8-clan.js //////////////////////// function ajaxRemoveMember(user, clan) { var opt = { method: 'post', parameters: {user:user, clan:clan}, onSuccess: function(t) { window.location.reload(true); } } new Ajax.Request(base_url + 'clancontroller/ajaxRemoveMember', opt); } function ajaxCancelInvite(id, clanid) { var opt = { method: 'post', parameters: {id:id, clanid:clanid}, onSuccess: function(t) { window.location.reload(true); } } new Ajax.Request(base_url + 'clancontroller/ajaxCancelInvite', opt); } function ajaxInviteAction (action, clanid, username) { var opt = { method: 'post', parameters: {action:action, clanid:clanid}, onSuccess: function(t) { window.location = base_url + 'user/' + username + '/clans'; } } new Ajax.Request(base_url + 'clancontroller/ajaxInviteAction', opt); } function ajaxPromote(userid, clanid) { var opt = { method: 'post', parameters: {userid:userid, clanid:clanid}, onSuccess: function(t) { window.location.reload(true); } } new Ajax.Request(base_url + 'clancontroller/ajaxPromote', opt); } function ajaxDemote(userid, clanid) { var opt = { method: 'post', parameters: {userid:userid, clanid:clanid}, onSuccess: function(t) { window.location.reload(true); } } new Ajax.Request(base_url + 'clancontroller/ajaxDemote', opt); } function ajaxMakeFounder(userid, clanid) { var opt = { method: 'post', parameters: {userid:userid, clanid:clanid}, onSuccess: function(t) { window.location.reload(true); } } new Ajax.Request(base_url + 'clancontroller/ajaxMakeFounder', opt); } //////////////////////// // 9-flagvid.js //////////////////////// function ajaxFlag(videoId){ toggleBlind('flagVideo','blind'); var opt = { method: 'post', parameters: $('flagForm').serialize(true), onSuccess: function(t) { //updateFlag('flaggingContainer', videoId); document.getElementById('flaggingContainer').innerHTML = 'Flagged Video'; }, onFailure: function(t) { alert("failure"); } } new Ajax.Request(base_url+'flagvidcontroller/Index/'+videoId, opt); } //////////////////////// // 10-facebook.js //////////////////////// function ajaxSetFacebookProfileVideo(videoID){ var opt = { method: 'get', onSuccess: function(t) { document.getElementById('FBVideo').innerHTML = 'Facebook'; } } new Ajax.Request(base_url+'facebookcontroller/setFBVideo/'+videoID,opt); } //////////////////////// // 11-userdiscussion.js //////////////////////// function saveUserDiscussion(username,field,form){ if(document.getElementById('addCommentText').value.match(/([A-Za-z0-9]|\!|\@|\#|\$|\%|\^|\&|\*|\(|\)|\_|\+|\-|\=|\||\\|\}|\{|\;|\:|\'|\"|\?|\>|\<|\,|\.|\/|\\|\`){1,}/gi)){ Effect.toggle(field, 'blind', {duration:0.0}); var opt = { // Use POST method: 'post', parameters: $(form).serialize(true), onSuccess: function(t) { getUserDiscussion('ajaxCommentDiv', username,'new', escape(new Date().getTime())); }, onFailure: function(t) { //alert("failure"); } } new Ajax.Request(base_url+"userdiscussioncontroller/save/" + escape(new Date().getTime()), opt); } else { alert("Please leave a comment."); } } function deleteUserDiscussion(username,dissid){ var opt = { method: 'get', onSuccess: function(t) { getUserDiscussion('ajaxCommentDiv', username,'new', escape(new Date().getTime())); }, onFailure: function(t) { //alert("failure"); } } new Ajax.Request(base_url+"userdiscussioncontroller/delete/"+username+"/"+dissid + "/" + escape(new Date().getTime()), opt); } function voteUserDiscussion(dissid,uname,vote) { var opt= { method: 'get', onSuccess: function(t) { getUserDiscussion('ajaxCommentDiv', uname,'new', escape(new Date().getTime())); }, onFailure: function(t) { //alert("failure"); } } new Ajax.Request(base_url+"videodiscussioncontroller/vote/"+dissid+"/"+vote, opt); } function getUserDiscussion(field, username, sort, date) { //window.location.reload(true); var udTempDiv = document.createElement("div"); document.getElementById(field).innerHTML=" "; new Ajax.Updater(field, base_url+"userdiscussioncontroller/show/"+ username+"/"+sort+ "/" + escape(new Date().getTime()), { method: 'get', onSuccess: function(t) { eval(t.responseText); udTempDiv.innerHTML = t.responseText; document.getElementById(field).appendChild(udTempDiv); }, onFailure: function(t) { //alert("failure"); } }); var opt2= { method: 'get', onSuccess: function(t) { var response = t.responseText; eval(response); } } new Ajax.Request(base_url+"userdiscussioncontroller/timer/" + username + "/" +sort + "/" + escape(new Date().getTime()), opt2); } function cancelUserDiscussion(field1,field2){ document.getElementById(field1).style.display = 'none'; document.getElementById(field2).style.display = 'block'; } function editUserDiscussion(field1,field2,discussionId,userid,mode){ new Ajax.Updater(field2, base_url+"userdiscussioncontroller/edit/"+"/"+discussionId + "/" +userid +"/"+ mode+ "/" + escape(new Date().getTime()),{ method: 'get', onSuccess: function(t){ document.getElementById(field1).style.display = 'none'; Effect.toggle(field2, 'blind', {duration:0.0}); }, onFailure: function(t) { //alert("failure"); } }); } function getNewUserCommentForm(field,userid,dissid,mode,date){ new Ajax.Updater(field, base_url+"userdiscussioncontroller/add/"+dissid+"/"+userid+"/"+mode+ "/" + escape(new Date().getTime()),{ method: 'get', onSuccess: function(t){ Effect.toggle(field, 'blind', {afterFinish:initialize}); }, onFailure: function(t){ alert("process failed"); } }); } // Request Stuff function openFulfill(close, open) { if (open == "openinput" && document.getElementById('openinput').style.display == "none") { Effect.toggle(close, 'appear', {duration:0.4}); Effect.toggle(open, 'appear', {delay:0.4,duration:0.4}); } else if (open == "closedinput" && document.getElementById('closedinput').style.display == "none") { Effect.toggle(close, 'appear', {duration:0.4}); Effect.toggle(open, 'appear', {delay:0.4,duration:0.4}); } } function ajaxFulfill(requestid, videoid, userid) { var opt = { method: 'post', parameters: {requestid:requestid, videoid:videoid, userid:userid}, onSuccess: function(t) { new Ajax.Updater('updateSubmissions' + videoid, base_url + 'requestcontroller/ajaxUpdateFulFill', {method: 'post', parameters:{requestid:requestid, videoid:videoid, userid:userid}}); new Ajax.Updater('updateFulFillmentStatus' + requestid, base_url + 'requestcontroller/ajaxUpdateFulFillStatus', {method: 'post', parameters:{requestid:requestid}}); } } new Ajax.Request(base_url + 'requestcontroller/ajaxUserFulfill', opt); } // Press Release Stuff function openPressRelease(id, total) { for (i = 1; i <= total; i++) { Effect.toggle("press" + id, 'blind', {duration:0.2}); if (document.getElementById("press" + i).style.display != "none" && id != i) { Effect.toggle("press" + i, 'blind', {duration: 0.0}); } } }