Plugin Directory

Changeset 424304


Ignore:
Timestamp:
08/16/2011 04:16:26 PM (15 years ago)
Author:
dexxaye
Message:

made path link to top of block only
made admin preview easier to manage
added canvas size option

Location:
fancy-sitemap/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • fancy-sitemap/trunk/css/admin.css

    r423516 r424304  
    33#fancySitemapAdmin .formRow{margin:10px 0;}
    44#fancySitemapAdmin .formRow label{vertical-align: top;}
    5 #fancySitemapAdmin select{width:auto;height:auto;min-width:350px;}
     5#page_exclude{width:auto;height:250px !important;min-width:350px;}
     6#sitemapHolder{border:1px solid #000000;position:relative;}
     7.hMarkerTop{position:absolute;top:0;height:5px;width:2px;background:#ff0000;}
     8.hMarkerBot{position:absolute;bottom:0;height:5px;width:2px;background:#ff0000;}
     9.vMarkerLeft{position:absolute;left:0;height:2px;width:5px;background:#ff0000;}
     10.vMarkerRight{position:absolute;right:0;height:2px;width:5px;background:#ff0000;}
  • fancy-sitemap/trunk/fancy-sitemap.php

    r423535 r424304  
    55  Plugin URI: http://www.bunchacode.com/programming/fancy-sitemap/
    66  Description: generates a javascript/html5 sitemap.
    7   Version: 0.6
     7  Version: 0.7
    88  Author: Jiong Ye
    99  Author URI: http://www.bunchacode.com
     
    6060    $output = '';
    6161   
    62     if($type=='page')
    63     {
     62    if($type=='page'){
    6463        $pageExcludes = get_option(FS_TYPE_PAGE_EXCLUDE);
    6564        $pages = wp_list_pages(array(
  • fancy-sitemap/trunk/js/fancy_sitemap.js

    r423516 r424304  
    11(function($) {
     2    /*
     3     * function stolen from rephaeljs.com demo to create a path between objects
     4     */
    25    Raphael.fn.connection = function (obj1, obj2, line, bg) {
    36        if (obj1.line && obj1.from && obj1.to) {
     
    5861            }
    5962        }
     63       
    6064        if (dis.length == 0) {
    6165            var res = [0, 4];
     
    6569        var x1 = p[res[0]].x,
    6670        y1 = p[res[0]].y,
    67         x4 = p[res[1]].x,
    68         y4 = p[res[1]].y;
     71        x4 = p[4].x,
     72        y4 = p[4].y;
    6973        dx = Math.max(Math.abs(x1 - x4) / 2, 10);
    7074        dy = Math.max(Math.abs(y1 - y4) / 2, 10);
     
    7377        x3 = [0, 0, 0, 0, x4, x4, x4 - dx, x4 + dx][res[1]].toFixed(3),
    7478        y3 = [0, 0, 0, 0, y1 + dy, y1 - dy, y4, y4][res[1]].toFixed(3);
    75         var path = ["M", x1.toFixed(3), y1.toFixed(3), "C", x2, y2, x3, y3, x4.toFixed(3), y4.toFixed(3)].join(",");
     79       
     80        var lineStyle = options.line_style?options.line_style:'C';
     81        var path = ["M", x1.toFixed(3), y1.toFixed(3), lineStyle, x2, y2, x3, y3, x4.toFixed(3), y4.toFixed(3)].join(",");
    7682        if (line && line.line) {
    7783            line.bg && line.bg.attr({
     
    102108    $(document).ready(function(){
    103109        var sitemap = cleanHtml($('.fancySitemap')).hide();
    104         var holder = $('#sitemapHolder');
     110        var holder = $('#sitemapHolder').css({width:options.canvas_width,height:options.canvas_height});
    105111        var r = Raphael("sitemapHolder", holder.width(), holder.height());
    106112        var connections = [];
    107113        var tree = [];
    108114       
    109         $('#savePosition').hide();
    110        
     115        if(typeof preview !== 'undefined' && preview==true){
     116            $('#savePosition').hide();
     117           
     118            //display width and height markers
     119            var widthMarker = Math.floor(holder.width()/10);
     120            var markerLeft = widthMarker;
     121            while(markerLeft < holder.width()){
     122                var marker = $('<div />',{'class':'hMarkerTop'})
     123                    .css({left:markerLeft})
     124                    .appendTo(holder);
     125               
     126                marker.clone().attr('class', 'hMarkerBot').appendTo(holder);
     127                markerLeft += widthMarker;
     128            }
     129           
     130            var heightMarker = Math.floor(holder.height()/10);
     131            var markerTop = heightMarker;
     132            while(markerTop < holder.height()){
     133                var marker = $('<div />',{'class':'vMarkerLeft'})
     134                    .css({top:markerTop})
     135                    .appendTo(holder)
     136                    .clone()
     137                        .attr('class', 'vMarkerRight')
     138                        .appendTo(holder);
     139                markerTop += heightMarker;
     140            }
     141        }
     142       
     143        /*
     144         * dragger, move and up are callback functions for drag event of block
     145         */
    111146        var dragger = function () {
    112147            this.ox = this.attr("x");
     
    187222       
    188223        /*
     224         * recursive function to fill a tree from ul
     225         * blocks are created here
    189226         * parent = root or subroot of a tree
    190227         * canvasWidth = canvas width
     
    269306        }
    270307   
     308        /*
     309         * recursive function to link the blocks together with svg path
     310         * and stylizes blocks
     311         * tree = array of object
     312         * parent = root of a subtree
     313         * c = connection array
     314         * r = rapheal object
     315         */
    271316        function buildTree(tree, parent, c, r){
    272317            if(tree != null){
  • fancy-sitemap/trunk/readme.txt

    r423535 r424304  
    44Requires at least: 3.0
    55Tested up to: 3.2.1
    6 Stable tag: 0.6
     6Stable tag: 0.7
    77
    88Fancy sitemap generates a javascript/svg sitemap.
  • fancy-sitemap/trunk/views/admin_options.php

    r423535 r424304  
    6464                <legend>Options</legend>
    6565                <div class="formRow">
     66                    <label for="bbc">Canvas Size:</label>
     67                    <input type="text" name="options[canvas_width]" size="1" value="<?php echo !empty($options['canvas_width'])?$options['canvas_width']:'450';?>" /> X
     68                    <input type="text" name="options[canvas_height]" size="1" value="<?php echo !empty($options['canvas_height'])?$options['canvas_height']:'250';?>" />
     69                </div>
     70                <div class="formRow">
    6671                    <label for="bbc">Auto Block Width:</label>
    6772                    <input type="hidden" name="options[auto_size]" value="0" />
     
    97102                </div>
    98103                <div class="formRow">
     104                    <label for="lc">Line Style:</label>
     105                    <select name="options[line_style]">
     106                        <option value="C" <?php echo isset($options['line_style']) && $options['line_style']=='C'?'selected="selected"':'';?>>Curve Line</option>
     107                        <option value="L" <?php echo isset($options['line_style']) && $options['line_style']=='L'?'selected="selected"':'';?>>Straight Line</option>
     108                        <option value="T" <?php echo isset($options['line_style']) && $options['line_style']=='Q'?'selected="selected"':'';?>>Crazy Curve</option>
     109                    </select>
     110                </div>
     111                <div class="formRow">
    99112                    <label for="bbc">Font Size:</label>
    100113                    <input type="text" name="options[font_size]" size="1" value="<?php echo isset($options['font_size'])?$options['font_size']:'8';?>" />
     
    122135                <small>Use this to preview and position your sitemap.<br />Admin section and frontend should have a similar width so it looks the same on both.</small>
    123136                <div class="formRow">
    124                     <div id="sitemapHolder">
    125                         <?php echo fancy_sitemap_get_output(true);?>
    126                     </div>
    127                     <div class="formRow">
    128                         <input type="submit" value="Save" class="button" id="savePosition" />
    129                     </div>
     137                    <?php echo fancy_sitemap_get_output(true);?>
     138                </div>
     139                <div class="formRow">
     140                    <input type="submit" value="Save" class="button" id="savePosition" />
    130141                </div>
    131142            </fieldset>
Note: See TracChangeset for help on using the changeset viewer.