source: SRUAggregator/trunk/src/main/resources/assets/js/main.js @ 6178

Last change on this file since 6178 was 6178, checked in by emanuel.dima@uni-tuebingen.de, 9 years ago

putting back the About and Contact links, css improvements

File size: 23.1 KB
Line 
1/** @jsx React.DOM */
2(function() {
3"use strict";
4
5var VERSION = window.MyAggregator.VERSION = "v.2.0.0-beta-45";
6
7var URLROOT = window.MyAggregator.URLROOT =
8        window.location.pathname.substring(0, window.location.pathname.indexOf("/",2)) ||
9        "/Aggregator";
10
11var PT = React.PropTypes;
12
13var ErrorPane = window.MyReact.ErrorPane;
14var AggregatorPage = window.MyAggregator.AggregatorPage;
15
16/**
17The FCS Aggregator UI is based on reactjs.
18- index.html: describes the general page structure, with a push-down footer;
19  on that structure the Main and Footer components are plugged.
20- main.jsx: defines the simple top components (Main, HelpPage, AboutPage, StatisticsPage)
21- search.jsx: defines
22        - the Corpora store of collections
23        - the AggregatorPage component which deals with search and displays the search results
24- corpora.jsx: defines the CorpusView, rendered when the user views the available collections
25- components.jsx: various general usage React components
26
27The top-most component, Main, tracks of the window's location URL and, depending on the value,
28  renders various components inside its frame:
29        - AggregatorPage is the view corresponding to the normal search UI (search bar and all)
30          This is the most complex component.
31        - HelpPage renders the help page
32        - About renders the about page
33        - Statistics renders the stats page
34        - another URL, /Aggregator/embed, determines Main and AggregatorPage to render just the search bar.
35          The embedded view is supposed to work like a YouTube embedded clip.
36*/
37
38var Main = React.createClass({displayName: 'Main',
39        componentWillMount: function() {
40                routeFromLocation.bind(this)();
41        },
42
43        getInitialState: function () {
44                return {
45                        navbarCollapse: false,
46                        navbarPageFn: this.renderAggregator,
47                        // navbarPageFn: this.renderStatistics,
48                        errorMessages: [],
49                };
50        },
51
52        error: function(errObj) {
53                var err = "";
54                if (typeof errObj === 'string' || errObj instanceof String) {
55                        err = errObj;
56                } else if (typeof errObj === 'object' && errObj.statusText) {
57                        console.log("ERROR: jqXHR = ", errObj);
58                        err = errObj.statusText;
59                } else {
60                        return;
61                }
62
63                var that = this;
64                var errs = this.state.errorMessages.slice();
65                errs.push(err);
66                this.setState({errorMessages: errs});
67
68                setTimeout(function() {
69                        var errs = that.state.errorMessages.slice();
70                        errs.shift();
71                        that.setState({errorMessages: errs});
72                }, 10000);
73        },
74
75        ajax: function(ajaxObject) {
76                var that = this;
77                if (!ajaxObject.error) {
78                        ajaxObject.error = function(jqXHR, textStatus, error) {
79                                if (jqXHR.readyState === 0) {
80                                        that.error("Network error, please check your internet connection");
81                                } else if (jqXHR.responseText) {
82                                        that.error(jqXHR.responseText + " ("+error+")");
83                                } else  {
84                                        that.error(error + " ("+textStatus+")");
85                                }
86                                console.log("ajax error, jqXHR: ", jqXHR);
87                        };
88                }
89                // console.log("ajax", ajaxObject);
90                jQuery.ajax(ajaxObject);
91        },
92
93        toggleCollapse: function() {
94                this.setState({navbarCollapse: !this.state.navbarCollapse});
95        },
96
97        renderAggregator: function() {
98                return React.createElement(AggregatorPage, {ajax: this.ajax, error: this.error});
99        },
100
101        renderHelp: function() {
102                return React.createElement(HelpPage, null);
103        },
104
105        renderAbout: function() {
106                return React.createElement(AboutPage, null);
107        },
108
109        renderStatistics: function() {
110                return React.createElement(StatisticsPage, {ajax: this.ajax});
111        },
112
113        renderEmbedded: function() {
114                return React.createElement(AggregatorPage, {ajax: this.ajax, embedded: true});
115        },
116
117        getPageFns: function() {
118                return {
119                        '': this.renderAggregator,
120                        'help': this.renderHelp,
121                        'about': this.renderAbout,
122                        'stats': this.renderStatistics,
123                        'embed': this.renderEmbedded,
124                };
125        },
126
127        gotoPage: function(doPushHistory, pageFnName) {
128                var pageFn = this.getPageFns()[pageFnName];
129                if (this.state.navbarPageFn !== pageFn) {
130                        if (doPushHistory) {
131                                window.history.pushState({page:pageFnName}, '', URLROOT+"/"+pageFnName);
132                        }
133                        this.setState({navbarPageFn: pageFn});
134                        // console.log("new page: " + document.location + ", name: " + pageFnName);
135                }
136        },
137
138        toAggregator: function(doPushHistory) { this.gotoPage(doPushHistory, ''); },
139        toHelp: function(doPushHistory) { this.gotoPage(doPushHistory, 'help'); },
140        toAbout: function(doPushHistory) { this.gotoPage(doPushHistory, 'about'); },
141        toStatistics: function(doPushHistory) { this.gotoPage(doPushHistory, 'stats'); },
142        toEmbedded: function(doPushHistory) { this.gotoPage(doPushHistory, 'embed'); },
143
144        renderLogin: function() {
145                return false;
146                // return  <li className="unauthenticated">
147                //                      <a href="login" tabIndex="-1"><span className="glyphicon glyphicon-log-in"></span> LOGIN</a>
148                //              </li>;
149        },
150
151        renderCollapsible: function() {
152                var classname = "navbar-collapse collapse " + (this.state.navbarCollapse?"in":"");
153                return (
154                        React.createElement("div", {className: classname}, 
155                                React.createElement("ul", {className: "nav navbar-nav"}, 
156                                        React.createElement("li", {className: this.state.navbarPageFn === this.renderAggregator ? "active":""}, 
157                                                React.createElement("a", {className: "link", tabIndex: "-1", onClick: this.toAggregator.bind(this, true)}, "Aggregator")
158                                        ), 
159                                        React.createElement("li", {className: this.state.navbarPageFn === this.renderHelp ? "active":""}, 
160                                                React.createElement("a", {className: "link", tabIndex: "-1", onClick: this.toHelp.bind(this, true)}, "Help")
161                                        )
162                                ), 
163                                React.createElement("ul", {className: "nav navbar-nav navbar-right"}, 
164                                        React.createElement("li", null, 
165                                                React.createElement("div", {id: "clarinservices", style: {padding:4}})
166                                        )
167                                ), 
168                                React.createElement("ul", {className: "nav navbar-nav navbar-right"}, 
169                                        this.renderLogin()
170                                )
171                        )
172                );
173        },
174
175        renderTop: function() {
176                if (this.state.navbarPageFn === this.renderEmbedded) {
177                        return false;
178                }
179                return  (
180                        React.createElement("div", null, 
181                                React.createElement("div", {className: "navbar navbar-default navbar-static-top", role: "navigation"}, 
182                                        React.createElement("div", {className: "container"}, 
183                                                React.createElement("div", {className: "navbar-header"}, 
184                                                        React.createElement("button", {type: "button", className: "navbar-toggle", onClick: this.toggleCollapse}, 
185                                                                React.createElement("span", {className: "sr-only"}, "Toggle navigation"), 
186                                                                React.createElement("span", {className: "icon-bar"}), 
187                                                                React.createElement("span", {className: "icon-bar"}), 
188                                                                React.createElement("span", {className: "icon-bar"})
189                                                        ), 
190                                                        React.createElement("a", {className: "navbar-brand", href: URLROOT, tabIndex: "-1"}, 
191                                                                React.createElement("img", {width: "28px", height: "28px", src: "img/magglass1.png"}), 
192                                                                React.createElement("header", {className: "inline"}, " Content Search ")
193                                                        )
194                                                ), 
195                                                this.renderCollapsible()
196                                        )
197                                ), 
198
199                                React.createElement(ErrorPane, {errorMessages: this.state.errorMessages})
200
201                        )
202                );
203        },
204
205        render: function() {
206                return  (
207                        React.createElement("div", null, 
208                                React.createElement("div", null, " ",  this.renderTop(), " "), 
209
210                                React.createElement("div", {id: "push"}, 
211                                        React.createElement("div", {className: "container"}, 
212                                                this.state.navbarPageFn()
213                                        ), 
214                                        React.createElement("div", {className: "top-gap"})
215                                )
216                        )
217                );
218        }
219});
220
221
222var StatisticsPage = React.createClass({displayName: 'StatisticsPage',
223        propTypes: {
224                ajax: PT.func.isRequired,
225        },
226
227        getInitialState: function () {
228                return {
229                        stats: {},
230                        activeTab: 0,
231                        // searchStats: {},
232                        // lastScanStats: {},
233                };
234        },
235
236        componentDidMount: function() {
237                this.refreshStats();
238        },
239
240        refreshStats: function() {
241                this.props.ajax({
242                        url: 'rest/statistics',
243                        success: function(json, textStatus, jqXHR) {
244                                this.setState({stats: json});
245                                // console.log("stats:", json);
246                        }.bind(this),
247                });
248        },
249
250        renderWaitTimeSecs: function(t) {
251                var hue = t * 4;
252                if (hue > 120) {
253                        hue = 120;
254                }
255                var a = hue/120;
256                hue = 120 - hue;
257                var shue = "hsla("+hue+",100%,80%,"+a+")";
258                return  React.createElement("span", {className: "badge", style: {backgroundColor:shue, color:"black"}}, 
259                                        t.toFixed(3), "s"
260                                );
261        },
262
263        renderCollections: function(colls) {
264                return  React.createElement("div", {style: {marginLeft:40}}, 
265                                         colls.length === 0 ?
266                                                React.createElement("div", {style: {color:"#a94442"}}, "NO collections found")
267                                                :
268                                                React.createElement("div", null, 
269                                                        colls.length, " root collection(s):", 
270                                                        React.createElement("ul", {className: "list-unstyled", style: {marginLeft:40}}, 
271                                                                 colls.map(function(name, i) { return React.createElement("div", {key: i}, name); }) 
272                                                        )
273                                                )
274                                       
275                                );
276        },
277
278        renderDiagnostic: function(d) {
279                var classes = "inline alert alert-warning " + (d.diagnostic.uri === 'LEGACY' ? "legacy" : "");
280                return  React.createElement("div", {key: d.diagnostic.uri}, 
281                                        React.createElement("div", {className: classes}, 
282                                                React.createElement("div", null, 
283                                                         d.counter <= 1 ? false :
284                                                                React.createElement("div", {className: "inline", style: {margin:"5px 5px 5px 5px"}}, 
285                                                                        React.createElement("span", {className: "badge", style: {backgroundColor:'#ae7241'}}, "x ", d.counter)
286                                                                ), 
287                                                       
288                                                        "Diagnostic: ", d.diagnostic.message, ": ", d.diagnostic.diagnostic
289                                                ), 
290                                                React.createElement("div", null, "Context: ", React.createElement("a", {href: d.context}, d.context))
291                                        )
292                                );
293        },
294
295        renderError: function(e) {
296                var xc = e.exception;
297                return  React.createElement("div", {key: xc.message}, 
298                                        React.createElement("div", {className: "inline alert alert-danger", role: "alert"}, 
299                                                React.createElement("div", null, 
300                                                         e.counter <= 1 ? false :
301                                                                React.createElement("div", {className: "inline", style: {margin:"5px 5px 5px 5px"}}, 
302                                                                        React.createElement("span", {className: "badge", style: {backgroundColor:'#c94442'}}, "x ", e.counter, " ")
303                                                                ), 
304                                                       
305                                                        "Exception: ", xc.message
306                                                ), 
307                                                React.createElement("div", null, "Context: ", React.createElement("a", {href: e.context}, e.context)), 
308                                                 xc.cause ? React.createElement("div", null, "Caused by: ", xc.cause) : false
309                                        )
310                                );
311        },
312
313        renderEndpoint: function(isScan, endpoint) {
314                var stat = endpoint[1];
315                var errors = _.values(stat.errors);
316                var diagnostics = _.values(stat.diagnostics);
317                return React.createElement("div", {style: {marginTop:10}, key: endpoint[0]}, 
318                                        React.createElement("ul", {className: "list-inline list-unstyled", style: {marginBottom:0}}, 
319                                                React.createElement("li", null, 
320                                                         stat.version == "LEGACY" ?
321                                                                React.createElement("span", {style: {color:'#a94442'}}, "legacy ", React.createElement("i", {className: "glyphicon glyphicon-thumbs-down"}), " ")
322                                                                : React.createElement("span", {style: {color:'#3c763d'}}, React.createElement("i", {className: "glyphicon glyphicon-thumbs-up"}), " "), 
323                                                       
324                                                         " "+endpoint[0]
325                                                )
326                                        ), 
327                                        React.createElement("div", {style: {marginLeft:40}}, 
328                                         isScan ?
329                                                React.createElement("div", null, "Max concurrent scan requests:", " ", " ", stat.maxConcurrentRequests, " ") :
330                                                React.createElement("div", null, "Max concurrent search requests:", " ", " ", stat.maxConcurrentRequests, " ")
331                                       
332                                        ), 
333                                        React.createElement("div", {style: {marginLeft:40}}, 
334                                                React.createElement("span", null, stat.numberOfRequests), " request(s)," + ' ' +
335                                                "average:", this.renderWaitTimeSecs(stat.avgExecutionTime), "," + ' ' +
336                                                "max: ", this.renderWaitTimeSecs(stat.maxExecutionTime)
337                                        ), 
338                                         isScan ? this.renderCollections(stat.rootCollections) : false, 
339                                                (errors && errors.length) ?
340                                                React.createElement("div", {className: "inline", style: {marginLeft:40}}, 
341                                                         errors.map(this.renderError) 
342                                                ) : false, 
343                                       
344                                                (diagnostics && diagnostics.length) ?
345                                                React.createElement("div", {className: "inline", style: {marginLeft:40}}, 
346                                                         diagnostics.map(this.renderDiagnostic) 
347                                                ) : false
348                                       
349                                );
350        },
351
352        renderInstitution: function(isScan, inst) {
353                return  React.createElement("div", {style: {marginTop:30}, key: inst[0]}, 
354                                        React.createElement("h4", null, inst[0]), 
355                                        React.createElement("div", {style: {marginLeft:20}}, " ", _.pairs(inst[1]).map(this.renderEndpoint.bind(this, isScan)) )
356                                );
357        },
358
359        renderStatistics: function(stats) {
360                return  React.createElement("div", {className: "container statistics", style: {marginTop:20}}, 
361                                        React.createElement("div", null, 
362                                                React.createElement("div", null, "Start date: ", new Date(stats.date).toLocaleString()), 
363                                                React.createElement("div", null, "Timeout: ", " ", React.createElement("kbd", null, stats.timeout, " seconds"))
364                                        ), 
365                                        React.createElement("div", null, " ",  _.pairs(stats.institutions).map(this.renderInstitution.bind(this, stats.isScan)), " ")
366                                )
367                                 ;
368        },
369
370        setTab: function(idx) {
371                this.setState({activeTab:idx});
372        },
373
374        render: function() {
375                return  (
376                        React.createElement("div", null, 
377                                React.createElement("div", {className: "top-gap"}, 
378                                        React.createElement("h1", null, "Statistics"), 
379                                        React.createElement("p", null), 
380                                        React.createElement("div", {role: "tabpanel"}, 
381                                                React.createElement("ul", {className: "nav nav-tabs", role: "tablist"}, 
382                                                         _.pairs(this.state.stats).map(function(st, idx){
383                                                                        var classname = idx === this.state.activeTab ? "active":"";
384                                                                        return  React.createElement("li", {role: "presentation", className: classname, key: st[0]}, 
385                                                                                                React.createElement("a", {href: "#", role: "tab", onClick: this.setTab.bind(this, idx)}, st[0])
386                                                                                        );
387                                                                }.bind(this))
388                                                       
389                                                ), 
390
391                                                React.createElement("div", {className: "tab-content"}, 
392                                                         _.pairs(this.state.stats).map(function(st, idx){
393                                                                        var classname = idx === this.state.activeTab ? "tab-pane active" : "tab-pane";
394                                                                        return  React.createElement("div", {role: "tabpanel", className: classname, key: st[0]}, 
395                                                                                                this.renderStatistics(st[1])
396                                                                                        );
397                                                                }.bind(this))
398                                                       
399                                                )
400                                        )
401                                )
402                        )
403                        );
404        },
405});
406
407var HelpPage = React.createClass({displayName: 'HelpPage',
408        openHelpDesk: function() {
409                window.open('http://support.clarin-d.de/mail/form.php?queue=Aggregator&lang=en',
410                        '_blank', 'height=560,width=370');
411        },
412
413        render: function() {
414                return  (
415                        React.createElement("div", null, 
416                                React.createElement("div", {className: "top-gap"}, 
417                                        React.createElement("h1", null, "Help"), 
418                                        React.createElement("h3", null, "Performing search in FCS corpora"), 
419                                        React.createElement("p", null, "To perform simple keyword search in all CLARIN-D Federated Content Search centres" + ' ' +
420                                        "and their corpora, go to the search field at the top of the page," + ' ' +
421                                        "enter your query, and click 'search' button or press the 'Enter' key."), 
422
423                                        React.createElement("p", null, "When the search starts, the page will start filling in with the corpora responses." + ' ' +
424                                        "After the entire search process has ended you have the option to download the results" + ' ' +
425                                        "in various formats."
426                                        ), 
427
428                                        React.createElement("p", null, "If you are particularly interested in the results returned by a corpus, you have" + ' ' +
429                                        "the option to focus only on the results of that corpus, by clicking on the 'Watch' button." + ' ' +
430                                        "In this view mode you can also download the results of use the WebLicht processing services" + ' ' +
431                                        "to further analyse the results."), 
432
433
434                                        React.createElement("h3", null, "Adjusting search criteria"), 
435                                        React.createElement("p", null, "The FCS Aggregator makes possible to select specific corpora based on their name" + ' ' +
436                                        "or language and to specify the number of search results (hits) per corpus per page." + ' ' +
437                                        "The user interface controls that allows to change these options are located" + ' ' +
438                                        "right below the search fiels on the main page. The current options are" + ' ' +
439                                        "to filter resources based on their language, to select specific resources, and" + ' ' +
440                                        "to set the maximum number of hits."), 
441
442
443                                        React.createElement("h3", null, "More help"), 
444                                        React.createElement("p", null, "More detailed information on using FCS Aggregator is available at the  ", 
445                                        React.createElement("a", {href: "http://weblicht.sfs.uni-tuebingen.de/weblichtwiki/index.php/FCS_Aggregator"}, 
446                                                "Aggregator wiki page"
447                                        ), "." + ' ' +
448                                        "If you still cannot find an answer to your question," + ' ' +
449                                        "or if want to send a feedback, you can write to Clarin-D helpdesk: "), 
450                                        React.createElement("button", {type: "button", className: "btn btn-default btn-lg", onClick: this.openHelpDesk}, 
451                                                React.createElement("span", {className: "glyphicon glyphicon-question-sign", 'aria-hidden': "true"}), 
452                                                " HelpDesk"
453                                        )
454                                )
455                        )
456                );
457        }
458});
459
460var AboutPage = React.createClass({displayName: 'AboutPage',
461        render: function() {
462                return  React.createElement("div", null, 
463                                        React.createElement("div", {className: "top-gap"}, 
464                                                React.createElement("h1", {style: {padding:15}}, "About"), 
465
466                                                React.createElement("div", {className: "col-md-6"}, 
467                                                React.createElement("h3", null, "Technology"), 
468
469                                                React.createElement("p", null, "The Aggregator uses the following software components:"), 
470
471                                                React.createElement("ul", null, 
472                                                        React.createElement("li", null, 
473                                                                React.createElement("a", {href: "http://dropwizard.io/"}, "Dropwizard"), " ", 
474                                                                "(", React.createElement("a", {href: "http://www.apache.org/licenses/LICENSE-2.0"}, "Apache License 2.0"), ")"
475                                                        ), 
476                                                        React.createElement("li", null, 
477                                                                React.createElement("a", {href: "http://eclipse.org/jetty/"}, "Jetty"), " ", 
478                                                                "(", React.createElement("a", {href: "http://www.apache.org/licenses/LICENSE-2.0"}, "Apache License 2.0"), ")"
479                                                        ), 
480                                                        React.createElement("li", null, 
481                                                                React.createElement("a", {href: "http://jackson.codehaus.org/"}, "Jackson"), " ", 
482                                                                "(", React.createElement("a", {href: "http://www.apache.org/licenses/LICENSE-2.0"}, "Apache License 2.0"), ")"
483                                                        ), 
484                                                        React.createElement("li", null, 
485                                                                React.createElement("a", {href: "https://jersey.java.net/"}, "Jersey"), " ", 
486                                                                "(", React.createElement("a", {href: "https://jersey.java.net/license.html#/cddl"}, "CCDL 1.1"), ")"
487                                                        ), 
488                                                        React.createElement("li", null, 
489                                                                React.createElement("a", {href: "https://github.com/optimaize/language-detector"}, "Optimaize Language Detector"), " ", 
490                                                                "(", React.createElement("a", {href: "http://www.apache.org/licenses/LICENSE-2.0"}, "Apache License 2.0"), ")"
491                                                        ), 
492                                                        React.createElement("li", null, 
493                                                                React.createElement("a", {href: "http://poi.apache.org/"}, "Apache POI"), " ", 
494                                                                "(", React.createElement("a", {href: "http://www.apache.org/licenses/LICENSE-2.0"}, "Apache License 2.0"), ")"
495                                                        )
496                                                ), 
497
498                                                React.createElement("ul", null, 
499                                                        React.createElement("li", null, 
500                                                                React.createElement("a", {href: "http://facebook.github.io/react/"}, "React"), " ", 
501                                                                "(", React.createElement("a", {href: "https://github.com/facebook/react/blob/master/LICENSE"}, "BSD license"), ")"
502                                                        ), 
503                                                        React.createElement("li", null, 
504                                                                React.createElement("a", {href: "http://getbootstrap.com/"}, "Bootstrap"), " ", 
505                                                                "(", React.createElement("a", {href: "http://opensource.org/licenses/mit-license.html"}, "MIT license"), ")"
506                                                        ), 
507                                                        React.createElement("li", null, 
508                                                                React.createElement("a", {href: "http://jquery.com/"}, "jQuery"), " ", 
509                                                                "(", React.createElement("a", {href: "http://opensource.org/licenses/mit-license.html"}, "MIT license"), ")"
510                                                        ), 
511                                                        React.createElement("li", null, 
512                                                                React.createElement("a", {href: "http://glyphicons.com/"}, "GLYPHICONS free"), " ", 
513                                                                "(", React.createElement("a", {href: "https://creativecommons.org/licenses/by/3.0/"}, "CC-BY 3.0"), ")"
514                                                        ), 
515                                                        React.createElement("li", null, 
516                                                                React.createElement("a", {href: "http://fortawesome.github.io/Font-Awesome/"}, "FontAwesome"), " ", 
517                                                                "(", React.createElement("a", {href: "http://opensource.org/licenses/mit-license.html"}, "MIT"), ", ", React.createElement("a", {href: "http://scripts.sil.org/OFL"}, "SIL Open Font License"), ")"
518                                                        )
519                                                ), 
520
521                                                React.createElement("p", null, "The content search icon is made by", 
522                                                        React.createElement("a", {href: "http://www.freepik.com", title: "Freepik"}, " Freepik "), 
523                                                        "from", 
524                                                        React.createElement("a", {href: "http://www.flaticon.com", title: "Flaticon"}, " www.flaticon.com "), 
525                                                        "and licensed under", 
526                                                        React.createElement("a", {href: "http://creativecommons.org/licenses/by/3.0/", title: "Creative Commons BY 3.0"}, " CC BY 3.0 ")
527                                                )
528                                                ), 
529
530                                                React.createElement("div", {className: "col-md-6"}, 
531                                                React.createElement("h3", null, "Statistics"), 
532                                                React.createElement("button", {type: "button", className: "btn btn-default btn-lg", onClick: function() {main.toStatistics(true);}}, 
533                                                        React.createElement("span", {className: "glyphicon glyphicon-cog", 'aria-hidden': "true"}, " "), 
534                                                        "View server log"
535                                                )
536                                                )
537                                        )
538                                );
539        }
540});
541
542var Footer = React.createClass({displayName: 'Footer',
543        toAbout: function(e) {
544                main.toAbout(true);
545                e.preventDefault();
546                e.stopPropagation();
547        },
548
549        render: function() {
550                return (
551                        React.createElement("div", {className: "container", style: {textAlign:'center'}}, 
552                                React.createElement("div", {className: "row"}, 
553                                        React.createElement("div", {style: {position:'relative', float:'left'}}, 
554                                                React.createElement("div", {className: "leftist", style: {position:'absolute'}}, 
555                                                        React.createElement("div", null, 
556                                                                React.createElement("a", {title: "about", href: "about", onClick: this.toAbout}, "About")
557                                                        ), 
558                                                        React.createElement("div", {style: {color:'#777'}}, VERSION)
559                                                )
560                                        ), 
561                                        React.createElement("a", {title: "CLARIN ERIC", href: "https://www.clarin.eu/"}, 
562                                                React.createElement("img", {src: "img/clarindLogo.png", alt: "CLARIN ERIC logo", style: {height:60}})
563                                        ), 
564                                        React.createElement("div", {style: {position:'relative', float:'right'}}, 
565                                                React.createElement("div", {className: "rightist", style: {position:'absolute', right:'0'}}, 
566                                                        React.createElement("a", {title: "contact", href: "mailto:fcs@clarin.eu"}, "Contact")
567                                                )
568                                        )
569                                )
570                        )
571                );
572        }
573});
574
575function isEmbeddedView() {
576        var path = window.location.pathname.split('/');
577        return (path.length >= 3 && path[2] === 'embed');
578}
579
580function endsWith(str, suffix) {
581    return str.indexOf(suffix, str.length - suffix.length) !== -1;
582}
583
584var routeFromLocation = function() {
585        // console.log("routeFromLocation: " + document.location);
586        if (!this) throw "routeFromLocation must be bound to main";
587        var path = window.location.pathname.split('/');
588        if (path.length === 3) {
589                var p = path[2];
590                if (p === 'help') {
591                        this.toHelp(false);
592                } else if (p === 'about') {
593                        this.toAbout(false);
594                } else if (p === 'stats') {
595                        this.toStatistics(false);
596                } else if (p === 'embed') {
597                        this.toEmbedded(false);
598                } else {
599                        this.toAggregator(false);
600                }
601        } else {
602                this.toAggregator(false);
603        }
604};
605
606var main = React.render(React.createElement(Main, null),  document.getElementById('body'));
607if (!isEmbeddedView()) {
608        React.render(React.createElement(Footer, null), document.getElementById('footer') );
609} else if (jQuery) {
610        jQuery("#footer").remove();
611}
612
613window.onpopstate = routeFromLocation.bind(main);
614window.MyAggregator.main = main;
615
616})();
Note: See TracBrowser for help on using the repository browser.