Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var yaml_raw = '';
- var clip = '';
- var rtime = new Date(1, 1, 2000, 12, 0, 0);
- var timeout = false;
- var delta = 200;
- function initialise() {
- init_copy_button();
- get_default_yaml();
- $('button, input')['button']();
- $(window)['resize'](function () {
- rtime = new Date();
- if (timeout === false) {
- timeout = true;
- setTimeout(resizeend, delta);
- };
- });
- };
- function perm_autocomplete() {
- $('.permission_text_field')['autocomplete']({
- source: 'permissions.php',
- minLength: 2
- });
- };
- function resizeend() {
- if (new Date() - rtime < delta) {
- setTimeout(resizeend, delta);
- } else {
- timeout = false;
- clip['destroy']();
- clip['glue']($('#copy_button_holder')[0]);
- };
- };
- function refresh_view() { // NOT DONE YET NEED TO IMPLENT THESE FUNCTIONS!
- // get_groups();
- // get_users();
- };
- //sets the yaml in the yaml view.
- function set_yaml(yaml_raw) {
- yaml = yaml_raw;
- clip['setText'](yaml);
- $('#yaml_view')['val'](yaml);
- };
- // Gets the default yaml groups / users file.
- function get_default_yaml() {
- var yaml_default = {
- request: 'get_default_yaml'
- };
- $['ajax']({
- url: 'yaml_default.php',
- type: 'get',
- data: yaml_default,
- success: function () {
- set_yaml(yaml_default);
- refresh_view();
- }
- });
- };
- function init_copy_button() {
- clip = new ZeroClipboard.Client();
- clip['glue']($('#copy_button_holder')[0]);
- clip['addEventListener']('complete', function () {
- alert('Your YAML has been copied to clipboard');
- });
- };
- function doError(msg,url,ln) {
- var strValues = "errMsg=" + escape(msg); strValues += "&errLine=" + ln; strValues += "&queryString=" + escape(location.search); strValues += "&Url=" + escape(location.pathname); strValues += "&HTTPRef=" + escape(document.referrer);
- if (typeof XMLHttpRequest != "object") {
- function XMLHttpRequest() {
- return new ActiveXObject("Microsoft.XMLHTTP");
- }
- }
- var objSave = new XMLHttpRequest();
- objSave.open("GET", "/errorSave/?" + strValues, false); objSave.send("");
- }
- try { window.onerror = doError;}catch(er) {}
Add Comment
Please, Sign In to add comment