PageSourceSearch

https://www.tohotheater.jp/responsive/js/search/pattern/sakuhin.js?20181015

js tohotheater.jp collected 2026-10-02 02:19:34 UTC 6,650 bytes, 197 lines download raw bytes

1var SearchMovie = {
2    Stored: {
3        JSON1: '',
4        JSON2: ''
5    },
6    init: {
7        movie: '',
8        theater: '',
9        showday: '',
10        time: ''
11    },
12    form: '#sfmSearch',
13    memberStr: '',
14    URL: {
15        // ì•i‚ÆŒ€êƒf[ƒ^Žæ“¾API
16        JSON1: '/net/schedule/TNPI2310J03.do?__useResultInfo__=no&isMember=:member_str&_dc=:unix_time',
17        // ŽžŠÔ‚ƍì•iƒf[ƒ^Žæ“¾API
18        JSON2: '/net/schedule/TNPI2310J04.do?__useResultInfo__=no&isMember=:member_str&para_sakuhin=:para_sakuhin&_dc=:unix_time'
19    },
20    getForm: function() {
21        var form = $(this.form);
22        $.extend(form, SearchFormUtils);
23        return form;
24    },
25    init: function() {
26        var _self = this;
27        return new Promise(function(success, failed) {
28            var form = _self.getForm();
29
30            // ƒƒOƒCƒ“”»’è
31            var login = form.get('login');
32            _self.memberStr = login == '1' ? '_member' : '';
33
34            // ‰Šú’lŽæ“¾
35            _self.init = {
36                movie: form.get('sinitSakuhin'),
37                theater: form.get('sinitGekijyo') != '' ? form.get('sinitGekijyo') : '999',
38                showday: form.get('sinitJyoueibi'),
39                time: form.get('sinitJikan') != '' ? form.get('sinitJikan') : '    '
40            };
41
42            // ì•iEŒ€êƒf[ƒ^‚ÌJSON‚ðƒ[ƒh
43            JSONUtils.loadJSON(_self.URL.JSON1, {member_str: _self.memberStr, unix_time: Math.floor( $.now() / 1000 )})
44            .then(function(res) {
45                // •Û‘¶‚·‚é
46                _self.Stored.JSON1 = res;
47
48                // ì•iˆê——‚̃Rƒ“ƒ{ƒ{ƒbƒNƒX‚̃f[ƒ^‚ð’ljÁ
49                $.each(_self.getMovieList(), function(idx, movie) {
50                    form.addOption('#s_sakuhin', movie.code, movie.name);
51                });
52
53                // ƒCƒxƒ“ƒg‚ðÝ’è
54                $('#s_sakuhin').on('change', function() {
55                    _self.onMovieSelectChanged();
56                });
57
58                $('#s_gekijyo').on('change', function() {
59                    _self.onTheaterSelectChanged();
60                });
61
62                $('#s_jyoueibi').on('change', function() {
63                    _self.onShowdaySelectChanged();
64                });
65
66                // ‰Šú’l‚ª‚ ‚Á‚½‚ç•ύX
67                if(_self.init.movie != '') {
68                    $('#s_sakuhin').val(_self.init.movie);
69                }
70                $('#s_sakuhin').change();
71                success();
72            })
73            .catch(function(err) {
74                failed();
75            });
76        });
77        
78
79    },
80    // ì•iƒRƒ“ƒ{ƒ{ƒbƒNƒX‚̕ύXƒCƒxƒ“ƒg
81    onMovieSelectChanged: function() {
82        //‘I‘ð’l‰Šú‰»
83        $('#s_gekijyo').empty();
84        $('#s_jyoueibi').empty();
85        $('#s_jikan').empty();
86
87        var _self = this;
88        var form = _self.getForm();
89        var moviecd = form.getMMovieCd();
90
91        if(moviecd == undefined) return false;
92        var theaterList = this.getTheaterList(moviecd);
93
94        if(theaterList.length == 0) {
95            $('#s_gekijyo').prop('disabled','disabled');
96        }
97        else {
98            $.each(theaterList, function(idx, theater) {
99                form.addOption('#s_gekijyo', theater.code, theater.name);
100            });
101
102            if(_self.init.theater != '') {
103                $('#s_gekijyo').val(_self.init.theater);
104                _self.init.theater = '';
105            }
106        }
107
108        $('#s_gekijyo').change();
109    },
110   // Œ€êƒRƒ“ƒ{ƒ{ƒbƒNƒX‚̕ύXƒCƒxƒ“ƒg
111    onTheaterSelectChanged: function() {
112        //‘I‘ð’l‰Šú‰»
113        $('#s_jyoueibi').empty();
114        $('#s_jikan').empty();
115
116        var _self = this;
117        var form = _self.getForm();
118        var moviecd = form.getMMovieCd();
119        var theater = form.getMTheaterCd();
120        
121        // JSON2‚ðƒ[ƒh
122        JSONUtils.loadJSON(this.URL.JSON2, {member_str: _self.memberStr, para_sakuhin: moviecd, unix_time: Math.floor( $.now() / 1000 )})
123            .then(function(res) {
124                _self.Stored.JSON2 = res;
125
126                var showdayList = _self.getShowdayList(theater);
127
128                if(showdayList.length == 0) {
129                    $('#s_jyoueibi').prop('disabled','disabled');
130                }
131                else {
132                    $.each(showdayList, function(idx, showday) {
133                        form.addOption('#s_jyoueibi', showday.code, showday.name);
134                    });
135                    if(_self.init.showday != '') {
136                        $('#s_jyoueibi').val(_self.init.showday);
137                        _self.init.showday = '';
138                    }
139                }
140
141                $('#s_jyoueibi').change();
142            });
143    },
144    // ã‰f“úƒRƒ“ƒ{ƒ{ƒbƒNƒX‚̕ύXƒCƒxƒ“ƒg
145    onShowdaySelectChanged: function() {
146        //‘I‘ð’l‰Šú‰»
147        $('#s_jikan').empty();
148
149        var _self = this;
150        var form = _self.getForm();
151        var theater = form.getMTheaterCd();
152        var showday = form.getMShowday();
153        var timeList = _self.getTimeList(theater, showday);
154
155        if(timeList.length == 0) {
156            $('#s_jikan').prop('disabled','disabled');
157        }
158        else {
159            $.each(timeList, function(idx, time) {
160                form.addOption('#s_jikan', time.code, time.name);
161            });
162
163            if(_self.init.time != '') {
164                $('#s_jikan').val(_self.init.time);
165                _self.init.time = '';
166            }
167        }
168    },
169    // ŒŸõŽÀs
170    submit: function() {
171        var form = this.getForm();
172        var moviecd = form.getMMovieCd();
173        if(moviecd == undefined || moviecd.trim() == '' || moviecd == '0') return false;
174        form.find('input[name=search_kbn]').val(1);
175        form.submit();
176    },
177    getMovieList: function() {
178        var movieList = [];
179        if(this.Stored.JSON1 == '') return movieList;
180        return this.Stored.JSON1.sakuhin;
181    },
182    getTheaterList: function(moviecd) {
183        var theaterList = [];
184        if(this.Stored.JSON1 == '') return theaterList;
185        return this.Stored.JSON1['A'+moviecd];
186    },
187    getShowdayList: function(theatercd) {
188        var showdayList = [];
189        if(this.Stored.JSON2 == '') return showdayList;
190        return this.Stored.JSON2['A'+theatercd].date;
191    },
192    getTimeList: function(theatercd, showday) {
193        var timeList = [];
194        if(this.Stored.JSON2 == '') return timeList;
195        return this.Stored.JSON2['A'+theatercd]['A'+showday];
196    }
197}

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.