Quicksaver / The-Fox--Only-Better

A Firefox add-on to improve the feeling of using the new Australis theme.
https://addons.mozilla.org/firefox/addon/the-fox-only-better/
Mozilla Public License 2.0
91 stars 22 forks source link

Problem with JavaScript functions #36

Closed SZaurus closed 10 years ago

SZaurus commented 10 years ago

Here are the JavaScript functions that were not working properly when I had this add-on installed.

function gotoPage(page_combo) {
    var page = $("#" + page_combo).val();
    if (page > -1) {
        window.location = setParameterByName(document.URL, 'page', page);
    }
}

function nextPage(page_number){
    window.location = setParameterByName(document.URL, 'page', page_number);
}

function getParameterByName(name){
    name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
    var regexS = "[\\?&]" + name + "=([^&#]*)";
    var regex = new RegExp(regexS);
    var results = regex.exec(window.location.search);
    if(results == null)
        return "";
    else
        return decodeURIComponent(results[1].replace(/\+/g, " "));
}

function setParameterByName(m_str, name, val){
    name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
    var regexS = "([\\?&])" + name + "=([^&#]*)";
    var regex = new RegExp(regexS);
    var results = regex.exec(m_str);
    if(results == null){
        if(m_str == '')
            return m_str + "?" + name + "=" + val;
        else
            return m_str + "&" + name + "=" + val;
    }
    else{
        return m_str.replace(regex,results[1] + name + "=" + val);
    }
}
Quicksaver commented 10 years ago

How are you applying this? And where did you get it?

SZaurus commented 10 years ago

I used the functions for navigating records of users that is paginated. when I click on Next page link, one of the functions is used. it works without the add-on. but when I have the add-on installed, it doesn't work

On Sat, May 24, 2014 at 5:04 PM, Luís Miguel notifications@github.comwrote:

How are you applying this? And where did you get it?

— Reply to this email directly or view it on GitHubhttps://github.com/Quicksaver/The-Fox--Only-Better/issues/36#issuecomment-44099749 .

Quicksaver commented 10 years ago

I meant how are you using it? Through greasemonkey, scriptish, anything else? Did you write it or get it from somewhere?

I need every bit of information you can give me, as just by looking at the code there doesn't seem to be anything there that would break with the add-on.

SZaurus commented 10 years ago

I was using it in a webpage containing tabular data that is paginated. then using those JS functions I was navigating through pages.

On Sun, May 25, 2014 at 6:23 AM, Luís Miguel notifications@github.comwrote:

I meant how are you using it? Through greasemonkey, scriptish, anything else? Did you write it or get it from somewhere?

I need every bit of information you can give me, as just by looking at the code there doesn't seem to be anything there that would break with the add-on.

— Reply to this email directly or view it on GitHubhttps://github.com/Quicksaver/The-Fox--Only-Better/issues/36#issuecomment-44127706 .

Quicksaver commented 10 years ago

Ah ok it is on a webpage, I'm sorry, I wasn't understanding that.

Now exactly what happens (or doesn't happen) when you cilck on the next page link? Like I said, I don't see any reason for the add-on to affect those functions at all. Open the web console (Ctrl+Shift+K) and see if any errors or messages appear when you load the page or when you click the next page link.

Quicksaver commented 10 years ago

Even better would be a link to that webpage of course.

SZaurus commented 10 years ago

I will do some more testing when I am home.

On Mon, May 26, 2014 at 3:15 PM, Luís Miguel notifications@github.comwrote:

Even better would be a link to that webpage of course.

— Reply to this email directly or view it on GitHubhttps://github.com/Quicksaver/The-Fox--Only-Better/issues/36#issuecomment-44212085 .

Quicksaver commented 10 years ago

Any news?