PageSourceSearch

https://www.rs-r.co.jp/libs/jAccord.js

js rs-r.co.jp collected 2026-09-24 19:26:56 UTC 2,037 bytes, 92 lines download raw bytes

1
2Function.prototype.bind = function(object) {
3  var __method = this;
4  return function() {
5    return __method.apply(object, arguments);
6  }
7}
8
9Function.prototype.asynchronize = function() {
10  var f = this;
11  return function() {
12    var resultcb = function() {};
13    var failcb = function(e) { throw e };
14    if (typeof arguments[arguments.length - 1] == 'function') {
15      resultcb = Array.prototype.pop.apply(arguments);
16      if (typeof arguments[arguments.length - 1] == 'function') {
17        failcb = Array.prototype.pop.apply(arguments);
18      }
19    }
20    try {
21      var result = f.apply(this, arguments);
22      setTimeout(function() { resultcb(result) }, 0);
23    }
24    catch (e) {
25      setTimeout(function() { failcb(e) }, 0);
26    }
27  };
28};
29
30var jAccord = function(togglers, elements, options, callback) {
31	var fn ;
32	var ja = this ;
33	this.callback = '' ;
34	this.callback = callback ;
35	jAccord.prototype.el = elements ;
36	jAccord.prototype.tog = togglers ;
37	jAccord.prototype.opt = options ;
38	fn = this.initialize.bind(this) ;
39	fn.asynchronize()(function(ret) {
40		if (ret == 'done' && ja.callback != null) {
41			ja.callback() ;
42		}
43	}) ;
44}
45
46jAccord.prototype = {
47	
48	initialize: function() {
49		var ja = this ;
50		
51		this.now = [] ;
52		this.h = [] ;
53		
54		this.tog.each(function(i) {
55			$(this).click(function() {
56				ja.showThisHideOpen(i) ;
57			}) ;
58			ja.h[i] = $(ja.el[i]).height() ;
59			ja.hideThis(i) ;
60		}) ;
61		return 'done' ;
62	},
63	
64	hideThis: function(i) {
65		this.now[i] = 0 ;
66		$(this.el[i]).slideUp(this.opt,
67			function(i) {
68//				$(this).height(0) ;
69			}) ;
70	},
71	
72	showThis: function(i) {
73		var test ;
74		this.now[i] = 1 ;
75		$(this.el[i]).slideDown(this.opt,
76			function() {
77				test = $(this).height() ;
78//				alert($(this).height()) ;
79			}) ;
80		
81	},
82	
83	showThisHideOpen: function(iToShow) {
84		var ja = this ;
85		$(this.el).each(function(i) {
86			if (ja.now[i] == 1) {
87				ja.hideThis(i) ;
88			}
89		}) ;
90		this.showThis(iToShow) ;
91	}
92} ;

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.