0

我的 cms 页面中有以下脚本:

window.addEvent('domready', function () {

    SqueezeBox.initialize({});
    SqueezeBox.assign($$('a.modal'), {
        parse: 'rel'
    });
});

var j2storeURL = 'http://tours-international.com.gridhosted.co.uk/';

if (typeof (J2Store) == 'undefined') {
    var J2Store = jQuery.noConflict();
}


J2Store(document).ready(function () {
    J2Store('.j2storeCartForm').each(function () {
        J2Store(this).validate({
            errorElement: 'em',
            errorPlacement: function (error, element) {
                error.appendTo(element.parent().parent().next('div'));
            },
            success: function (label) {
                //label.text('Ok').addClass('success');
            },
            submitHandler: function (form) {

                j2storeAddToCart('addtocart', form);

            }
        });
    });
});

jQuery(document).ready(function () {
    jQuery('.hasTooltip').tooltip({});
});

我想遍历上面并删除以下JS:

SqueezeBox.initialize({});

SqueezeBox.assign($$('a.modal'), {
    parse: 'rel'
});

请建议最简单/最小的方法来做到这一点。

4

1 回答 1

0

If I understood the question correctly, you want to remove that part from a file???

If yes, then you can do the following:

  1. Read the file into string $file_str = file_get_contents('your_file_path');
  2. Get the positions: $pos_a = strpos($file_str, "SqueezeBox") and $pos_b = strpos($file_str, "var")
  3. Write this back: substr_replace($file_str, "", $pos_a, ($pos_b - $pos_a));

Good luck

于 2013-06-15T08:36:08.437 回答