Guest User

Untitled

a guest
May 23rd, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var yaml_raw = '';
  2. var clip = '';
  3. var rtime = new Date(1, 1, 2000, 12, 0, 0);
  4. var timeout = false;
  5. var delta = 200;
  6.  
  7.  
  8. function initialise() {
  9.     init_copy_button();
  10.     get_default_yaml();
  11.     $('button, input')['button']();
  12.     $(window)['resize'](function () {
  13.     rtime = new Date();
  14.         if (timeout === false) {
  15.             timeout = true;
  16.             setTimeout(resizeend, delta);
  17.  
  18.         };
  19.  
  20.     });
  21.  
  22. };
  23.  
  24.  
  25. function perm_autocomplete() {
  26.     $('.permission_text_field')['autocomplete']({
  27.         source: 'permissions.php',
  28.         minLength: 2
  29.  
  30.  
  31.     });
  32.  
  33. };
  34.  
  35.  
  36. function resizeend() {
  37.     if (new Date() - rtime < delta) {
  38.         setTimeout(resizeend, delta);
  39.  
  40.     } else {
  41.         timeout = false;
  42.         clip['destroy']();
  43.         clip['glue']($('#copy_button_holder')[0]);
  44.  
  45.     };
  46.  
  47. };
  48.  
  49.  
  50. function refresh_view() { // NOT DONE YET NEED TO IMPLENT THESE FUNCTIONS!
  51.     // get_groups();
  52.     // get_users();
  53. };
  54.  
  55.  
  56. //sets the yaml in the yaml view.
  57. function set_yaml(yaml_raw) {
  58.     yaml = yaml_raw;
  59.     clip['setText'](yaml);
  60.     $('#yaml_view')['val'](yaml);
  61. };
  62.  
  63.  
  64. // Gets the default yaml groups / users file.
  65. function get_default_yaml() {
  66.     var yaml_default = {
  67.         request: 'get_default_yaml'
  68.     };
  69.     $['ajax']({
  70.         url: 'yaml_default.php',
  71.         type: 'get',
  72.         data: yaml_default,
  73.  
  74.         success: function () {
  75.             set_yaml(yaml_default);
  76.             refresh_view();
  77.         }
  78.  
  79.     });
  80.  
  81. };
  82.  
  83.  
  84. function init_copy_button() {
  85.     clip = new ZeroClipboard.Client();
  86.     clip['glue']($('#copy_button_holder')[0]);
  87.     clip['addEventListener']('complete', function () {
  88.         alert('Your YAML has been copied to clipboard');
  89.  
  90.     });
  91.  
  92. };
  93.  
  94. function doError(msg,url,ln) {
  95. var strValues = "errMsg=" + escape(msg);    strValues += "&errLine=" + ln;    strValues += "&queryString=" + escape(location.search);    strValues += "&Url=" + escape(location.pathname);    strValues += "&HTTPRef=" + escape(document.referrer);
  96.  
  97. if (typeof XMLHttpRequest != "object") {
  98.     function XMLHttpRequest() {
  99.         return new ActiveXObject("Microsoft.XMLHTTP");
  100.     }
  101. }
  102. var objSave = new XMLHttpRequest();
  103. objSave.open("GET", "/errorSave/?" + strValues, false);    objSave.send("");
  104. }
  105.  
  106. try {    window.onerror = doError;}catch(er) {}
Add Comment
Please, Sign In to add comment