Guest User

Untitled

a guest
Mar 3rd, 2014
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $(document).ready(function () {
  2.  
  3.     // Set this for validation
  4.     $("#mainform").validate({
  5.         errorLabelContainer: $("div.error")
  6.     });
  7.  
  8.     // Sort the mark as solution button
  9.     $(".marksolution").click(function () {
  10.         var postid = $(this).attr('rel');
  11.         var forumpost = "forumpost" + postid;
  12.         $(".marksolution").remove();
  13.         // Yes this is qualified on the server side, so don't even bother!
  14.         $.get("/base/Solution/MarkAsSolution/" + postid + ".aspx",
  15.         function (data) {
  16.             $('.' + forumpost).removeClass().addClass('forumpost solutionTrue ' + forumpost);
  17.         });
  18.         return false;
  19.     });
  20.  
  21.     // Sort the thumbs up on a post
  22.     $(".thumbuplink").click(function () {
  23.         var postid = $(this).attr('rel');
  24.         var thumbsholder = "karmathumbs" + postid;
  25.         var karmascore = "karma" + postid;
  26.         $("." + thumbsholder).remove();
  27.         // Yes this is qualified on the server side, so don't even bother!
  28.         $.get("/base/Solution/ThumbsUpPost/" + postid + ".aspx",
  29.         function (data) {
  30.             var newkarma = $('value', data).text();
  31.             $('.' + karmascore).text(newkarma);
  32.         });
  33.         return false;
  34.     });
  35.  
  36.     // Sort the thumbs up on a post
  37.     $(".thumbdownlink").click(function () {
  38.         var postid = $(this).attr('rel');
  39.         var thumbsholder = "karmathumbs" + postid;
  40.         var karmascore = "karma" + postid;
  41.         $("." + thumbsholder).remove();
  42.         // Yes this is qualified on the server side, so don't even bother!
  43.         $.get("/base/Solution/ThumbsDownPost/" + postid + ".aspx",
  44.         function (data) {
  45.             var newkarma = $('value', data).text();
  46.             $('.' + karmascore).text(newkarma);
  47.         });
  48.         return false;
  49.     });
  50.  
  51.     // Create a new post
  52.     $(".btnsubmitpost").click(function (event) {
  53.         event.preventDefault();
  54.         var topicid = $(this).attr('rel');
  55.         var sbody = tinyMCE.get('txtPost').getContent();
  56.         $('.topicpostlistnewpost').remove();
  57.         $('.postsuccess').show();
  58.         // Yes this is qualified on the server side, so don't even bother!
  59.         $.post("/base/Solution/NewForumPost/" + topicid + ".aspx", { "postcontent": sbody }, redirect);
  60.     });
  61.    
  62.     // Create a new topic
  63.     $(".btnsubmittopic").click(function (event) {
  64.         event.preventDefault();
  65.         var catid = $(this).attr('rel');
  66.         var sbody = tinyMCE.get('txtPost').getContent();
  67.         var stitle = $('#tbTopicTitle').val();
  68.         var sticky = $('#cbSticky').is(':checked');
  69.         var locked = $('#cbLockTopic').is(':checked');
  70.         $('.createnewtopicform').remove();
  71.         $('.postsuccess').show();
  72.         // Yes this is qualified on the server side, so don't even bother!
  73.         $.post("/base/Solution/NewForumTopic/" + catid + ".aspx",
  74.    { "postcontent": sbody, "posttitle": stitle, "poststicky": sticky, "postlocked": locked }, redirect);
  75.     });
  76.    
  77.     $("#topiclistheadbuttons").click(function(){
  78.         var target = $(this).children('p').children('a');
  79.         if($(target).hasClass('forumbutton')){
  80.             submittopic();
  81.         }else{
  82.             if($(target).hasClass('notsubscribedtotopic')){
  83.                 var topicid = $(target).attr('rel');
  84.                 $(target).slideUp('fast');
  85.                 $(target).removeClass('notsubscribedtotopic').addClass('subscribedtotopic');
  86.                 $(target).slideDown();
  87.                 $.get("/base/Solution/SubScribeToTopic/" + topicid + ".aspx",
  88.                 function (data) {
  89.                     var result = $('value', data).text();
  90.                 });
  91.                 $(target).html('Unsubscribe From Topic');
  92.                 return false;
  93.             }else{
  94.                 var topicid = $(target).attr('rel');
  95.                 $(target).slideUp('fast');
  96.                 $(target).removeClass('subscribedtotopic').addClass('notsubscribedtotopic');
  97.                 $(target).slideDown();
  98.                 $.get("/base/Solution/UnSubScribeToTopic/" + topicid + ".aspx",
  99.                 function (data) {
  100.                     var result = $('value', data).text();
  101.                 });
  102.                 $(target).html('Subscribe To Topic');
  103.                 return false;
  104.             }
  105.         }
  106.     });
  107.  
  108.     // UnSubscribe to topic subscribedtotopic
  109.     $(".quotebutton").click(function() {
  110.         //event.preventDefault();
  111.         var postid = $(this).attr('rel');
  112.         var postcontentid = "#postcontent" + postid;
  113.         var postmemnameid = ".postmember" + postid;
  114.         var postmemname = jQuery.trim($(postmemnameid).text());
  115.         var postcontent = "<pre><em>" + postmemname + "</em><br>" + jQuery.trim($(postcontentid).text()) + "</pre>";
  116.         tinyMCE.execCommand('mceInsertContent', false, postcontent);
  117.         return true;
  118.     });
  119.  
  120. });
  121.  
  122. function redirect(data) {
  123.     var returnUrl = $("value", data).text();
  124.     window.location.href = returnUrl;
  125. }
Advertisement
Add Comment
Please, Sign In to add comment