PageSourceSearch

https://cdn.vrphub.com/wp-content/themes/Newspaper/js/jquery.shorten.1.0.js

js vrphub.com collected 2026-09-29 23:31:24 UTC 1,434 bytes, 61 lines download raw bytes

1/*
2 * jQuery Shorten plugin 1.0.0
3 *
4 * Copyright (c) 2013 Viral Patel
5 * //viralpatel.net
6 *
7 * Dual licensed under the MIT license:
8 *   //www.opensource.org/licenses/mit-license.php
9 */
10
11 (function($) {
12	$.fn.shorten = function (settings) {
13	
14		var config = {
15			showChars: 100,
16			ellipsesText: "...",
17			moreText: "more",
18			lessText: "less"
19		};
20
21		if (settings) {
22			$.extend(config, settings);
23		}
24		
25		$(document).off("click", '.morelink');
26		
27		$(document).on({click: function () {
28
29				var $this = $(this);
30				if ($this.hasClass('less')) {
31					$this.removeClass('less');
32					$this.html(config.moreText);
33				} else {
34					$this.addClass('less');
35					$this.html(config.lessText);
36				}
37				$this.parent().prev().toggle();
38				$this.prev().toggle();
39				return false;
40			}
41		}, '.morelink');
42
43		return this.each(function () {
44			var $this = $(this);
45			if($this.hasClass("shortened")) return;
46			
47			$this.addClass("shortened");
48			var content = $this.html();
49			if (content.length > config.showChars) {
50				var c = content.substr(0, config.showChars);
51				var h = content.substr(config.showChars, content.length - config.showChars);
52				var html = c + '<span class="moreellipses">' + config.ellipsesText + ' </span><span class="morecontent"><span>' + h + '</span> <a href="#" class="morelink">' + config.moreText + '</a></span>';
53				$this.html(html);
54				$(".morecontent span").hide();
55			}
56		});
57		
58	};
59
60 })(jQuery);
61

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.