/usr/share/javascript/jquery-slugify/slugify.js is in libjs-jquery-slugify 1.2.5~dfsg1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | /*! jquery-slugify - v1.2.5 - 2017-10-06
* Copyright (c) 2017 madflow; Licensed */
(function($) {
$.fn.slugify = function(source, options) {
return this.each(function() {
var $target = $(this),
$source = $(source);
$target.on('keyup change', function() {
if ($target.val() !== '' && $target.val() !== undefined) {
$target.data('locked', true);
} else {
$target.data('locked', false);
}
});
$source.on('keyup change', function() {
// If the target is empty - it cannot be locked
if ($target.val() === '' || $target.val() === undefined) {
$target.data('locked', false);
}
if (true === $target.data('locked')) {
return;
}
if ($target.is('input') || $target.is('textarea')) {
$target.val($.slugify($source.val(), options));
} else {
$target.text($.slugify($source.val(), options));
}
});
});
};
// Static method.
$.slugify = function(sourceString, options) {
// Override default options with passed-in options.
options = $.extend({}, $.slugify.options, options);
// Guess language specifics from html.lang attribute
// when options.lang is not defined
options.lang = options.lang || $('html').prop('lang');
// Apply preSlug function - if exists
if (typeof options.preSlug === 'function') {
sourceString = options.preSlug(sourceString);
}
sourceString = options.slugFunc(sourceString, options);
// Apply postSlug function - if exists
if (typeof options.postSlug === 'function') {
sourceString = options.postSlug(sourceString);
}
return sourceString;
};
// Default plugin options
$.slugify.options = {
preSlug: null,
postSlug: null,
slugFunc: function(input, opts) {
return window.getSlug(input, opts);
}
};
})(jQuery);
|