Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2015-05-07 07:54:35

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,578
Website

Re: jquery - viewport

My mistake: It turns out $(window).on('resize', function() … is the same as $(window).resize(function () … (as described here). Both variants should work.

Something like this should work with formstone mediaquery and the bxslider reload function as described here (btw: this shows an example of the preventDefault() described in the other thread):

<script src="path/to/js/formstone/core.js"></script>
<script src="path/to/js/formstone/mediaquery.js"></script>
<script>
  $(function(){

    // initialize slider the first time
    var slider = $('.slider').bxSlider({
    	slideWidth: 340,
    	minSlides: 3,
    	maxSlides: 3,
    	moveSlides: 2,
    	slideMargin: 10
    });

    // trigger event when a media-query boundary is crossed
    $.mediaquery("bind", "mq-key", "(max-width: 960px)", {

        // less than 960px – reload slider with 1 slide in view
        enter: function() {

          slider.reloadSlider({
            minSlides: 1,
            maxSlides: 1,
            moveSlides: 1
          });

        },

        // greater than 960px – reload slider with 3 slides in view
        leave: function() {

          slider.reloadSlider({
            minSlides: 3,
            maxSlides: 3,
            moveSlides: 2
          });

        }
    });

  });
</script>

(Note: for IE8 and IE) you may need a matchmedia polyfill as described here)

If you want to work mobile-first, you would do it the other way and start with the 1 slide settings and then change to 3 slides on min-width: 960px.

BTW: I often get a “403: ERR_TOO_MANY_REDIRECTS” when I call up your site. Maybe that’s your maintenance mode, or maybe your IP filtering is refusing my normal t-online Germany IP range.


TXP Builders – finely-crafted code, design and txp

Offline

#14 2015-05-07 08:20:33

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,007
Website GitHub Mastodon Twitter

Re: jquery - viewport

jakob wrote #290534:

My mistake: It turns out $(window).on('resize', function() … is the same as $(window).resize(function () … (as described here). Both variants should work.

Something like this should work with formstone mediaquery and the bxslider reload function as described here (btw: this shows an example of the preventDefault() described in the other thread):

<script src="path/to/js/formstone/core.js"></script>...

(Note: for IE8 and IE) you may need a matchmedia polyfill as described here)

Thanks soo much.. I’ll check this now

BTW: I often get a “403: ERR_TOO_MANY_REDIRECTS” when I call up your site. Maybe that’s your maintenance mode, or maybe your IP filtering is refusing my normal t-online Germany IP range.

Hmm that may be arc_redirect. I actually do have a lot of redirects pushing hackers to google. The site has been infested from script kids trying to find vulnerabilities. The main url variations they use, are fckedior, connectors, wp-admin, wp-login, uploadTester, Tester, admin, wp, wp-content, xmlrpc, ckeditor and editor. All together there are about 200 urls.

I tried to use the rules below in the htaccess but they do not work as it just returns a 404. Since your report I disabled the plugin as reaching the site is more important than pushing the hackers out.

RewriteEngine on
RewriteCond %{REQUEST_URI} admin [OR]
RewriteCond %{REQUEST_URI} fckedior [OR]
RewriteCond %{REQUEST_URI} ckeditor [OR]
RewriteCond %{REQUEST_URI} wp-admin [OR]
RewriteCond %{REQUEST_URI} wp-login [OR]
RewriteCond %{REQUEST_URI} uploadTester [OR]
RewriteCond %{REQUEST_URI} Tester [OR]
RewriteCond %{REQUEST_URI} wp [OR]
RewriteCond %{REQUEST_URI} wp-content [OR]
RewriteCond %{REQUEST_URI} xmlrpc [OR]
RewriteCond %{REQUEST_URI} editor [OR]
RewriteCond %{REQUEST_URI} connectors
RewriteRule http://google.com [R]

Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#15 2015-05-07 10:46:21

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,134
GitHub

Re: jquery - viewport

colak wrote #290536:

I actually do have a lot of redirects pushing hackers to google.

I’d be hesitant to do this. I can totally see the logic, but if something/someone at Google sees slews of that type of traffic it might trigger something that blocklists you, or something similar. How about redirecting to 127.0.0.1 instead?

Offline

#16 2015-05-07 12:07:26

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,007
Website GitHub Mastodon Twitter

Re: jquery - viewport

Hi Pete

At the moment there are no redirects as some ISPs seem to not like them. i wish that the htaccess rule worked and I would add the ip address you suggested.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#17 2015-05-08 01:12:59

GugUser
Member
From: Quito (Ecuador)
Registered: 2007-12-16
Posts: 1,473

Re: jquery - viewport

What about this?

RewriteCond %{REQUEST_URI} ^/(admin|ckeditor|connectors|editor|fckedior|Tester|uploadTester|wp|wp-admin|wp-content|wp-login|xmlrpc).* [NC]
RewriteRule .* - [F,L]

But, if you have an URL which also contains, for example, the expression “editor” or “tester”, then it’s blocked too.

Offline

#18 2015-05-08 05:21:57

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,007
Website GitHub Mastodon Twitter

Re: jquery - viewport

Hi that works but for me it’s the same as a 404 which is what they get anyway. The idea is to redirect them to another url so as to get them away from the site sooner rather than have them try -which some of them do – 50 different combinations.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#19 2015-05-08 12:18:07

GugUser
Member
From: Quito (Ecuador)
Registered: 2007-12-16
Posts: 1,473

Re: jquery - viewport

To the new, poor victim, which then must be active again.

RewriteRule .* http://to-the-new-poor-victim.net/ [R=301,L]

Or how gaekwad wrote.

Offline

#20 2015-05-08 14:36:14

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,007
Website GitHub Mastodon Twitter

Re: jquery - viewport

GugUser wrote #290572:

To the new, poor victim, which then must be active again.

RewriteRule .* http://to-the-new-poor-victim.net/ [R=301,L]...

Or how gaekwad wrote.

Again, thanks so much for all your advice. No, that rule does not work as it just returns a 404. My bad I had a typo. Works as expected. thanks sooo much


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#21 2015-05-08 14:50:25

GugUser
Member
From: Quito (Ecuador)
Registered: 2007-12-16
Posts: 1,473

Re: jquery - viewport

Because the complete thing is:

RewriteCond %{REQUEST_URI} ^/(admin|ckeditor|connectors|editor|fckedior|Tester|uploadTester|wp|wp-admin|wp-content|wp-login|xmlrpc).* [NC]
RewriteRule .* http://to-the-new-poor-victim.net/ [R=301,L]

And you have to replace my invented URL http://to-the-new-poor-victim.net by the URL of your “enemy”.

Last edited by GugUser (2015-05-08 14:52:25)

Offline

#22 2015-05-08 15:01:03

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,007
Website GitHub Mastodon Twitter

Re: jquery - viewport

Hi I actually did that with Pete’s IP but I forgot the dot before the asterisk. On further testing it semi works. ie it works only if the word comes after the url so if somebody visits domain.tld/wp/ they are kicked out but if somebody visits domain.tld/something/wp/, they get a 404.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#23 2015-05-08 15:46:14

GugUser
Member
From: Quito (Ecuador)
Registered: 2007-12-16
Posts: 1,473

Re: jquery - viewport

RewriteCond %{REQUEST_URI} (admin|ckeditor|connectors|editor|fckedior|Tester|uploadTester|wp|wp-admin|wp-content|wp-login|xmlrpc) [NC]

Offline

#24 2015-05-08 16:20:19

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,007
Website GitHub Mastodon Twitter

Re: jquery - viewport

Thank you, Thank you, Thank you that indeed works as expected!!!


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

Board footer

Powered by FluxBB