The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

JavaScript code to disable certain page.

Page 1 of 2 1, 2  Next

View previous topic View next topic Go down

In progress JavaScript code to disable certain page.

Post by Theomest on Sun Jun 02, 2013 11:51 am

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.

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 Mon Jun 03, 2013 1:10 am; edited 5 times in total

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 on Sun Jun 02, 2013 12: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
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 on Sun Jun 02, 2013 12:04 pm

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

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_! on Sun Jun 02, 2013 12:19 pm

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

!_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 on Sun Jun 02, 2013 12: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
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_! on Sun Jun 02, 2013 12:23 pm

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

!_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 on Sun Jun 02, 2013 12:24 pm

It's OK, I don't really mind.

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 on Sun Jun 02, 2013 12: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
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 on Sun Jun 02, 2013 12:38 pm

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

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 on Sun Jun 02, 2013 12: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.


Forum Rules: :Forumotion Staff: :Appeal A Warning: :FAQ: :Tips & Tricks: :Forgotten Password/Login Issues
You need one post to send a PM
When your topic has been solved, ensure you mark the topic solved
Never post your email in public


Derri
Administrator
Administrator

Male Posts : 8385
Reputation : 576
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 on Sun Jun 02, 2013 12:47 pm

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

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 on Sun Jun 02, 2013 12: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
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 on Sun Jun 02, 2013 12: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
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 on Sun Jun 02, 2013 1: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
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 on Sun Jun 02, 2013 1:04 pm

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

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 on Sun Jun 02, 2013 1: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
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 on Sun Jun 02, 2013 1:10 pm

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

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

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 on Sun Jun 02, 2013 1:15 pm

Did you try with the updated code?

Otherwise I'll do it with RegExps again.

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 on Sun Jun 02, 2013 1: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
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 on Sun Jun 02, 2013 1: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
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 on Sun Jun 02, 2013 1: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
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 on Sun Jun 02, 2013 1: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
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 on Sun Jun 02, 2013 1: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
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™ on Sun Jun 02, 2013 1:50 pm

Is this solved?



Attention!
- Please provide your forum URL at all times.
- When the issue is solved, please mark it as solved.



Sir Chivas™
Support Moderator
Support Moderator

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

Back to top Go down

In progress Re: JavaScript code to disable certain page.

Post by Theomest on Sun Jun 02, 2013 1: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
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™ on Sun Jun 02, 2013 1: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.



Attention!
- Please provide your forum URL at all times.
- When the issue is solved, please mark it as solved.



Sir Chivas™
Support Moderator
Support Moderator

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

Back to top Go down

In progress Re: JavaScript code to disable certain page.

Post by Theomest on Sun Jun 02, 2013 2:01 pm

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

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™ on Sun Jun 02, 2013 2:02 pm

Alright, we'll wait for your answer. Thanks.



Attention!
- Please provide your forum URL at all times.
- When the issue is solved, please mark it as solved.



Sir Chivas™
Support Moderator
Support Moderator

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

Back to top Go down

In progress Re: JavaScript code to disable certain page.

Post by Theomest on Sun Jun 02, 2013 2: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
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™ on Sun Jun 02, 2013 2:04 pm

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



Thread reopened.



Attention!
- Please provide your forum URL at all times.
- When the issue is solved, please mark it as solved.



Sir Chivas™
Support Moderator
Support Moderator

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

Back to top Go down

Page 1 of 2 1, 2  Next

View previous topic View next topic Back to top


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