Vấn đề java. Nhờ các bác giúp đỡ

Thảo luận trong 'Community Chat' bắt đầu bởi Xuân Tĩnh, 9/10/12.

1votes
5/5, 1 vote

  1. Xuân Tĩnh

    Xuân Tĩnh Member

    Bài viết:
    274
    Likes :
    97
    Chào các bác coder. Tình hình là mình không biết code. Nhưng mà mình lại nghịch và mình đã lấy javacript của cái skin này và chèn vào skin default của mình. Cứ nghĩ mọi chuyện sẽ được tốt đẹp. Nhưng không ngờ là nó xảy ra xung đột với vài cái khác. Nên mong ai biết code java thử tìm cách sửa giùm mình. :)

    Trước tiên các bác truy cập vào: http://huongson.com.vn
    Tài khoản là: test
    Pass là: 123456

    Cái java xung đột là cái java chatbox và cái category toggle container (Thu gọn cái Category ấy). Hai cái ấy nó chạy okie nhưng mà lại xung đột với cái chỗ user ấy. Bình thường giơ chuột vào đó nó sẽ có menu sổ xuống. Nhưng nếu chèn cái java category toggle container + cái chatbox thì nó không sổ xuống được nữa.

    Nếu mà xóa đi 1 trong 2 cái chatbox hoặc cái java category toggle container thì mọi chuyện bình thường. Ai có thể giúp thì bạn phải đăng nhập vào site thì sẽ biết rõ hơn. :).

    Sau đây là 2 cái java đó:
    Cái của category toggle container là
    Mã:
    // JavaScript Document
     
    jQuery(document).ready(function(){
    jQuery(".nodeList a.toggle_arrow").click(function () {
        cat_node = jQuery(this).closest('.level_1');
        xeniqueToggle(cat_node, false);
    });
    jQuery.each(jQuery('.category'), function() {
    $id = jQuery(this).attr('id');
    if (jQuery.getCookie($id))
    {
    xeniqueToggle($(this), true);
    }
    });
    });
    function xeniqueToggle(cat_node, fast)
    {
        node_list = cat_node.find('.nodeList');
        tc = cat_node.find('.toggle_arrow');
     
        if (node_list.is(":visible"))
        {
            if (fast)
                node_list.hide();
            else
                node_list.slideUp(700, 'easeInQuad');
            tc.addClass('closed');
            tc.removeClass('open');
            jQuery.setCookie(cat_node.attr('id'), true);
        }
        else
        {
            if (fast)
                node_list.show();
            else
                node_list.slideDown(700, 'easeOutBounce');
            tc.addClass('open');
            tc.removeClass('closed');
            jQuery.deleteCookie(cat_node.attr('id'));
        }
    }
     
     
     
    XenForo.PopupMenu.prototype.setMenuPosition = function(caller)
            {
                console.info('xenique setMenuPosition(%s)', caller);
     
                var controlLayout, // control coordinates
                    menuLayout, // menu coordinates
                    contentLayout, // #content coordinates
                    $content,
                    $window,
                    proposedLeft,
                    proposedTop;
     
                controlLayout = this.$control.coords('outer');
     
                this.$control.removeClass('BottomControl');
     
                // set the menu to sit flush with the left of the control, immediately below it
                this.$menu.removeClass('BottomControl').css(
                {
                    left: controlLayout.left,
                    top: controlLayout.top + controlLayout.height
                });
    jQuery('.arrowContainer .arrow').css('left', 23);
     
                menuLayout = this.$menu.coords('outer');
     
                $content = $('#content .pageContent');
                if ($content.length)
                {
                    contentLayout = $content.coords('outer');
                }
                else
                {
                    contentLayout = $('body').coords('outer');
                }
     
                $window = $(window);
                $window.sT = $window.scrollTop();
                $window.sL = $window.scrollLeft();
     
                /*
                * if the menu's right edge is off the screen, check to see if
                * it would be better to position it flush with the right edge of the control
                */
                if (menuLayout.left + menuLayout.width > contentLayout.left + contentLayout.width)
                {
                    proposedLeft = controlLayout.left + controlLayout.width - menuLayout.width;
                    // must always position to left with mobile webkit as the menu seems to close if it goes off the screen
                    if (proposedLeft > $window.sL || XenForo._isWebkitMobile)
                    {
    console.log('left was set to ' + proposedLeft);
                        this.$menu.css('left', proposedLeft);
                    }
    jQuery('.arrowContainer .arrow').css('left', '');
    jQuery('.arrowContainer .arrow').css('right', 23);
                }
     
                /*
                * if the menu's bottom edge is off the screen, check to see if
                * it would be better to position it above the control
                */
                if (menuLayout.top + menuLayout.height > $window.height() + $window.sT)
                {
                    proposedTop = controlLayout.top - menuLayout.height;
                    if (proposedTop > $window.sT)
                    {
                        this.$control.addClass('BottomControl');
                        this.$menu.addClass('BottomControl');
                        this.$menu.css('top', proposedTop);
                    }
                }
            };
     
     
    jQuery(document).ready(function () {
    jQuery(".nodeList .node:nth-child(odd)").addClass('odd');
    jQuery(".nodeList .node:nth-child(even)").addClass('even');
     
    jQuery(".eventList .event:nth-child(odd)").addClass('odd');
    jQuery(".eventList .event:nth-child(even)").addClass('even');
     
    jQuery(".memberList .memberListItem:nth-child(odd)").addClass('odd');
    jQuery(".memberList .memberListItem:nth-child(even)").addClass('even');
     
    jQuery(".messageList .message:nth-child(odd)").addClass('odd');
    jQuery(".messageList .message:nth-child(even)").addClass('even');
     
    jQuery(".profileContent .primaryContent:nth-child(odd)").addClass('odd');
    jQuery(".profileContent .primaryContent:nth-child(even)").addClass('even');
     
    jQuery(".discussionList .discussionListItem:nth-child(odd)").addClass('odd');
    jQuery(".discussionList .discussionListItem:nth-child(even)").addClass('even');
    });
    Còn cái java của chatbox là:
    Mã:
    /* Simple AJAX Code-Kit (SACK) v1.6.1 */
    /* ©2005 Gregory Wild-Smith */
    /* www.twilightuniverse.com */
    /* Software licenced under a modified X11 licence,
      see documentation or authors website for more details */
     
    function sack(file) {
        this.xmlhttp = null;
     
        this.resetData = function() {
            this.method = "POST";
              this.queryStringSeparator = "?";
            this.argumentSeparator = "&";
            this.URLString = "";
            this.encodeURIString = true;
              this.execute = false;
              this.element = null;
            this.elementObj = null;
            this.requestFile = file;
            this.vars = new Object();
            this.responseStatus = new Array(2);
          };
     
        this.resetFunctions = function() {
              this.onLoading = function() { };
              this.onLoaded = function() { };
              this.onInteractive = function() { };
              this.onCompletion = function() { };
              this.onError = function() { };
            this.onFail = function() { };
        };
     
        this.reset = function() {
            this.resetFunctions();
            this.resetData();
        };
     
        this.createAJAX = function() {
            try {
                this.xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
            } catch (e1) {
                try {
                    this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
                } catch (e2) {
                    this.xmlhttp = null;
                }
            }
     
            if (! this.xmlhttp) {
                if (typeof XMLHttpRequest != "undefined") {
                    this.xmlhttp = new XMLHttpRequest();
                } else {
                    this.failed = true;
                }
            }
        };
     
        this.setVar = function(name, value){
            this.vars[name] = Array(value, false);
        };
     
        this.encVar = function(name, value, returnvars) {
            if (true == returnvars) {
                return Array(encodeURIComponent(name), encodeURIComponent(value));
            } else {
                this.vars[encodeURIComponent(name)] = Array(encodeURIComponent(value), true);
            }
        }
     
        this.processURLString = function(string, encode) {
            encoded = encodeURIComponent(this.argumentSeparator);
            regexp = new RegExp(this.argumentSeparator + "|" + encoded);
            varArray = string.split(regexp);
            for (i = 0; i < varArray.length; i++){
                urlVars = varArray[i].split("=");
                if (true == encode){
                    this.encVar(urlVars[0], urlVars[1]);
                } else {
                    this.setVar(urlVars[0], urlVars[1]);
                }
            }
        }
     
        this.createURLString = function(urlstring) {
            if (this.encodeURIString && this.URLString.length) {
                this.processURLString(this.URLString, true);
            }
     
            if (urlstring) {
                if (this.URLString.length) {
                    this.URLString += this.argumentSeparator + urlstring;
                } else {
                    this.URLString = urlstring;
                }
            }
     
            // prevents caching of URLString
            this.setVar("rndval", new Date().getTime());
     
            urlstringtemp = new Array();
            for (key in this.vars) {
                if (false == this.vars[key][1] && true == this.encodeURIString) {
                    encoded = this.encVar(key, this.vars[key][0], true);
                    delete this.vars[key];
                    this.vars[encoded[0]] = Array(encoded[1], true);
                    key = encoded[0];
                }
     
                urlstringtemp[urlstringtemp.length] = key + "=" + this.vars[key][0];
            }
            if (urlstring){
                this.URLString += this.argumentSeparator + urlstringtemp.join(this.argumentSeparator);
            } else {
                this.URLString += urlstringtemp.join(this.argumentSeparator);
            }
        }
     
        this.runResponse = function() {
            eval(this.response);
        }
     
        this.runAJAX = function(urlstring) {
            if (this.failed) {
                this.onFail();
            } else {
                this.createURLString(urlstring);
                if (this.element) {
                    this.elementObj = document.getElementById(this.element);
                }
                if (this.xmlhttp) {
                    var self = this;
                    if (this.method == "GET") {
                        totalurlstring = this.requestFile + this.queryStringSeparator + this.URLString;
                        this.xmlhttp.open(this.method, totalurlstring, true);
                    } else {
                        this.xmlhttp.open(this.method, this.requestFile, true);
                        try {
                            this.xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded")
                        } catch (e) { }
                    }
     
                    this.xmlhttp.onreadystatechange = function() {
                        switch (self.xmlhttp.readyState) {
                            case 1:
                                self.onLoading();
                                break;
                            case 2:
                                self.onLoaded();
                                break;
                            case 3:
                                self.onInteractive();
                                break;
                            case 4:
                                self.response = self.xmlhttp.responseText;
                                self.responseXML = self.xmlhttp.responseXML;
                                self.responseStatus[0] = self.xmlhttp.status;
                                self.responseStatus[1] = self.xmlhttp.statusText;
     
                                if (self.execute) {
                                    self.runResponse();
                                }
     
                                if (self.elementObj) {
                                    elemNodeName = self.elementObj.nodeName;
                                    elemNodeName.toLowerCase();
                                    if (elemNodeName == "input"
                                    || elemNodeName == "select"
                                    || elemNodeName == "option"
                                    || elemNodeName == "textarea") {
                                        self.elementObj.value = self.response;
                                    } else {
                                        self.elementObj.innerHTML = self.response;
                                    }
                                }
                                if (self.responseStatus[0] == "200") {
                                    self.onCompletion();
                                } else {
                                    self.onError();
                                }
     
                                self.URLString = "";
                                break;
                        }
                    };
     
                    this.xmlhttp.send(this.URLString);
                }
            }
        };
     
        this.reset();
        this.createAJAX();
    }
    
    Rất mong các bác giúp đỡ tí.
    Đang tính edit xong mọi chuyện sẽ làm cái tut thu gọn category nhưng mà giờ gặp lỗi này rồi.
     
    Đang tải...
  2. Xuân Tĩnh

    Xuân Tĩnh Member

    Bài viết:
    274
    Likes :
    97
    Hình như chưa ai thử vấn đề này :)
     
  3. Logi

    Logi Well-Known Member

    Bài viết:
    1,087
    Likes :
    456
    Đây là do xung đột phiên bản jquery bạn à. Nhưng mà sửa thì cũng lằng nhằng lắm :(
     
    Xuân Tĩnh thích bài này.
  4. TeQuiLa

    TeQuiLa .:: Neverland ::.

    Bài viết:
    593
    Likes :
    585
    Xung đột ở cái Category Toggle của bạn đó, cái Chatbox chẳng sao cả đâu.
     
    Xuân Tĩnh thích bài này.
  5. Xuân Tĩnh

    Xuân Tĩnh Member

    Bài viết:
    274
    Likes :
    97
    Nếu mà không sửa được thì đành phải bỏ 1 trong 2 cái à. Mà bỏ cái nào cũng tiếc. Vì thấy nó cũng hợp lý và thích cả 2 cái đó nên mới đưa lên nhờ mọi người edit giùm :)
     
comments powered by Disqus

Chia sẻ trang này

Đang tải...