vitaMAX 3 Posted April 25, 2014 Report Share Posted April 25, 2014 Привет, профи! Есть скрипт, дернутый с сайта друпал. Пытаюсь его вставить на сайт с другой CMS (joomla). Но в скрипте есть друпаловские заморочки, которые я не смог заменить на чистый jQuery. Помогите, профи! (function ($) { Drupal.behaviors.catalog_block = { attach: function (context, settings) { var updateTitles = function () { if ($(".catalog .samples .sample.sample-gloss:visible").length == 0) { $(".title-gloss").hide(); } else { $(".title-gloss").show(); } if ($(".catalog .samples .sample.sample-mat:visible").length == 0) { $(".title-mat").hide(); } else { $(".title-mat").show(); } } var select = $(".catalog .filter #filter"); var select_values = []; $(".catalog .samples .sample").each(function (i, sample) { var current_size = $(sample).data("filter-size"); for (var key in current_size) { var value = current_size[key]; if (jQuery.inArray(value, select_values) == -1) { select_values.push(value); } } }); select_values.sort().forEach(function (value, key) { select.append('<option value="' + value + '">' + value + '</option>'); $(".select-filter").append('<a class="select-filter-value" id="' + value +'">' + value + ' см</a>'); }); var samples = $(".catalog .samples .sample"); $("a.select-filter-value").click(function () { var value_link = $(this).attr('id'); $("a.select-filter-value").removeClass("active"); $(this).addClass("active"); if (value_link != 'all') { samples.hide(); samples.each(function (i, element) { var current_size = $(element).data("filter-size"); for (var key in current_size) { var value = current_size[key]; if (value == value_link) { $(element).show(); updateTitles(); } } }) } else { samples.show(); updateTitles(); } }); $(".catalog .samples .sample .color").click(function () { $(".catalog .samples .sample").removeClass("active"); $(this).parent().addClass("active"); $(".sample-gloss .color").click(function () { $(".catalog img.mat").hide(); var test = $(this).css("background-color"); $(".catalog .display").html("<div class='display-bg' style='background-color:" + test + ";'></div>"); $(".catalog img.gloss").show(); }); $(".sample-mat .color").click(function () { $(".catalog img.gloss").hide(); var test = $(this).css("background-color"); $(".catalog .display").html("<div class='display-bg' style='background-color:" + test + ";'></div>"); $(".catalog img.mat").show(); }); }); $(".catalog .samples .sample:first .color").click(); } }; }(jQuery)); Как заменить вот эти строки: Drupal.behaviors.catalog_block = { attach: function (context, settings) { Link to post Share on other sites
shift196 67 Posted April 25, 2014 Report Share Posted April 25, 2014 Узнай что за обьект catalog_block, какие у него свойства и методы и замени , в чем проблема то? Link to post Share on other sites
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now