fix #1282 move to fess-site-search
This commit is contained in:
parent
99f0227b06
commit
5d70d664f0
19 changed files with 0 additions and 7466 deletions
|
@ -1,2 +0,0 @@
|
|||
node_modules
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
npm install --save-dev webpack
|
||||
npm install --save-dev babel-core babel-loader babel-preset-es2015 babel-preset-stage-0 babel-polyfill
|
||||
npm install --save-dev css-loader style-loader sass-loader node-sass extract-text-webpack-plugin
|
||||
npm install --save-dev jquery
|
||||
npm install --save-dev handlebars handlebars-loader
|
||||
|
||||
webpack
|
||||
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
<html lang="ja">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
</head>
|
||||
|
||||
<script>
|
||||
(function() {
|
||||
var fess = document.createElement('script');
|
||||
fess.type = 'text/javascript';
|
||||
fess.async = true;
|
||||
fess.src = '//localhost:8080/js/ss/fess-ss.min.js';
|
||||
fess.charset = 'utf-8';
|
||||
fess.setAttribute('id', 'fess-ss');
|
||||
fess.setAttribute('fess-search-page-path', 'result.html');
|
||||
//fess.setAttribute('request-headers', '{"Authorization":"bbb"}');
|
||||
fess.setAttribute('fess-url', '//localhost:8080/json');
|
||||
var s = document.getElementsByTagName('script')[0];
|
||||
s.parentNode.insertBefore(fess, s);
|
||||
})();
|
||||
</script>
|
||||
|
||||
<fess:search-form-only></fess:search-form-only>
|
||||
</html>
|
|
@ -1,30 +0,0 @@
|
|||
{
|
||||
"name": "webpack-fess-ss",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"devDependencies": {
|
||||
"babel-core": "^6.25.0",
|
||||
"babel-loader": "^7.1.1",
|
||||
"babel-polyfill": "^6.23.0",
|
||||
"babel-preset-es2015": "^6.24.1",
|
||||
"babel-preset-stage-0": "^6.24.1",
|
||||
"css-loader": "^0.28.4",
|
||||
"extract-text-webpack-plugin": "^2.1.2",
|
||||
"handlebars": "^4.0.10",
|
||||
"handlebars-loader": "^1.5.0",
|
||||
"jquery": "^3.2.1",
|
||||
"node-sass": "^4.5.3",
|
||||
"sass-loader": "^6.0.6",
|
||||
"style-loader": "^0.18.2",
|
||||
"webpack": "^2.7.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"handlebars-loader": "^1.5.0"
|
||||
}
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
<html lang="ja">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
</head>
|
||||
|
||||
<script>
|
||||
(function() {
|
||||
var fess = document.createElement('script');
|
||||
fess.type = 'text/javascript';
|
||||
fess.async = true;
|
||||
fess.src = '//localhost:8080/js/ss/fess-ss.min.js';
|
||||
fess.charset = 'utf-8';
|
||||
fess.setAttribute('id', 'fess-ss');
|
||||
fess.setAttribute('fess-url', 'http://localhost/json');
|
||||
fess.setAttribute('fess-search-page-path', 'result.html');
|
||||
var s = document.getElementsByTagName('script')[0];
|
||||
s.parentNode.insertBefore(fess, s);
|
||||
})();
|
||||
</script>
|
||||
|
||||
<fess:search-form-only></fess:search-form-only>
|
||||
<fess:search-result-only></fess:search-result-only>
|
||||
</html>
|
|
@ -1,119 +0,0 @@
|
|||
import FessJQuery from 'jquery';
|
||||
|
||||
export default class {
|
||||
constructor(FessView, FessModel) {
|
||||
this.FessView = FessView;
|
||||
this.FessModel = FessModel;
|
||||
this.fessUrl = FessJQuery('script#fess-ss').attr('fess-url');
|
||||
this.fessContextPath = this.fessUrl.slice(0, this.fessUrl.indexOf('/json'));
|
||||
this.searchPagePath = FessJQuery('script#fess-ss').attr('fess-search-page-path');
|
||||
this.urlParams = function() {
|
||||
var params = {};
|
||||
var array = location.search.replace(/\?/g, '').split('&');
|
||||
array.forEach(function(param){
|
||||
var tpl = param.split('=');
|
||||
if (tpl.length == 1) {
|
||||
params[decodeURIComponent(tpl[0])] = '';
|
||||
} else if (tpl.length == 2) {
|
||||
params[decodeURIComponent(tpl[0])] = decodeURIComponent(tpl[1].replace(/\+/g, ' '));
|
||||
}
|
||||
})
|
||||
return params;
|
||||
}();
|
||||
}
|
||||
|
||||
start() {
|
||||
this.FessView.init();
|
||||
this.FessView.renderForm(this.searchPagePath, this.urlParams);
|
||||
this._bindForm();
|
||||
if (this.urlParams.q !== undefined) {
|
||||
if (FessJQuery('.fessWrapper .fessForm form input').length > 0) {
|
||||
FessJQuery('.fessWrapper .fessForm form input').val(this.urlParams.q);
|
||||
}
|
||||
if (FessJQuery('.fessWrapper .fessFormOnly form input').length > 0) {
|
||||
FessJQuery('.fessWrapper .fessFormOnly form input').val(this.urlParams.q);
|
||||
}
|
||||
try {
|
||||
this._search({q: this.urlParams.q});
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_bindForm() {
|
||||
var $cls = this;
|
||||
FessJQuery('.fessWrapper .fessForm form').submit(function(){
|
||||
try {
|
||||
var keyword = FessJQuery('#contentQuery', this).val();
|
||||
FessJQuery('.fessWrapper #contentQuery').val(keyword);
|
||||
$cls._search({});
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
_bindPagination(response) {
|
||||
var $cls = this;
|
||||
FessJQuery('.fessWrapper .pagination li').click(function(){
|
||||
var $this = FessJQuery(this);
|
||||
if ($this.hasClass('disabled')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var off = $this.parents('.fessResult').offset();
|
||||
FessJQuery(window).scrollTop(off.top);
|
||||
|
||||
var page = $this.attr('page');
|
||||
var params = {};
|
||||
params.start = response.page_size * (page - 1);
|
||||
$cls._search(params);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
_search(params) {
|
||||
var $fessResult = FessJQuery('.fessWrapper .fessResult');
|
||||
$fessResult.css('display', 'none');
|
||||
|
||||
if (params.q === undefined) {
|
||||
var keyword = '';
|
||||
if (FessJQuery('.fessWrapper .fessForm').length > 0) {
|
||||
keyword = FessJQuery('.fessWrapper .fessForm #contentQuery').val();
|
||||
} else if(FessJQuery('.fessWrapper .fessFormOnly').length > 0) {
|
||||
keyword = FessJQuery('.fessWrapper .fessFormOnly #contentQuery').val();
|
||||
}
|
||||
if (keyword.length > 0) {
|
||||
params.q = keyword;
|
||||
} else {
|
||||
params.q = '*:*';
|
||||
}
|
||||
}
|
||||
|
||||
var sort = FessJQuery(".fessWrapper select.sort").val();
|
||||
if (sort !== undefined) {
|
||||
params.sort = sort;
|
||||
} else {
|
||||
params.sort = 'score.desc';
|
||||
}
|
||||
|
||||
var $cls = this;
|
||||
this.FessModel.search(this.fessUrl, params).then(function(data){
|
||||
var response = data.response;
|
||||
if (response.record_count > 0) {
|
||||
$cls.FessView.renderResult($cls.fessContextPath, data.response, params);
|
||||
$fessResult.css('display', 'block');
|
||||
$cls._bindPagination(data.response);
|
||||
} else {
|
||||
$cls.FessView.renderNoResult(data.response, params);
|
||||
$fessResult.css('display', 'block');
|
||||
}
|
||||
}, function(data) {
|
||||
console.log("search error: " + JSON.stringify(data));
|
||||
$cls.FessView.renderNoResult(data.response, params);
|
||||
$fessResult.css('display', 'block');
|
||||
});
|
||||
}
|
||||
}
|
|
@ -1,96 +0,0 @@
|
|||
|
||||
.fessWrapper {
|
||||
margin: 0px;
|
||||
padding: 0px 10px;
|
||||
.fessResult {
|
||||
padding: 10px 0px;
|
||||
}
|
||||
.form-control.sort {
|
||||
display: inline;
|
||||
width: 50%;
|
||||
}
|
||||
/* Large desktop */
|
||||
@media ( min-width : 74.9em) {
|
||||
.order-box {
|
||||
width: 20%
|
||||
}
|
||||
.description {
|
||||
font-size: medium;
|
||||
}
|
||||
.title {
|
||||
line-height: 32px;
|
||||
font-size: 18px;
|
||||
}
|
||||
.site {
|
||||
font-size: medium;
|
||||
}
|
||||
}
|
||||
/* Large devices (desktops, less than 75em) */
|
||||
@media ( max-width : 74.9em) {
|
||||
.order-box {
|
||||
width: 20%
|
||||
}
|
||||
.description {
|
||||
font-size: medium;
|
||||
}
|
||||
.title {
|
||||
line-height: 32px;
|
||||
font-size: 18px;
|
||||
}
|
||||
.site {
|
||||
font-size: medium;
|
||||
}
|
||||
}
|
||||
|
||||
/* Medium devices (tablets, less than 62em) */
|
||||
@media ( max-width : 61.9em) {
|
||||
.order-box {
|
||||
width: 20%
|
||||
}
|
||||
.description {
|
||||
font-size: medium;
|
||||
}
|
||||
.title {
|
||||
line-height: 32px;
|
||||
font-size: 18px;
|
||||
}
|
||||
.site {
|
||||
font-size: medium;
|
||||
}
|
||||
}
|
||||
|
||||
/* Small devices (landscape phones, less than 48em) */
|
||||
@media ( max-width : 47.9em) {
|
||||
.order-box {
|
||||
width: 50%
|
||||
}
|
||||
.description {
|
||||
font-size: small;
|
||||
}
|
||||
.title {
|
||||
line-height: 24px;
|
||||
font-size: 15px;
|
||||
}
|
||||
.site {
|
||||
font-size: small;
|
||||
}
|
||||
}
|
||||
|
||||
/* Extra small devices (portrait phones, less than 34em) */
|
||||
@media ( max-width : 360px) {
|
||||
.order-box {
|
||||
width: 50%
|
||||
}
|
||||
.description {
|
||||
font-size: small;
|
||||
}
|
||||
.title {
|
||||
line-height: 24px;
|
||||
font-size: 15px;
|
||||
}
|
||||
.site {
|
||||
font-size: small;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -1,384 +0,0 @@
|
|||
/* Override some defaults */
|
||||
|
||||
.fessWrapper {
|
||||
position: relative;
|
||||
padding-top: 70px;
|
||||
margin-bottom: 4em;
|
||||
|
||||
footer {
|
||||
width: 100%;
|
||||
bottom: 0;
|
||||
left: 0; height : 4em;
|
||||
position: absolute;
|
||||
border-top: 1px solid;
|
||||
padding-top: 1em;
|
||||
height: 4em;
|
||||
}
|
||||
|
||||
.content {
|
||||
min-height: 100%;
|
||||
}
|
||||
|
||||
h1, h2, h3 {
|
||||
line-height: 32px;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 30px;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.btn-ghost {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.btn-ghost.btn-default {
|
||||
color: #777;
|
||||
}
|
||||
|
||||
.btn-ghost.btn-primary {
|
||||
color: #337ab7;
|
||||
}
|
||||
|
||||
.btn-ghost.btn-success {
|
||||
color: #5cb85c;
|
||||
}
|
||||
|
||||
.btn-ghost.btn-info {
|
||||
color: #5bc0de;
|
||||
}
|
||||
|
||||
.btn-ghost.btn-warning {
|
||||
color: #f0ad4e;
|
||||
}
|
||||
|
||||
.btn-ghost.btn-danger {
|
||||
color: #d9534f;
|
||||
}
|
||||
|
||||
.btn-ghost.btn-primary:hover, .btn-ghost.btn-success:hover, .btn-ghost.btn-info:hover,
|
||||
.btn-ghost.btn-warning:hover, .btn-ghost.btn-danger:hover {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.btn-ghost.btn-white {
|
||||
color: #fff;
|
||||
border: 1px solid #fff;
|
||||
}
|
||||
|
||||
.btn-ghost.btn-white:hover {
|
||||
color: #333;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.navbar .search-box {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.nav-list li.reset {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.center {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.modal-open {
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
h1.mainLogo {
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
#result ol {
|
||||
list-style: none;
|
||||
padding-left: 0;
|
||||
}
|
||||
|
||||
#result ol li {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
#result .title a:visited {
|
||||
color: #014c8c;
|
||||
}
|
||||
|
||||
#result .body cite {
|
||||
color: #093;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
#result .body a.cache {
|
||||
color: #093;
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
#result .favorited {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.searchFormBox {
|
||||
text-align: center;
|
||||
margin-top: 160px;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.form-stacked {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
#contentOptionButton {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.searchButtonBox {
|
||||
margin-top: 15px;
|
||||
}
|
||||
|
||||
#searchOptions {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.move-to-top {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.ellipsis {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
-webkit-text-overflow: ellipsis;
|
||||
-o-text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.searchResultForm {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.username {
|
||||
margin-left: 2.0rem;
|
||||
margin-right: 1.0rem;
|
||||
}
|
||||
|
||||
button>i, a>i {
|
||||
margin-right: 0.2em;
|
||||
}
|
||||
|
||||
nav.navbar .form-inline {
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
#searchOptionsButton {
|
||||
padding-left: 1.0rem;
|
||||
padding-right: 0.8rem;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
ul.searchOptionLabels {
|
||||
list-style-type: none;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
ul.searchOptionLabels li {
|
||||
display: inline-block;
|
||||
margin-right: 10px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
#searchOptions {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
#searchOptions .container {
|
||||
width: 500px;
|
||||
overflow: hidden;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
right: -500px;
|
||||
padding-top: 72px;
|
||||
padding-bottom: 20px;
|
||||
color: #fff;
|
||||
background-color: rgba(60, 60, 60, 0.93);
|
||||
transition: all .4s ease 0s;
|
||||
}
|
||||
|
||||
#searchOptions.active .container {
|
||||
height: auto;
|
||||
overflow-y: auto;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
}
|
||||
|
||||
.centered {
|
||||
float: none;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
#contentQuery {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.navbar-brand img {
|
||||
padding-top: 4px;
|
||||
}
|
||||
|
||||
.form-control {
|
||||
border-radius: 0px;
|
||||
}
|
||||
|
||||
:first-child.list-group-item {
|
||||
border-radius: 0px;
|
||||
}
|
||||
|
||||
:last-child.list-group-item {
|
||||
border-radius: 0px;
|
||||
}
|
||||
|
||||
.thumbnail {
|
||||
background-position: 50% 50%;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
/* Large desktop */
|
||||
@media ( min-width : 74.9em) {
|
||||
.visible-xs {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
/* Large devices (desktops, less than 75em) */
|
||||
@media ( max-width : 74.9em) {
|
||||
.visible-xs {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
/* Medium devices (tablets, less than 62em) */
|
||||
@media ( max-width : 61.9em) {
|
||||
.visible-xs {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
/* Small devices (landscape phones, less than 48em) */
|
||||
@media ( max-width : 47.9em) {
|
||||
.br-xs {
|
||||
display: block;
|
||||
}
|
||||
.hidden-xs {
|
||||
display: none !important;
|
||||
}
|
||||
.mainLogo img {
|
||||
width: 200px;
|
||||
}
|
||||
.navbar-brand img {
|
||||
width: 80px;
|
||||
padding-top: 6.5px;
|
||||
}
|
||||
.searchFormBox {
|
||||
margin-top: 20px;
|
||||
}
|
||||
#result ol {
|
||||
margin-left: 0;
|
||||
}
|
||||
#result .info {
|
||||
display: none;
|
||||
}
|
||||
#searchOptions .container {
|
||||
width: 100%;
|
||||
right: -100%;
|
||||
}
|
||||
#searchOptions.active {
|
||||
right: 0;
|
||||
}
|
||||
.description {
|
||||
-moz-box-orient: vertical;
|
||||
-ms-box-orient: vertical;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 3;
|
||||
display: -webkit-box;
|
||||
overflow: hidden !important;
|
||||
}
|
||||
}
|
||||
|
||||
/* Extra small devices (portrait phones, less than 34em) */
|
||||
@media ( max-width : 360px) {
|
||||
.br-xs {
|
||||
display: block;
|
||||
}
|
||||
.hidden-xs {
|
||||
display: none !important;
|
||||
}
|
||||
.mainLogo img {
|
||||
width: 200px;
|
||||
}
|
||||
.navbar-brand img {
|
||||
width: 80px;
|
||||
padding-top: 6.5px;
|
||||
}
|
||||
.searchFormBox {
|
||||
margin-top: 80px;
|
||||
}
|
||||
#result .info {
|
||||
display: none;
|
||||
}
|
||||
#subheader {
|
||||
font-size: 90%;
|
||||
}
|
||||
#searchButton {
|
||||
padding-left: 0.8rem;
|
||||
padding-right: 0.8rem;
|
||||
}
|
||||
#searchOptionsButton {
|
||||
padding-left: 0.7rem;
|
||||
padding-right: 0.6rem;
|
||||
}
|
||||
#footer {
|
||||
font-size: 65%;
|
||||
}
|
||||
.description {
|
||||
-moz-box-orient: vertical;
|
||||
-ms-box-orient: vertical;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 3;
|
||||
display: -webkit-box;
|
||||
overflow: hidden !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media ( max-width : 767px) and (min-width: 481px) {
|
||||
}
|
||||
|
||||
@media ( max-height : 480px) {
|
||||
#searchOptions .container {
|
||||
max-height: 450px;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
}
|
||||
|
||||
@media ( max-height : 390px) {
|
||||
#searchOptions .container {
|
||||
max-height: 300px;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
}
|
||||
|
||||
/***workaround for IE browser***/
|
||||
@media screen and (min-width:0\0) {
|
||||
input#query.form-control {
|
||||
padding-bottom: 0.75rem;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,71 +0,0 @@
|
|||
export default class {
|
||||
constructor() {
|
||||
this.messages = {
|
||||
en: {
|
||||
'form.search.button': 'Search',
|
||||
'form.input.placeholder': '',
|
||||
'result.number': 'results',
|
||||
'result.second': 'second',
|
||||
'result.order': 'Order',
|
||||
'result.order.score': 'Relevance',
|
||||
'result.order.last_modified': 'Last modified',
|
||||
'result.pagination.prev': 'prev',
|
||||
'result.pagination.next': 'next',
|
||||
'result.did_not_match': 'Your search - <b>{{q}}</b> - did not match any documents.'
|
||||
},
|
||||
ja: {
|
||||
'form.search.button': '検索',
|
||||
'form.input.placeholder': '',
|
||||
'result.number': '件',
|
||||
'result.second': '秒',
|
||||
'result.order': '表示順',
|
||||
'result.order.score': '関連度',
|
||||
'result.order.last_modified': '更新日時',
|
||||
'result.pagination.prev': '前へ',
|
||||
'result.pagination.next': '次へ',
|
||||
'result.did_not_match': '<b>{{q}}</b>に一致する情報は見つかりませんでした。'
|
||||
}
|
||||
}
|
||||
}
|
||||
getLanguage() {
|
||||
var lang = window.navigator.userLanguage || window.navigator.language || window.navigator.browserLanguage || 'en';
|
||||
if (lang.indexOf('-') > 0) {
|
||||
lang = lang.substr(0, lang.indexOf('-'));
|
||||
}
|
||||
return lang;
|
||||
}
|
||||
getMessage(key, vars) {
|
||||
var language = this.getLanguage();
|
||||
if (this.messages[language] === undefined) {
|
||||
language = 'en';
|
||||
}
|
||||
var message = this.messages[language][key];
|
||||
if (message === undefined) {
|
||||
console.log('Invalid message key:' + key);
|
||||
return '';
|
||||
}
|
||||
|
||||
for (var key in vars) {
|
||||
if (typeof vars[key] == 'string' || typeof vars == 'string') {
|
||||
var reg = new RegExp('{{' + key + '}}', 'g');
|
||||
message = message.replace(reg, vars[key]);
|
||||
}
|
||||
}
|
||||
//var reg = new RegExp('{{[^{}]*}}', 'g');
|
||||
//message = message.replace(reg, '');
|
||||
return message;
|
||||
}
|
||||
render(html, vars) {
|
||||
var language = this.getLanguage();
|
||||
if (this.messages[language] === undefined) {
|
||||
language = 'en';
|
||||
}
|
||||
var tmpHtml = html;
|
||||
var messages = this.messages[language];
|
||||
for(var key in messages) {
|
||||
var reg = new RegExp('{' + key + '}', 'g');
|
||||
tmpHtml = tmpHtml.replace(reg, this.getMessage(key, vars));
|
||||
}
|
||||
return tmpHtml;
|
||||
}
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
import 'babel-polyfill';
|
||||
import '!style-loader!css-loader!sass-loader!./css/style-base.scss';
|
||||
import '!style-loader!css-loader!sass-loader!./css/style.scss';
|
||||
import '!style-loader!css-loader!sass-loader!./css/ss.scss';
|
||||
import FessMessages from './fess-messages.js';
|
||||
import FessView from './view.js';
|
||||
import FessController from './controller.js';
|
||||
import FessModel from './model.js';
|
||||
|
||||
(function() {
|
||||
var fessMessages = new FessMessages();
|
||||
var fessView = new FessView(fessMessages);
|
||||
var fessModel = new FessModel();
|
||||
var fessController = new FessController(fessView, fessModel);
|
||||
fessController.start();
|
||||
})();
|
|
@ -1,21 +0,0 @@
|
|||
import FessJQuery from 'jquery';
|
||||
|
||||
export default class {
|
||||
constructor() {
|
||||
}
|
||||
|
||||
search(url, params) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
FessJQuery.ajax({
|
||||
url: url,
|
||||
type: "GET",
|
||||
dataType: "jsonp",
|
||||
data: params
|
||||
}).done(function(data){
|
||||
resolve(data);
|
||||
}).fail(function(data){
|
||||
reject(data);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
<form accept-charset='utf-8'>
|
||||
<table style="width:100%">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<div>
|
||||
<input type="text" name="q" maxlength="1000" size="50" autocomplete="off" id="contentQuery" class="query form-control center-block">
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<button type="submit" id="searchButton" class="btn btn-primary"><i class="fa fa-search"></i>{form.search.button}</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
|
@ -1,18 +0,0 @@
|
|||
<form>
|
||||
<table style="width:100%">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<div>
|
||||
<input type="text" name="q" placeholder="{form.input.placeholder}" maxlength="1000" size="50" autocomplete="off" id="contentQuery" class="query form-control center-block">
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<button type="submit" name="search" id="searchButton" class="btn btn-primary"><i class="fa fa-search"></i>{form.search.button}</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
|
@ -1,16 +0,0 @@
|
|||
<div id="result">
|
||||
<div style="border-bottom:solid thin #eeeeee;padding-bottom:5px;margin-bottom:10px;">
|
||||
<table width="100%">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td width="50%">
|
||||
{{record_count}} {result.number} ({{exec_time}}{result.second})
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="alert">
|
||||
{result.did_not_match}
|
||||
</div>
|
||||
</div>
|
|
@ -1,59 +0,0 @@
|
|||
<div id="result">
|
||||
<div style="border-bottom:solid thin #eeeeee;padding-bottom:5px;margin-bottom:10px;">
|
||||
<table width="100%">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
{{record_count}} {result.number} ({{exec_time}}{result.second})
|
||||
</td>
|
||||
<td class="order-box" align="right">
|
||||
<div class="order">
|
||||
{result.order}:
|
||||
<select class="form-control sort">
|
||||
<option value="score.desc">{result.order.score}</option>
|
||||
<option value="last_modified.desc">{result.order.last_modified}</option>
|
||||
</select>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div>
|
||||
<ol id="searchResultList">
|
||||
{{#each result}}
|
||||
<li id="result{{@index}}">
|
||||
<div class="media">
|
||||
<div class="media-body">
|
||||
<h3 class="title ellipsis media-heading">
|
||||
<a class="link" href="{{url}}" data-uri="{{url}}" data-order="0">
|
||||
{{content_title}}
|
||||
</a>
|
||||
</h3>
|
||||
</div>
|
||||
<div class="body">
|
||||
<div>
|
||||
<div class="thumbnailBox media-left hidden-xs-down">
|
||||
<a class="link" href="{{url}}" data-uri="{{url}}" data-id="{{doc_id}}" data-order="1">
|
||||
<img src="{{../context_path}}/images/blank.png"
|
||||
data-src="{{../context_path}}/thumbnail/?docId={{doc_id}}&queryId={{../query_id}}" class="thumbnail">
|
||||
</a>
|
||||
</div>
|
||||
<div class="media-body description">
|
||||
{{{content_description}}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="site ellipsis">
|
||||
<cite>{{site}}</cite>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
{{/each}}
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
<div class="center">
|
||||
<nav id="subfooter" class='paginationNav'>
|
||||
</nav>
|
||||
</div>
|
|
@ -1,187 +0,0 @@
|
|||
import FessJQuery from 'jquery';
|
||||
import formTemplate from '!handlebars-loader!./templates/fess-form.hbs';
|
||||
import formOnlyTemplate from '!handlebars-loader!./templates/fess-form-only.hbs';
|
||||
import resultTemplate from '!handlebars-loader!./templates/fess-result.hbs';
|
||||
import noResultTemplate from '!handlebars-loader!./templates/fess-no-result.hbs';
|
||||
|
||||
export default class {
|
||||
constructor(FessMessages) {
|
||||
this.FessMessages = FessMessages;
|
||||
this.IMG_LOADING_DELAY = 200;
|
||||
this.IMG_LOADING_MAX = 0;
|
||||
}
|
||||
|
||||
init() {
|
||||
{
|
||||
var $fessWrapper = FessJQuery('<div/>');
|
||||
$fessWrapper.addClass('fessWrapper');
|
||||
FessJQuery('fess\\:search').replaceWith($fessWrapper);
|
||||
|
||||
var $fessForm = FessJQuery('<div/>');
|
||||
$fessForm.addClass('fessForm');
|
||||
$fessWrapper.append($fessForm);
|
||||
|
||||
var $fessResult = FessJQuery('<div/>');
|
||||
$fessResult.addClass('fessResult');
|
||||
$fessResult.css('display', 'none');
|
||||
$fessWrapper.append($fessResult);
|
||||
}
|
||||
|
||||
{
|
||||
var $fessFormWrapper = FessJQuery('<div/>');
|
||||
$fessFormWrapper.addClass('fessWrapper');
|
||||
|
||||
var $fessFormOnly = FessJQuery('<div/>');
|
||||
$fessFormOnly.addClass('fessFormOnly');
|
||||
$fessFormWrapper.append($fessFormOnly);
|
||||
|
||||
FessJQuery('fess\\:search-form-only').replaceWith($fessFormWrapper);
|
||||
}
|
||||
|
||||
{
|
||||
var $fessResultWrapper = FessJQuery('<div/>');
|
||||
$fessResultWrapper.addClass('fessWrapper');
|
||||
|
||||
var $fessResultOnly = FessJQuery('<div/>');
|
||||
$fessResultOnly.addClass('fessResult');
|
||||
$fessResultOnly.css('display', 'none');
|
||||
$fessResultWrapper.append($fessResultOnly);
|
||||
|
||||
FessJQuery('fess\\:search-result-only').replaceWith($fessResultWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
renderForm(searchPagePath) {
|
||||
var $fessForm = FessJQuery('.fessWrapper .fessForm');
|
||||
var $fessFormOnly = FessJQuery('.fessWrapper .fessFormOnly');
|
||||
if ($fessForm.length > 0) {
|
||||
var html = formTemplate();
|
||||
$fessForm.html(this.FessMessages.render(html, {}));
|
||||
}
|
||||
if ($fessFormOnly.length > 0) {
|
||||
var html = formOnlyTemplate();
|
||||
$fessFormOnly.html(this.FessMessages.render(html, {}));
|
||||
FessJQuery('.fessWrapper .fessFormOnly form').attr('action', searchPagePath);
|
||||
}
|
||||
}
|
||||
|
||||
renderResult(contextPath, response, params) {
|
||||
response['context_path'] = contextPath;
|
||||
var $fessResult = FessJQuery('.fessWrapper .fessResult');
|
||||
var html = resultTemplate(response);
|
||||
$fessResult.html(this.FessMessages.render(html, response));
|
||||
var $pagination = this._createPagination(response.record_count, response.page_size, response.page_number, params);
|
||||
FessJQuery('.fessWrapper .paginationNav').append($pagination);
|
||||
if (FessJQuery('.fessWrapper .fessForm').length > 0) {
|
||||
FessJQuery('.fessWrapper select.sort').val(params.sort);
|
||||
} else {
|
||||
FessJQuery('.fessWrapper .fessResult table .order').css('display', 'none');
|
||||
}
|
||||
this._loadThumbnail(contextPath);
|
||||
}
|
||||
|
||||
renderNoResult(response, params) {
|
||||
var $fessResult = FessJQuery('.fessWrapper .fessResult');
|
||||
var html = noResultTemplate(response);
|
||||
$fessResult.html(this.FessMessages.render(html, response));
|
||||
}
|
||||
|
||||
_createPagination(recordCount, pageSize, currentPage, params) {
|
||||
var $cls = this;
|
||||
|
||||
var $pagination = FessJQuery('<ul/>');
|
||||
$pagination.addClass('pagination');
|
||||
|
||||
var calc_start_pos = function(page, pageSize) {
|
||||
return (pageSize * (page - 1));
|
||||
}
|
||||
|
||||
var paginationInfo = (function(){
|
||||
var pageWidth = function() {
|
||||
var width;
|
||||
if (window.matchMedia('( max-width : 47.9em)').matches) {
|
||||
width = 2;
|
||||
} else {
|
||||
width = 5;
|
||||
}
|
||||
return width;
|
||||
}();
|
||||
var allPageNum = Math.floor((recordCount - 1) / pageSize) + 1;
|
||||
var info = {};
|
||||
info.current = currentPage;
|
||||
info.min = (currentPage - pageWidth) > 0 ? currentPage - pageWidth : 1;
|
||||
info.max = (currentPage + pageWidth) < allPageNum ? currentPage + pageWidth : allPageNum;
|
||||
return info;
|
||||
})();
|
||||
|
||||
var $prev = (function(){
|
||||
var $li = FessJQuery('<li/>');
|
||||
$li.addClass('prev');
|
||||
$li.attr('aria-label', 'Previous');
|
||||
$li.attr('page', paginationInfo.current - 1);
|
||||
$li.html($cls.FessMessages.render('<a><span aria-hidden="true">«</span> <span class="sr-only">{result.pagination.prev}</span></a>', {}));
|
||||
if (currentPage > 1) {
|
||||
$li.css('cursor', 'pointer');
|
||||
} else {
|
||||
$li.addClass('disabled');
|
||||
}
|
||||
return $li;
|
||||
})();
|
||||
$pagination.append($prev);
|
||||
|
||||
for (var i=paginationInfo.min;i<=paginationInfo.max;i++) {
|
||||
var $li = FessJQuery('<li/>');
|
||||
if (i == paginationInfo.current) {
|
||||
$li.addClass('active');
|
||||
}
|
||||
$li.css('cursor', 'pointer');
|
||||
$li.html('<a>' + i + '</a>');
|
||||
$li.attr('page', i);
|
||||
$pagination.append($li);
|
||||
}
|
||||
|
||||
var $next = (function(){
|
||||
var $li = FessJQuery('<li/>');
|
||||
$li.addClass('next');
|
||||
$li.attr('aria-label', 'Next');
|
||||
$li.attr('page', paginationInfo.current + 1);
|
||||
$li.html($cls.FessMessages.render('<a><span class="sr-only">{result.pagination.next}</span><span aria-hidden="true">»</span></a>', {}));
|
||||
if (paginationInfo.current < paginationInfo.max) {
|
||||
$li.css('cursor', 'pointer');
|
||||
} else {
|
||||
$li.addClass('disabled');
|
||||
}
|
||||
return $li;
|
||||
})();
|
||||
$pagination.append($next);
|
||||
|
||||
return $pagination;
|
||||
}
|
||||
|
||||
_loadThumbnail(contextPath) {
|
||||
var $cls = this;
|
||||
var loadImage = function(img, url, limit) {
|
||||
var imgData = new Image();
|
||||
imgData.onload = function() {
|
||||
FessJQuery(img).css('background-image', '');
|
||||
FessJQuery(img).attr('src', url);
|
||||
};
|
||||
imgData.onerror = function() {
|
||||
if (limit > 0) {
|
||||
setTimeout(function() {
|
||||
loadImage(img, url, --limit);
|
||||
}, $cls.IMG_LOADING_DELAY);
|
||||
} else {
|
||||
FessJQuery(img).parent().css('display', 'none');
|
||||
}
|
||||
imgData = null;
|
||||
};
|
||||
imgData.src = url;
|
||||
};
|
||||
|
||||
FessJQuery('.fessWrapper .fessResult img.thumbnail').each(function() {
|
||||
FessJQuery(this).css('background-image', 'url("' + contextPath + '/images/loading.gif")');
|
||||
loadImage(this, FessJQuery(this).attr('data-src'), $cls.IMG_LOADING_MAX);
|
||||
});
|
||||
}
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
<html lang="ja">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
</head>
|
||||
|
||||
<script>
|
||||
(function() {
|
||||
var fess = document.createElement('script');
|
||||
fess.type = 'text/javascript';
|
||||
fess.async = true;
|
||||
fess.src = '//localhost:8080/js/ss/fess-ss.min.js';
|
||||
fess.charset = 'utf-8';
|
||||
fess.setAttribute('id', 'fess-ss');
|
||||
fess.setAttribute('fess-url', '//localhost:8080/json');
|
||||
var s = document.getElementsByTagName('script')[0];
|
||||
s.parentNode.insertBefore(fess, s);
|
||||
})();
|
||||
</script>
|
||||
|
||||
<fess:search></fess:search>
|
||||
</html>
|
|
@ -1,25 +0,0 @@
|
|||
const webpack = require("webpack");
|
||||
|
||||
module.exports = {
|
||||
entry: __dirname + "/src/main.js",
|
||||
output: {
|
||||
path: __dirname +'/../../../webapp/js/ss',
|
||||
filename: 'fess-ss.min.js'
|
||||
},
|
||||
plugins: [
|
||||
new webpack.optimize.UglifyJsPlugin()
|
||||
],
|
||||
module: {
|
||||
loaders: [
|
||||
{
|
||||
test: /\.js$/,
|
||||
loader: 'babel-loader',
|
||||
exclude: /node_modules/,
|
||||
query:
|
||||
{
|
||||
presets: ['es2015','stage-0']
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
Loading…
Add table
Reference in a new issue