package Koha::Plugin::Pt::KEEPS::BiblioISBDDetail;

use Modern::Perl;

use base qw(Koha::Plugins::Base);

our $VERSION = '1.0';

our $metadata = {
    name   => 'KEEPS - Biblio ISBD Detail',
    author => 'Keep Solutions',
    description => 'Removes repeated information at ISBD detail page',
    date_authored   => '2022-01-24',
    date_updated    => undef,
    minimum_version => '21.05',
    maximum_version => undef,
    version         => $VERSION,
};

sub new {
    my ( $class, $args ) = @_;

    $args->{'metadata'} = $metadata;
    $args->{'metadata'}->{'class'} = $class;

    my $self = $class->SUPER::new($args);

    return $self;
}

# Mandatory even if does nothing
sub install {
    my ( $self, $args ) = @_;

    return 1;
}

# Mandatory even if does nothing
sub upgrade {
    my ( $self, $args ) = @_;

    return 1;
}

# Mandatory even if does nothing
sub uninstall {
    my ( $self, $args ) = @_;

    return 1;
}

sub intranet_js {
    my ( $self ) = @_;

    return q%
<script>
    var pathname = window.location.pathname;
    if (pathname.match("/cgi-bin/koha/catalogue/ISBDdetail.pl")) {
        if ($("#f700").length > 0) {
            $("#f710").hide();
            $("#f500").hide();
            $("#f200").hide();
        } else if ($("#f710").length > 0) {
            $("#f700").hide();
            $("#f200").hide();
        } else if ($("#f200").length > 0) {
            $("#f700").hide();
            $("#f710").hide();
            $("#f500").hide();
        }
        $("#isbdtitle").text(function (_, txt) {
            return txt.slice(0, -2) + " ";
        });
    }
</script>
%;
}

1;