main.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. var elems = document.body.getElementsByTagName("video");
  2. for(var i = 0; i < elems.length; i++)
  3. {
  4. elems[i].setAttribute("preload","none");
  5. }
  6. // Get the HTTP Object
  7. function getHTTPObject() {
  8. if (window.ActiveXObject) return new ActiveXObject("Microsoft.XMLHTTP");
  9. else if (window.XMLHttpRequest) return new XMLHttpRequest();
  10. else {
  11. alert("Your browser does not support AJAX.");
  12. return null;
  13. }
  14. }
  15. function wrapBBCode(tag) {
  16. var msgInput = document.getElementById('msg');
  17. var content = msgInput.value;
  18. var selectedContent = content.substring(msgInput.selectionStart, msgInput.selectionEnd);
  19. var beforeContent = content.substring(0, msgInput.selectionStart);
  20. var afterContent = content.substring(msgInput.selectionEnd, content.length);
  21. msgInput.value = beforeContent + '[' + tag + ']' + selectedContent + '[/' + tag + ']' + afterContent;
  22. }
  23. function userTag(tag) {
  24. var msgInput = document.getElementById('msg');
  25. var content = msgInput.value;
  26. var beforeContent = content.substring(0, msgInput.selectionStart);
  27. var afterContent = content.substring(msgInput.selectionEnd, content.length);
  28. msgInput.value = beforeContent + '@' + tag + afterContent;
  29. }
  30. // For dynamic reacting without leaving page.
  31. function userReact(user, postid) {
  32. ajaxGet = getHTTPObject();
  33. if (ajaxGet != null) {
  34. link = "index.php?do=react&user="+user+"&pid="+postid;
  35. ajaxGet.open("GET", link , true);
  36. ajaxGet.send(null);
  37. setTimeout(function(){ window.location.reload(); }, 1000);
  38. }
  39. }
  40. // For dynamic reacting without leaving page.
  41. function userClrNotifications() {
  42. ajaxGet = getHTTPObject();
  43. if (ajaxGet != null) {
  44. link = "index.php?do=clrnote";
  45. ajaxGet.open("GET", link , true);
  46. ajaxGet.send(null);
  47. setTimeout(function(){ window.location.reload(); }, 1000);
  48. }
  49. }