Plugin Directory

Changeset 1526283


Ignore:
Timestamp:
11/01/2016 09:16:26 PM (9 years ago)
Author:
Dejan Batanjac
Message:

Maintenance release.

Location:
responsive/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • responsive/trunk/readme.txt

    r1383363 r1526283  
    1 === responsive ===
     1=== Responsive ===
    22
    33Contributors: Dejan Batanjac
     
    55Requires at least: 3.0
    66Tested up to: 4.5 beta
    7 Stable tag: 1.0
     7Stable tag: 1.1.0
    88
    99Resizes any non responsive web site, and makes it responsive with the simple trick of CSS scaling achieved using jQuery
    1010
    1111== Description ==
    12 This simple WordPress plugin inserts smart jQuery code to your website header and makes old, non-responsive web sites automatically responsive. It doesn't use Bootstrap, nor any responsive grid system. 
     12This simple WordPress plugin inserts smart jQuery code to your website header and makes old, non-responsive web sites automatically responsive. It doesn't use Bootstrap, nor any responsive grid system.
    1313
    1414The only requirement is JavaScript (jQuery) being enabled in your browser. If no JavaScrpt enabled, then the plugin will not have any impact.
     
    1616== Installation ==
    1717
    18 1. Upload `responsive`  folder to the `/wp-content/plugins/` directory
    19 1. Activate the plugin through the 'Plugins' menu in WordPress
     181. Upload the plugin
     191. Activate the plugin
    2020
    2121
     
    2727== Changelog ==
    2828
     29
     30= 1.1.0 =
     31Tabs into spaces.
     32
    2933= 1.0 =
    30 
    3134Initial version
  • responsive/trunk/responsive.php

    r1383363 r1526283  
    11<?php
    2 /*
    3 Plugin Name: Responsive
    4 Plugin URI: http://programming-review.com/
    5 Description: Can make your theme responsive without any effort
    6 Author: Dejan Batanjac
    7 Version: 1.0
    8 Author URI: http://programming-review.com/
    9 License: GPLv2 or later
    10  
    11 */
    12 
     2/**
     3 * Plugin Name: Responsive
     4 * Plugin URI: http://programming-review.com/
     5 * Description: Will make your theme responsive without any effort
     6 * Author: Dejan Batanjac
     7 * Version: 1.1.0
     8 * Author URI: https://programming-review.com/
     9 * License: GPLv2 or later
     10 */
     11if ( ! class_exists( 'Responsive' ) ) :
    1312class Responsive {
    1413
    15     /*--------------------------------------------*
    16      * Constants
    17      *--------------------------------------------*/
    18     const name = 'responsive';
    19     const slug = 'responsive';
    20    
    21     /**
    22      * [__construct makes sure jQuery h/b added]
    23      */
    24     function __construct() {
     14  // Constants
     15  const NAME = 'responsive';
     16  const SLUG = 'responsive';
    2517
     18  //////////////////////////////////////////////////
     19  // Constructor makes sure jQuery will be added. //
     20  //////////////////////////////////////////////////
     21  function __construct() {
    2622
    27         add_action( 'wp_enqueue_scripts', 'please_add_jquery' );
    28         function please_add_jquery() {    wp_enqueue_script( 'jquery' ); }     
    29        
     23    add_action( 'wp_enqueue_scripts', 'add_jquery' );
     24    function add_jquery() {
     25      wp_enqueue_script( 'jquery' );
     26    }
    3027
    31         //hook to wp_head
    32         add_action('wp_head',array( &$this, 'draw_' ));     
     28    add_action( 'wp_head', array( &$this, 'draw_' ) );
    3329
     30  } // End constructor().
    3431
    35     }
     32  ///////////////////////////////////
     33  // Main JavaScript resize script //
     34  ///////////////////////////////////
     35  function draw_() {
     36    ?>
     37    <script>
    3638
    37     /**
    38      * [draw_ Scales with factor X]
    39      * @return [bool] [true]
    40      */
    41     function draw_(){
    42         ?>
    43         <script>
     39      jQuery(window).resize(function() {
     40        safescale();
     41      });
     42      jQuery(document).ready(function() {
     43        jQuery(window).trigger('resize');
     44        jQuery(window).trigger('resize');
     45      });
    4446
    45             jQuery(window).resize(function() {     
    46                 safescale();   
    47             });
    48             jQuery(document).ready(function() {
    49                 jQuery(window).trigger('resize');
    50                 jQuery(window).trigger('resize');
     47      function scale(factor_x){
     48        jQuery('html').css("transform","scale("+factor_x+","+factor_x+")");
     49        jQuery('html').css("-moz-transform","scale("+factor_x+","+factor_x+")");
     50        jQuery('html').css("-webkit-transform","scale("+factor_x+","+factor_x+")");
     51        jQuery('html').css("-o-transform","scale("+factor_x+","+factor_x+")");
     52      }
    5153
    52             });
     54      function safescale(){
    5355
     56        factor_x = jQuery(window).width() / jQuery('body').width() ;
    5457
    55             function scale(factor_x){
    56                 jQuery('html').css("transform","scale("+factor_x+","+factor_x+")"); 
    57                 jQuery('html').css("-moz-transform","scale("+factor_x+","+factor_x+")");       
    58                 jQuery('html').css("-webkit-transform","scale("+factor_x+","+factor_x+")");
    59                 jQuery('html').css("-o-transform","scale("+factor_x+","+factor_x+")");
    60             } 
     58        jQuery("html").css({"position": "absolute", "margin": "0px", "padding": "0px"});
     59        jQuery("body").css({"position": "absolute", "margin": "0px", "padding": "0px"});
     60        scale(factor_x);
     61      }
     62    </script>
    6163
    62             function safescale(){
    63 
    64                 factor_x = jQuery(window).width() / jQuery('body').width() ;
    65 
    66                 jQuery("html").css({"position": "absolute", "margin": "0px", "padding": "0px"});
    67                 jQuery("body").css({"position": "absolute", "margin": "0px", "padding": "0px"});
    68                 scale(factor_x);
    69             }
    70         </script>
    71 
    72         <?php
    73         return true;
    74     }
     64    <?php
     65    return true;
     66  }
    7567
    7668
    7769} // end class
     70endif;
     71
    7872new Responsive();
    79 
    80 ?>
Note: See TracChangeset for help on using the changeset viewer.