Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save fraktik/c90ec24d9230070f417e39d7ce068523 to your computer and use it in GitHub Desktop.
Save fraktik/c90ec24d9230070f417e39d7ce068523 to your computer and use it in GitHub Desktop.
UO - báze (Brandýs) + navíc
... nedokončeno...
/* Co jsem jeste necetl od autora? */
/* !!! reports=100 nahradit spravnou hodnotou !!! */
if (typeof borrowernumber != 'undefined') {
$('<li><a href="/cgi-bin/koha/reports/guided_reports.pl?reports=67&limit=500&phase=Run+this+report&sql_params=' + borrowernumber + '" onclick="window.location.href = this.href + \'&sql_params=\' + prompt(\'Autor [příjmení, jméno]:\'); return false;">Co ještě nečetl?</a></li>').insertAfter(".patroninfo+#menu li:nth-child(4)");
}
/* Co jsem jeste necetl od autora? */
$("#cat_addbiblio textarea, #cat_addbiblio input").blur(function() {
$(this).val($(this).val().replace(/[\u2010-\u2017]/g, "-"));
$(this).val($(this).val().replace(/[\u0080-\u009F\u00A0\u2000-\u200F\u2020-\u202F\u2060-\u206F]/g, ""));
});
/* Popisek tlačítka pro tisk průvodky při přesunu */
$("#return1 .openWin").html('<i class="fa fa-print"></i> Vytisknout lístek');
/* Kopírování pole 260 do pole 264 - převod na RDA */
if($("[id^='tag_264_subfield_a']:first").val() == "") {
$("[id^='tag_264_subfield_a']:first").val($("[id^='tag_260_subfield_a']:first").val());
}
if($("[id^='tag_264_subfield_b']:first").val() == "") {
$("[id^='tag_264_subfield_b']:first").val($("[id^='tag_260_subfield_b']:first").val());
}
if($("[id^='tag_264_subfield_c']:first").val() == "") {
$("[id^='tag_264_subfield_c']:first").val($("[id^='tag_260_subfield_c']:first").val());
}
$("[name^='tag_264_indicator2']").val("1");
/* barvy v záhlaví - detske oddeleni fialove */
$(".logged-in-branch-code:contains('M')").parents(".navbar-inner").css("background-color","#EE88EE");
$(".logged-in-branch-code:contains('M')").parents("body").children(".gradient").css("background","#EE88EE");
var SMSAlertValue = $("input#SMSnumber").val();
$("input#SMSnumber").parent().remove();
$('<li><label for="SMSnumber">SMS číslo:</label><input type="text" id="SMSnumber" name="SMSnumber" value="' + SMSAlertValue + '" class="noEnterSubmit"></li>').insertAfter($("input#phonepro").parent());
$("input#phone").change(function() {
$("input#SMSnumber").val($(this).val().replace(/\s+/g, ''));
});
/* zvýrazní nedání souhlasu */
$(".patronattribute:contains('Ne')").css("color","red");
if ($("#patron_attr_2").val() == '') {
$("#patron_attr_2").val(0);
}
if ($("#patron_attr_4").val() == '') {
$("#patron_attr_4").val(0);
}
$("#addbibliotabs li:nth-child(1) a").text("Systém");
$("#addbibliotabs li:nth-child(2) a").text("Autor");
$("#addbibliotabs li:nth-child(3) a").text("Název a vydání");
$("#addbibliotabs li:nth-child(4) a").text("Fyzický popis");
$("#addbibliotabs li:nth-child(5) a").text("Edice");
$("#addbibliotabs li:nth-child(6) a").text("Poznámky");
$("#addbibliotabs li:nth-child(7) a").text("Věcný popis");
$("#addbibliotabs li:nth-child(8) a").text("Vedlejší záhlaví");
$("#addbibliotabs li:nth-child(9) a").text("Elekronický přístup");
$("#addbibliotabs li:nth-child(10) a").text("Národní pole");
$("#searchterms div:nth-child(2) select").val("kw");
$("#searchterms div:nth-child(3) select").val("ti");
$("#searchterms div:nth-child(4) select").val("au");
$("#alt_address_lgd, #alt_contact_lgd").parent().find("ol").hide();
$("#alt_address_lgd, #alt_contact_lgd").click(function(){
$(this).parent().find("ol").slideToggle("slow");
});
/* $("#serials_edit [id$='0p'] input[type='text']").focus(function() {
$(this).val($("[id^='serialseq']").val());
}); */
$("#serials_edit [id$='0x'] input[type='text']").focus(function() {
$(this).val($("[name='publisheddatetext']").val());
});
/* OK při přesunu - nefunguje kvůli refocusu na další výpůjčku */
if (window.location.href.indexOf("circ/returns.pl") > -1) {
var confirmation = $("#wrong-transfer-modal, #item-transfer-modal");
if (confirmation.length) {
var html = '<input type="text" name="yesno" value="" size="3">';
$(html).prependTo(confirmation.find(".modal-footer").first());
var answerYes = confirmation.find("button.approve");
var barcodeField = $("input[name='yesno']");
barcodeField.focus();
barcodeField.blur(function(event) {
var response = barcodeField.val();
barcodeField.val("");
if (response == "900009999995") { // OK = ANO - nastavit dle potřeby!!!
answerYes.click();
}
barcodeField.focus();
event.preventDefault();
});
}
}
/* OK při přesunu */
/* predvyplneni formulare v editaci dosleho periodika */
/* set item type for newspaper */
$("#ser_serials-edit #serials_edit input[name='subscriptionid'][value='4'], #ser_serials-edit #serials_edit input[name='subscriptionid'][value='5'], #ser_serials-edit #serials_edit input[name='subscriptionid'][value='6'], #ser_serials-edit #serials_edit input[name='subscriptionid'][value='7'], #ser_serials-edit #serials_edit input[name='subscriptionid'][value='8'], #ser_serials-edit #serials_edit input[name='subscriptionid'][value='9'], #ser_serials-edit #serials_edit input[name='subscriptionid'][value='127']").parent().find("[id^='subfield'][id$='y'] select").first().val("NO");
/* set human readable date to text date field for newspaper */
today = new Date();
todayHuman = today.getDate() + '. ' + (today.getMonth() + 1) + '. ' + today.getFullYear();
$("#ser_serials-edit #serials_edit input[name='subscriptionid'][value='4'], #ser_serials-edit #serials_edit input[name='subscriptionid'][value='5'], #ser_serials-edit #serials_edit input[name='subscriptionid'][value='6'], #ser_serials-edit #serials_edit input[name='subscriptionid'][value='7'], #ser_serials-edit #serials_edit input[name='subscriptionid'][value='8'], #ser_serials-edit #serials_edit input[name='subscriptionid'][value='9'], #ser_serials-edit #serials_edit input[name='subscriptionid'][value='127']").parent().find("[name='publisheddatetext']").first().val(todayHuman);
/* copy the values to newly created item - it's done in click event handler just for case the thing are not accurate and you need to change some values before you insert an item */
$("#ser_serials-edit a[id^='label']:not([id$='NEW'])").click(function() {
today = new Date();
todayISO = today.toISOString().substring(0,10);
/* $("#serials_edit [id^='subfield'][id$='p'] input[type='text']").val($("[id^='serialseq']").val());*/
$("#serials_edit [id^='subfield'][id$='x'] input[type='text']").val($("[name='publisheddatetext']").val());
$("#serials_edit [id^='subfield'][id$='d'] input[type='text']").val(todayISO);
$("#serials_edit [id^='subfield'][id$='1'] input[type='text']").first().focus();
});
/* konec predvyplneni formulare v editaci dosleho periodika */
$(document).ready(function() {
/* ... */
var SMSAlertValue = $("input#SMSnumber").val();
$("input#SMSnumber").parent().remove();
$('<li><label for="SMSnumber">SMS číslo:</label><input type="text" id="SMSnumber" name="SMSnumber" value="' + SMSAlertValue + '" class="noEnterSubmit"></li>').insertAfter($("input#phonepro").parent());
$("input#phone").change(function() {
$("input#SMSnumber").val($(this).val().replace(/\s+/g, ''));
});
/*...*/
function indicators_generate() {
for (field in indicators) {
for(ind in indicators[field]) {
$("input[name^='tag_" + field + "_indicator" + ind + "']").each(function () {
$(this).autocomplete({
minLength: 0,
source: indicators[field][ind]
});
$(this).focus(function () {
$(this).autocomplete("search","");
});
$(this).click(function () {
$(this).autocomplete("search","");
});
$(this).css("background-color","#FFFF44");
});
}
}
}
indicators_generate();
$(".buttonPlus").click(indicators_generate);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment