TSL Chat Board Enhancements

Techsideline.com Chat board enhancement script adds preview button next to threads as well as basketball/football schedules to the right column. Press escape or click preview window to close.

  1. // ==UserScript==
  2. // @name TSL Chat Board Enhancements
  3. // @namespace TSLChatEnhancement
  4. // @description Techsideline.com Chat board enhancement script adds preview button next to threads as well as basketball/football schedules to the right column. Press escape or click preview window to close.
  5. // @metadata TechSideline,TSL
  6. // @include http://chat.virginiatech.sportswar.com/message_board/*
  7. // @require http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js
  8. // @require http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js
  9. // @version 2.2.4
  10. // ==/UserScript==
  11.  
  12. $(document).ready(function()
  13. {
  14. var oldSrc = 'http://virginiatech.sportswar.com/wp-content/uploads/sites/15/2014/01/lvl0.gif';
  15. var inThreadSrc = 'http://virginiatech.sportswar.com/wp-content/uploads/sites/15/2014/01/lvl1.gif';
  16. var Expand = "http://findicons.com/files/icons/1156/fugue/16/toggle_expand.png";
  17. var Collapse = 'http://findicons.com/files/icons/1156/fugue/16/toggle.png';
  18. var Search = "<img src='http://png-5.findicons.com/files/icons/117/radium/16/search.png'/>";
  19. var currentURL = window.location.href;
  20. $('body').append("<div id='NWTempHolder' style='display:none;'></div><div style='position:relative;' id='NWbottomWrapper'><div id='NWbottomRight' style='position:absolute;background-color:#fff;border:8px solid #E87511;padding:10px;'></div></div>");
  21. if (currentURL.indexOf('vtbasketball')>0){
  22. var URLsearch = "http://virginiatech.sportswar.com/vt-basketball/2015-16-virginia-tech-basketball-schedule-phone/";
  23. var tableID = '#tablepress-194';
  24. } else if (currentURL.indexOf('vtfootball')>0){
  25. var URLsearch = "http://virginiatech.sportswar.com/vt-football/2015-virginia-tech-football-schedule/";
  26. var tableID = '#tablepress-175';
  27. }
  28. $.getJSON("http://alloworigin.com/get?url=" + encodeURIComponent(URLsearch) + "&callback=?", function(data){
  29. var live_str = $('<div>',{html:data.contents});
  30.  
  31. var schedule = live_str.find(tableID).parent().html();
  32. $(".ads").append(schedule);
  33.  
  34. });
  35. /* Remove the following 2 lines to default to Expanded view */
  36. //$('.children').hide();
  37. //$('img[src="' + Collapse + '"]').attr('src', Expand);
  38.  
  39. $('.subject').each(function( index ) {
  40. var getLink = $(this).attr('href');
  41. var SearchLink = "<a href='"+getLink+"' class='NWPreview'>"+Search+"</a>";
  42. $(this).prepend(SearchLink);
  43. });
  44. $('.post').on('click', '.expand', function (){
  45. var CurrentIMG = $(this).attr('src');
  46. var SubjectContent = $(this).parent().html();
  47.  
  48. if (CurrentIMG == Expand)
  49. {
  50. $(this).attr('src',Collapse);
  51. while( $(this).parent().next().attr('class') == '.HasChildren'){
  52. }
  53. find('.HasChildren').show();
  54. // var MainSubject = $(this).parent().parent().html();
  55. // MainSubject = MainSubject.replace(SubjectContent,"");
  56. // MainSubject = MainSubject.replace("display:none","");
  57. // $(this).parent().parent().html(MainSubject);
  58.  
  59. } else {
  60. $(this).attr('src',Expand);
  61. var MainSubject = $(this).parent().html();
  62. MainSubject = "<div class='MainSubject'>" + MainSubject + "</div>";
  63. var ThreadContent = $(this).parent().parent().html();
  64. ThreadContent = MainSubject + "<div style='display:none' class='collapsedContent'>" + ThreadContent + "</div>";
  65. $(this).parent().parent().html(ThreadContent);
  66. }
  67. });
  68. $(document).keyup(function(e) {
  69. if (e.keyCode == 27) { // escape key maps to keycode `27`
  70. $("#NWbottomRight").hide();
  71. }
  72. });
  73. $(document).on('click','.NWPreview',function(e) {
  74. e.preventDefault();
  75. var pageURL = $(this).attr('href');
  76. $('#NWbottomRight').load(pageURL + ' .message-content').show().offset({top:e.pageY,left:e.pageX+20});
  77. });
  78.  
  79. $(document).on('click','#NWClosePreview',function(e) {
  80. e.preventDefault();
  81. $('#NWbottomRight').hide();
  82. });
  83. $(document).on('mouseout','.NWPreview',function(e) {
  84. e.preventDefault();
  85. //$('#NWbottomRight').hide();
  86. });
  87. $(document).on('click','#NWbottomRight',function(e) {
  88. e.preventDefault();
  89. $(this).hide();
  90. });
  91. });

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址