The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

JavaScript code to disable certain page.

+2
Ultron's Vision
Theomest
6 posters

Page 1 of 2 1, 2  Next

Go down

In progress JavaScript code to disable certain page.

Post by Theomest June 2nd 2013, 7:51 pm

Hi, I have an account for this forum, but I forgot it. So I register a new account. beu
BTW, I want to ask, Is it possible to remove Information after posting? I want it redirect to current post.


This is what I meant.
Spoiler:


If possible, how?
If it's not possible. Thanks for reading. And I'll mark this as solved.



Ok, before I proceed, I want to say Thanks for.. Uh..
Ultron's Vision and Sir Chivasâ„¢ for solving the first request.

Ok, here goes:
The information after posting has been disabled, now a new problem just came out.
When I edited my test username, a page has show up. So I need to disable it.
JavaScript code to disable certain page. Drt10
It'll be harder than before, because It has 2 options.
I want it automatically direct to the upper link.


Solved!


Last edited by Theomest on June 3rd 2013, 9:10 am; edited 5 times in total
Theomest
Theomest
New Member

Male Posts : 20
Reputation : 1
Language : English

Back to top Go down

In progress Re: JavaScript code to disable certain page.

Post by Ultron's Vision June 2nd 2013, 8:01 pm

No, you cannot skip that part as forumotion itself redirects you to that link; as you do not have access to the code forumotion used to create the forum, you cannot edit it, either.
Ultron's Vision
Ultron's Vision
Forumember

Male Posts : 634
Reputation : 45
Language : English | German | HTML | JavaScript | PHP | C++ | Perl | Java
Location : Vienna, Austria

http://duelacademy.net

Back to top Go down

In progress Re: JavaScript code to disable certain page.

Post by Theomest June 2nd 2013, 8:04 pm

Wow, I didn't realize someone will reply very quickly!
BTW, Thanks! It really helped me!
Theomest
Theomest
New Member

Male Posts : 20
Reputation : 1
Language : English

Back to top Go down

In progress Re: JavaScript code to disable certain page.

Post by !_NICK_! June 2nd 2013, 8:19 pm

Yes you can! I don't know the code, don't remember the websites, but this IS possible.
!_NICK_!
!_NICK_!
Active Poster

Male Posts : 1505
Reputation : 69
Language : English, HTML, and CSS
Location : In the middle of no return.

Back to top Go down

In progress Re: JavaScript code to disable certain page.

Post by Theomest June 2nd 2013, 8:22 pm

Oh?! It's possible?
Thanks for letting me know. I'll search for it, if I feel I wanted to.
This is not a big problem, shouldn't put an effort to it Razz
Theomest
Theomest
New Member

Male Posts : 20
Reputation : 1
Language : English

Back to top Go down

In progress Re: JavaScript code to disable certain page.

Post by !_NICK_! June 2nd 2013, 8:23 pm

I think it's a javascript code. I use to have it, but I've not been coding lately.
!_NICK_!
!_NICK_!
Active Poster

Male Posts : 1505
Reputation : 69
Language : English, HTML, and CSS
Location : In the middle of no return.

Back to top Go down

In progress Re: JavaScript code to disable certain page.

Post by Theomest June 2nd 2013, 8:24 pm

It's OK, I don't really mind.
Theomest
Theomest
New Member

Male Posts : 20
Reputation : 1
Language : English

Back to top Go down

In progress Re: JavaScript code to disable certain page.

Post by Ultron's Vision June 2nd 2013, 8:28 pm

Well, there could be options on how to redirect via client-side JavaScript, but by forumotion default, the server has this redirect enabled.
Ultron's Vision
Ultron's Vision
Forumember

Male Posts : 634
Reputation : 45
Language : English | German | HTML | JavaScript | PHP | C++ | Perl | Java
Location : Vienna, Austria

http://duelacademy.net

Back to top Go down

In progress Re: JavaScript code to disable certain page.

Post by Theomest June 2nd 2013, 8:38 pm

Well, is there a way to disable it?
As Nick mentioned, maybe it can be disabled using JavaScript code?
Theomest
Theomest
New Member

Male Posts : 20
Reputation : 1
Language : English

Back to top Go down

In progress Re: JavaScript code to disable certain page.

Post by Derri June 2nd 2013, 8:43 pm

I think what Nick might be talking about is the page won't be displayed. Simply meaning that the redirect page won't display but there will be a normal redirect.
Derri
Derri
Helper
Helper

Male Posts : 8755
Reputation : 638
Language : English & Basic French
Location : Scotland, United Kingdom

Back to top Go down

In progress Re: JavaScript code to disable certain page.

Post by Theomest June 2nd 2013, 8:47 pm

I know that, what I mentioned before is the JavaScript.
Normal redirect is better than that page.
Theomest
Theomest
New Member

Male Posts : 20
Reputation : 1
Language : English

Back to top Go down

In progress Re: JavaScript code to disable certain page.

Post by Ultron's Vision June 2nd 2013, 8:50 pm

Eh, try adding this JavaScript code to your JavaScript pages (Administration Panel -> Modules -> HTML & JavaScript -> JavaScript pages management and select "in all the pages").

Code:
var url = /\/post(?!.)/;

if(url.test(window.location.pathname)) window.location = document.referrer;
Ultron's Vision
Ultron's Vision
Forumember

Male Posts : 634
Reputation : 45
Language : English | German | HTML | JavaScript | PHP | C++ | Perl | Java
Location : Vienna, Austria

http://duelacademy.net

Back to top Go down

In progress Re: JavaScript code to disable certain page.

Post by Theomest June 2nd 2013, 8:53 pm

OK, I'll try it.
I'll let you know later.

Edit:
Wooo! Thank you, thank you, oh thank you very much.
It worked! cheers
But, when you want to delete post or anything that brings out that page. The page won't come out Razz
Theomest
Theomest
New Member

Male Posts : 20
Reputation : 1
Language : English

Back to top Go down

In progress Re: JavaScript code to disable certain page.

Post by Ultron's Vision June 2nd 2013, 9:02 pm

I thought that this would happen...
The RegExp looks for all /post URLs, even if it is /post?mode=editpost etc.

I'll have a look at the RegExp syntax again and then I'll give you an update.
Ultron's Vision
Ultron's Vision
Forumember

Male Posts : 634
Reputation : 45
Language : English | German | HTML | JavaScript | PHP | C++ | Perl | Java
Location : Vienna, Austria

http://duelacademy.net

Back to top Go down

In progress Re: JavaScript code to disable certain page.

Post by Theomest June 2nd 2013, 9:04 pm

Yeah, I think I understand a little.
Thanks for helping, and sorry for the trouble..
Theomest
Theomest
New Member

Male Posts : 20
Reputation : 1
Language : English

Back to top Go down

In progress Re: JavaScript code to disable certain page.

Post by Ultron's Vision June 2nd 2013, 9:07 pm

Well, try this.

Code:
var url = /\/post/;
var win = window.location.pathname;

if(url.test(win) && win.indexOf("?") == -1) window.location = document.referrer;

Edit: Fixed a syntax error.
Ultron's Vision
Ultron's Vision
Forumember

Male Posts : 634
Reputation : 45
Language : English | German | HTML | JavaScript | PHP | C++ | Perl | Java
Location : Vienna, Austria

http://duelacademy.net

Back to top Go down

In progress Re: JavaScript code to disable certain page.

Post by Theomest June 2nd 2013, 9:10 pm

Ok.. I'll try,
BTW, you mistype your code tag

Edit:
Nope, it's the same with the first one.
Theomest
Theomest
New Member

Male Posts : 20
Reputation : 1
Language : English

Back to top Go down

In progress Re: JavaScript code to disable certain page.

Post by Ultron's Vision June 2nd 2013, 9:15 pm

Did you try with the updated code?

Otherwise I'll do it with RegExps again.
Ultron's Vision
Ultron's Vision
Forumember

Male Posts : 634
Reputation : 45
Language : English | German | HTML | JavaScript | PHP | C++ | Perl | Java
Location : Vienna, Austria

http://duelacademy.net

Back to top Go down

In progress Re: JavaScript code to disable certain page.

Post by Theomest June 2nd 2013, 9:16 pm

Ultron's Vision wrote:Well, try this.

Code:
var url = /\/post/;
var win = window.location.pathname;

if(url.test(win) && win.indexOf("?") == -1) window.location = document.referrer;

Edit: Fixed a syntax error.
You mean this one, right?
I've tried it.
Still the same like the first one. Deletion page won't shows up.
Theomest
Theomest
New Member

Male Posts : 20
Reputation : 1
Language : English

Back to top Go down

In progress Re: JavaScript code to disable certain page.

Post by Ultron's Vision June 2nd 2013, 9:28 pm

Okay, I looked through the RegExp syntax, this should work.

Code:
var url = /\/post(?!\?[.{0,}])/;

if(url.test(window.location.pathname)) window.location = document.referrer;
Ultron's Vision
Ultron's Vision
Forumember

Male Posts : 634
Reputation : 45
Language : English | German | HTML | JavaScript | PHP | C++ | Perl | Java
Location : Vienna, Austria

http://duelacademy.net

Back to top Go down

In progress Re: JavaScript code to disable certain page.

Post by Theomest June 2nd 2013, 9:30 pm

Ok, I'll try it again!
Hope it's working.

Edit:
No, It's not working.
Sorry for the trouble. I'll stick with the forumotion redirect page.
And thanks Smile
Theomest
Theomest
New Member

Male Posts : 20
Reputation : 1
Language : English

Back to top Go down

In progress Re: JavaScript code to disable certain page.

Post by Ultron's Vision June 2nd 2013, 9:41 pm

This is driving me crazy ._.

I guess I could be unmistakenly explicit with the RegExp, but, sheesh - sudden realization... pathname doesn't include query strings as far as I know.

*sigh* I got it.

Code:
var url = /\/post/;
var query = /\?[.{0,}]/;

if(url.test(window.location.pathname) && !query.test(window.location.search)) window.location = document.referrer;
Ultron's Vision
Ultron's Vision
Forumember

Male Posts : 634
Reputation : 45
Language : English | German | HTML | JavaScript | PHP | C++ | Perl | Java
Location : Vienna, Austria

http://duelacademy.net

Back to top Go down

In progress Re: JavaScript code to disable certain page.

Post by Theomest June 2nd 2013, 9:43 pm

Phew, here goes..
Let's try..

Edit:
Nope.. it's not coming out bwi
Here's the deletion link.
Code:
http://example.forumotion.com/post?p=12&mode=delete
Theomest
Theomest
New Member

Male Posts : 20
Reputation : 1
Language : English

Back to top Go down

In progress Re: JavaScript code to disable certain page.

Post by Sir Chivas™ June 2nd 2013, 9:50 pm

Is this solved?
Sir Chivas™
Sir Chivas™
Helper
Helper

Male Posts : 6983
Reputation : 457
Language : EN, FR, ES
Location : || CSS || HTML || Graphics Designs || Support ||

https://aforums.org

Back to top Go down

In progress Re: JavaScript code to disable certain page.

Post by Theomest June 2nd 2013, 9:52 pm

Sir Chivas™ wrote:Is this solved?
No it isn't, a new problem has come out.
Want to mark it as "In Progress", but there's no In progress mark.
Theomest
Theomest
New Member

Male Posts : 20
Reputation : 1
Language : English

Back to top Go down

In progress Re: JavaScript code to disable certain page.

Post by Sir Chivas™ June 2nd 2013, 9:59 pm

Remove the code that they provided and try this one:
Code:
$("meta[http-equiv='refresh'][content]:first").each(function(){window.location.href=$(this).attr("content").replace(/^.*;url=/,"")});

Its JavaScript, make sure its marked in all pages.
Sir Chivas™
Sir Chivas™
Helper
Helper

Male Posts : 6983
Reputation : 457
Language : EN, FR, ES
Location : || CSS || HTML || Graphics Designs || Support ||

https://aforums.org

Back to top Go down

In progress Re: JavaScript code to disable certain page.

Post by Theomest June 2nd 2013, 10:01 pm

I'll try it.
I'll let you know if it's working.
And thanks for mark this as "In Progress"
Theomest
Theomest
New Member

Male Posts : 20
Reputation : 1
Language : English

Back to top Go down

In progress Re: JavaScript code to disable certain page.

Post by Sir Chivas™ June 2nd 2013, 10:02 pm

Alright, we'll wait for your answer. Thanks.
Sir Chivas™
Sir Chivas™
Helper
Helper

Male Posts : 6983
Reputation : 457
Language : EN, FR, ES
Location : || CSS || HTML || Graphics Designs || Support ||

https://aforums.org

Back to top Go down

In progress Re: JavaScript code to disable certain page.

Post by Theomest June 2nd 2013, 10:04 pm

Oh! It worked!
Thanks for the JavaScript code, Sir.
Thanks to you too, Ultron's Vision.

Sorry for the trouble, really..
I appreciate it! Smile
Theomest
Theomest
New Member

Male Posts : 20
Reputation : 1
Language : English

Back to top Go down

In progress Re: JavaScript code to disable certain page.

Post by Sir Chivas™ June 2nd 2013, 10:04 pm

No problem, marked as solved. Very Happy
Topic Solved & Locked



Thread reopened.
Sir Chivas™
Sir Chivas™
Helper
Helper

Male Posts : 6983
Reputation : 457
Language : EN, FR, ES
Location : || CSS || HTML || Graphics Designs || Support ||

https://aforums.org

Back to top Go down

Page 1 of 2 1, 2  Next

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum