Ignore:
Timestamp:
Jan 8, 2013, 12:46:37 PM (11 years ago)
Author:
cljosse
Message:
  • [style] cuise save
File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/cuise/admin/js/admin.js

    r19486 r19990  
    11jQuery(document).ready(function () {
    22  var input = $("input:file").val();
     3  var init_width;
     4
     5  if (jQuery('#fileInput').ajaxfileuploader) {
     6    jQuery('#fileInput').ajaxfileuploader({
     7      SCRIPT: process_script,
     8      PATH: path,
     9      PATH_THEME: path_theme,
     10      PATH_IMG: path_theme_images,
     11      VALIDFORMAT: ['jpeg', 'jpg', 'png', 'gif', 'bmp'],
     12      MAXUPLOAD: 9,
     13      TABLEHEAD: {
     14        name: 'name',
     15        imgname: 'image name',
     16        operation: 'Operation'
     17      }
     18    }
     19        )
     20
     21
     22    jQuery.fn.ajaxfileuploader.defaults = {
     23      SCRIPT: process_script,
     24      PATH: path,
     25      PATH_THEME: path_theme,
     26      PATH_IMG: path_theme_images,
     27      ACTION: '',
     28      VALIDFORMAT: ['jpeg', 'jpg', 'png', 'gif', 'bmp'],
     29      MAXUPLOAD: 5,
     30      TABLEHEAD: { name: 'name',
     31        imgname: 'image name',
     32        operation: 'Operation'
     33      }
     34    }
     35  }
     36
     37
     38  jQuery(window).resize(function (i) {
     39    if (jQuery("#picker").lenght > 0) {
     40      init_left = jQuery("#picker").offset().left - jQuery("#field_content").offset().left;
     41      init_left = jQuery("#picker").width() + init_left;
     42      width = jQuery("#field_content").width() - init_left - 60;
     43      marge = jQuery("#test").css("border");
     44      jQuery("#test").width(width);
     45      jQuery("#test").css({
     46        float: "right",
     47        right: "0px"
     48      });
     49    }
     50  });
     51
     52
     53  jQuery(".image").live('change', function (e) {
     54
     55    imgname = jQuery(".image").css("background-image");
     56  });
    357
    458  //===================================
     
    1670
    1771  });
    18 
     72  var text_id = "";
     73  jQuery("*").mouseover(function (i) {
     74    return;
     75
     76    id = jQuery(i.currentTarget).attr("id");
     77    name = jQuery(i.currentTarget).attr("name");
     78    var yourClass = i.currentTarget.className;
     79    if (yourClass == "select") return;
     80
     81    current = jQuery(i.currentTarget);
     82    jQuery("#infos").text(id);
     83    if (text_id != "") {
     84      jQuery(i.currentTarget).css("border", "solid 0px red");
     85      jQuery("#infos").text(text_id);
     86      text_id = "";
     87    }
     88
     89    return;
     90  });
     91  jQuery("*").mouseout(function (i) {
     92    return;
     93    id = jQuery(i.currentTarget).attr("id");
     94    name = jQuery(i.currentTarget).attr("name");
     95    var yourClass = i.currentTarget.className;
     96    if (yourClass == "select")
     97      jQuery(i.currentTarget).css("border", "solid 0px red");
     98
     99    return;
     100  });
     101  jQuery(window).load(function (i) {
     102    jQuery(window).resize();
     103    options = Get_Options();
     104
     105
     106
     107    jQuery(".image").css(options.direct);
     108    jQuery(".image a").css("color", options.direct.color);
     109    jQuery(".image a:hover").css("color", options.Hover.color);
     110    jQuery(".image:hover border-color").css("color", options.Hover.color);
     111
     112    jQuery("#selTab input").click(function (i) {
     113      return;
     114
     115      id = jQuery(i.currentTarget).attr("id");
     116      name = jQuery(i.currentTarget).attr("name");
     117      if (name == "sel_tab") {
     118        options = Get_Options();
     119
     120        switch (i.currentTarget.value) {
     121          case "0":
     122
     123            break;
     124          case "1":
     125            break;
     126          case "2":
     127            break;
     128          case "3":
     129            break;
     130          case "4":
     131            break;
     132        }
     133
     134
     135        if (!options) return;
     136        jQuery("." + name).css(options);
     137        jQuery(".image").css(options.direct);
     138        jQuery(".image").css(options.direct);
     139        jQuery(".image a").css("color", options.direct.color);
     140        jQuery(".image a:hover").css("color", options.Hover.color);
     141        jQuery(".image:hover border-color").css("color", options.Hover.color);
     142        return;
     143      }
     144
     145
     146      var yourClass = i.currentTarget.className;
     147
     148      if (text_id == "") {
     149        text_id = id + " ," + yourClass + " ," + i.currentTarget.nodeName;
     150        jQuery("#infos").text(text_id);
     151      }
     152
     153
     154    });
     155
     156  });
     157  function Get_Options() {
     158    options = { direct: {
     159      rayon: jQuery("#rayon_cuise").val(),
     160      chk_cuise: jQuery("#chk_cuise").val(),
     161      backgroundColor: jQuery("#bg_cuise").val(),
     162
     163
     164      backgroundImage: "url(" + jQuery("#img_src").text() + ")",
     165
     166      borderColor: jQuery("#bd_cuise").val(),
     167      borderWidth: jQuery("#bd_width").val(),
     168
     169
     170      //backgroundRepeat: jQuery("." + name).css('backgroundRepeat'),
     171      backgroundPosition: "center center",
     172
     173      color: jQuery("#co_cuise").val()
     174
     175    }, Hover: {
     176      backgroundColor: jQuery("#bgho_cuise").val(),
     177      borderColor: jQuery("#bdho_cuise").val(),
     178      color: jQuery("#coho_cuise").val()
     179    }
     180    }
     181    return options;
     182  }
     183
     184  jQuery("input").click(function (i) {
     185    tg = i.target;
     186    name_tpl = name_tpl;
     187
     188
     189    n = jQuery(this).attr("name");
     190    if (n == "sel_tab") return;
     191
     192    types = n.split("_");
     193
     194    if (n.lastIndexOf("_") < 0) return;
     195    id = n.substring(n.lastIndexOf("_") + 1);
     196    if (!isNaN(id)) {
     197      name = name_tpl[id];
     198      type = types[0];
     199      new_val = jQuery(tg).val();
     200      options = Get_Options();
     201
     202     
     203      switch (type) {
     204        case 'rayon':
     205
     206          options.direct['MozBorderRadius'] = new_val;
     207          options.direct['borderRadius'] = new_val + " " + new_val;
     208
     209
     210          break;
     211
     212        case 'bg':
     213          options.direct['backgroundColor'] = new_val;
     214          break;
     215        case 'bgho':
     216          name = name + "";
     217          options.Hover['backgroundColor'] = new_val;
     218          break;
     219        case 'bd':
     220
     221          if (types[1] == 'width') {
     222            options.direct['borderStyle'] = "Solid";
     223            options.direct['borderWidth'] = new_val;
     224          } else {
     225            options.direct['borderColor'] = new_val;
     226          }
     227          break;
     228        case 'bdho':
     229          name = name + "";
     230          options.Hover['borderColor'] = new_val;
     231          break;
     232        case 'co':
     233          name = name + " a";
     234          options.direct['color'] = new_val;
     235          break;
     236        case 'coho':
     237          name = name + " a";
     238          options.Hover['color'] = new_val;
     239          break;
     240
     241        case 'chk':
     242
     243          switch (types[2]) {
     244            case 'x':
     245              options.direct['backgroundRepeat'] = 'repeat-x';
     246              break;
     247            case 'y':
     248              options.direct['backgroundRepeat'] = 'repeat-y';
     249              break;
     250            case id:
     251              img_src = jQuery("#img_src").text();
     252              if (tg.checked) {
     253                options.direct['backgroundImage'] = 'none';
     254              } else {
     255                options.direct['backgroundColor'] = 'Transparent';
     256                options.direct['backgroundImage'] = "url(" + img_src + ")";
     257                options.direct['backgroundPosition'] = "center center";
     258              }
     259              break;
     260          }
     261          break;
     262
     263
     264      }
     265
     266
     267      delta = parseInt(options['borderWidth']) * 2;
     268      width = jQuery("#fldres").width() - jQuery("#picker").width() - 55;
     269      width -= delta;
     270      jQuery("#test").width(width);
     271
     272       jQuery("." + name).css( options.direct );
     273      jQuery("." + name +":hover" ).css( "color",options.Hover.color );
     274 
     275    }
     276  });
    19277
    20278
     
    24282  });
    25283
    26   var f = jQuery.farbtastic('#picker');
    27   var p = jQuery('#picker').css('opacity', 1);
    28   var selected;
    29   jQuery('.colorwell')
    30       .each(function () {
    31         f.linkTo(this);
    32         $(this).css('opacity', 1);
    33 
    34       })
    35       .focus(function () {
    36         if (selected) {
    37           $(selected).css('opacity', 1).removeClass('colorwell-selected');
    38         }
    39         f.linkTo(this);
    40         p.css('opacity', 1);
    41         $(selected = this).css('opacity', 1).addClass('colorwell-selected');
    42         col = $(selected = this).css("backgroundColor");
    43 
    44       });
     284
    45285});
    46286
Note: See TracChangeset for help on using the changeset viewer.