PageSourceSearch

https://occtonet3.occto.or.jp/public/dfw/RP11/OCCTO/sdCommon/jsp/js/sdPanelSwitcher.js

js occto.or.jp collected 2026-10-02 04:39:04 UTC 3,141 bytes, 139 lines download raw bytes

1(function($){
2	$.widget( "sd.sdSwitchingPanel", {
3		options: {
4			hide: null,
5			show: null
6		},
7		_create: function() {
8			this.element.addClass('switchingPanel');
9			this.element.attr('display','none');
10		},
11		_destroy:function() {
12			this.element.removeClass('switchingPanel');
13			this.element.removAttr('display');
14		},
15		show: function(callback) {
16			try {
17				$(this.element).show(
18						{
19							effect: this.options.show,
20							complete: callback
21						}
22				);
23			} catch (e) {}
24		},
25		hide: function() {
26			try {
27				$(this.element).hide(this.options.hide);
28			} catch (e) {}
29		}
30
31	});
32
33	$.widget( "sd.sdPanelSwitcher", {
34		// optionのデフォルト
35		options: {
36			active: 0,
37			collapsible: false,
38			heightStyle: "content",
39			panelElement:"div",
40			hide:null,
41			show:null,
42			panelHide: {
43				effect: "slide",
44				duration: 300,
45				direction: "left"
46			},
47			panelShow: {
48				effect: "slide",
49				duration: 300,
50				direction: "left"
51			},
52
53			// callbacks
54			beforeActivate: null,
55			activate: null,
56			afterActivate: null,
57			beforeLoad: null,
58			load: null
59		},
60
61		panles:new Array(),
62		panelIndex:-1,
63		activePanel:null,
64		newPanel: null,
65		oldPanel: null,
66
67		_create: function() {
68			this.element.addClass('panelSwitcher');
69			this._refreshPanels();
70			this.active(this.options.active);
71		},
72		_getPanels:function() {
73			return $(this.element).children(this.options.panelElement);
74		},
75		_removePanels:function() {
76			var pnls = this.panles;
77			for (var i = 0; i < pnls.length; i++) {
78				var panel = pnls[i];
79				$(panel).sdSwitchingPanel('destroy');
80			}
81			this.panles = new Array();
82		},
83		_refreshPanels:function() {
84			this._removePanels();
85			var pnls = this._getPanels();
86			for (var i = 0; i < pnls.length; i++) {
87				this.panles.push($(pnls[i]).sdSwitchingPanel(
88						{
89							hide:this.options.panelHide,
90							show:this.options.panelShow
91						}
92					));
93			}
94		},
95
96		_destroy:function() {
97			this.element.removeClass('panelSwitcher');
98			this._removePanels();
99		},
100		active:function(index) {
101			var pnlindex = Number(index);
102			if (pnlindex === NaN) {
103				throw new Error('データ型が不適切です');
104			}
105
106			if (pnlindex < 0 || pnlindex >= this.panles.length) {
107				throw new Error('範囲外の添字です');
108			}
109
110			if (this.panles.length == 0) {
111				this.panelIndex = -1;
112				this.activePanel = null;
113				return this;
114			}
115
116			if (pnlindex != this.panelIndex) {
117				if (this.activePanel != null) {
118					this.oldPanel = this.activePanel;
119					$(this.activePanel).sdSwitchingPanel('hide');
120				}
121				this.panelIndex = pnlindex;
122				this.activePanel = this.panles[pnlindex];
123
124				this.newPanel = this.activePanel;
125				var eventData = {
126						oldPanel: this.oldPanel,
127						newPanel: this.newPanel
128					};
129				var thisDummy = this;
130
131				$(this.activePanel).sdSwitchingPanel('show', function(){
132					thisDummy._trigger('afterActivate', eventData, thisDummy);
133				});
134				this._trigger('activate', eventData, this);
135			}
136			return this;
137		}
138	});
139})(jQuery);

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.