Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

P2P/Privacy switch buttons support with JavaScript disabled

luccioman630fa0015aa0
diff --git a/htroot/env/base.css b/htroot/env/base.css
index fd11056e1..3296eb049 100644
--- a/htroot/env/base.css
+++ b/htroot/env/base.css
@@ -1127,58 +1127,12 @@ div#tagcloud {
}
/******* yacysearch.html end ***********/
-
-/******* yacysearchtrailer.html **********
- Styling for the resource switch button, to avoid overlapping at various screen sizes */
-
-/* When screen size is too small, reduce font-size and padding as done in the bootstrap-switch-mini class */
-@media (max-width: 1449px) {
-#resource-switch-form .bootstrap-switch-handle-on,
-#resource-switch-form .bootstrap-switch-handle-off,
-#resource-switch-form .bootstrap-switch-label {
- padding: 1px 1px !important;
- font-size: 12px !important;
- line-height: 1.5 !important;
- }
-}
-
-/* When screen size is large enough, us the same values as the bootstrap-switch-large class,
- except padding wich is reduced to handle the quite long text */
-@media (min-width: 1450px) {
-#resource-switch-form .bootstrap-switch-handle-on,
-#resource-switch-form .bootstrap-switch-handle-off,
-#resource-switch-form .bootstrap-switch-label {
- padding: 6px 1px !important;
- font-size: 18px !important;
- line-height: 1.3333333 !important;
- }
-}
-
-/* override bootstrap-switch wrapper to use 100% of the parent available size */
-#resource-switch-form,
-.bootstrap-switch-large {
- width: 100% !important;
-}
-
-/* override bootstrap-switch-container to use 155% of the parent available size
- (only 100% is displayed, hiding the switched off part) */
-#resource-switch-form .bootstrap-switch-container {
- width: 155% !important;
-}
-/* override bootstrap-switch-container to use a percent margin value
- (when resource switch is "Privacy" position) */
-#resource-switch-form div[class~="bootstrap-switch-container"][style*="margin-left: -"] {
- margin-left: -52% !important;
+/******* yacysearchtrailer.html **********/
+#resource-switch-form .btn-lg {
+ /* Reduce bootstrap btn-lg padding to avoid text overlapping */
+ padding: 6px 1px;
}
-
-/* override bootstrap-switch elements to use percent widths */
-#resource-switch-form .bootstrap-switch-handle-on,
-#resource-switch-form .bootstrap-switch-handle-off,
-#resource-switch-form .bootstrap-switch-label {
- width: 33.333% !important;
-}
-
/******* yacysearchtrailer.html end ***********/
/******* yacysearchitem.html **********/
diff --git a/htroot/yacysearchtrailer.html b/htroot/yacysearchtrailer.html
index 4a2957698..397eb4a70 100644
--- a/htroot/yacysearchtrailer.html
+++ b/htroot/yacysearchtrailer.html
@@ -7,40 +7,54 @@
}
</script>
-#(resource-select)#::
+#(resource-switches)#::
<form
action="yacysearch.html" method="get" accept-charset="UTF-8" id="resource-switch-form"
data-trigger="hover" data-placement="right" data-container="body"
- data-original-title="Your search is done using peers in the YaCy P2P network."
- data-content="You can switch to 'Stealth Mode' which will switch off P2P, giving you full privacy. Expect less results then, because then only your own search index is used."
- >
-<input checked="checked"
- data-label-text="Privacy"
- data-on-text="<span>&nbsp;&nbsp;&nbsp;Peer-to-Peer&nbsp;&nbsp;&nbsp;&nbsp;</span>"
- data-off-text="<span>&nbsp;&nbsp;&nbsp;&nbsp;Stealth&nbsp;Mode&nbsp;&nbsp;&nbsp;</span>"
- data-on-color="warning" data-off-color="success"
- data-animate="false"
- type="checkbox" name="resource-switch" value="local" data-size="large"
- onchange="document.getElementById('resource').value='local';document.searchform.submit();">
-</form>
-<script>$("#resource-switch-form").popover(); $("[name='resource-switch']").bootstrapSwitch();</script>
-::
-<form action="yacysearch.html" method="get" accept-charset="UTF-8" id="resource-switch-form"
- data-trigger="hover" data-placement="right" data-container="body"
- data-original-title="Your search is done using only your own peer, locally."
- data-content="You can switch to 'Peer-to-Peer Mode' which will cause that your search is done using the other peers in the YaCy network."
- >
-<input
- data-label-text="Peer-to-Peer"
- data-on-text="<span>&nbsp;&nbsp;&nbsp;Peer-to-Peer&nbsp;&nbsp;&nbsp;&nbsp;</span>"
- data-off-text="<span>&nbsp;&nbsp;&nbsp;&nbsp;Stealth&nbsp;Mode&nbsp;&nbsp;&nbsp;</span>"
- data-on-color="warning" data-off-color="success"
- data-animate="false"
- type="checkbox" name="resource-switch" value="global" data-size="large"
- onchange="document.getElementById('resource').value='global';document.searchform.submit();">
+ title="#(global)#Your search is done using only your own peer, locally.::Your search is done using peers in the YaCy P2P network.#(/global)#"
+ data-content="#(global)#You can switch to 'Peer-to-Peer Mode' which will cause that your search is done using the other peers in the YaCy network.::You can switch to 'Stealth Mode' which will switch off P2P, giving you full privacy. Expect less results then, because then only your own search index is used.#(/global)#"
+ onsubmit="document.getElementById('resourceSwitchFormQuery').value = document.getElementById('search').value;">
+ <input type="hidden" id="resourceSwitchFormQuery" name="query" value="#[former]#"/>
+ #(authSearch)#::
+ <input type="hidden" name="auth" value=""/>
+ #(/authSearch)#
+ <input type="hidden" name="contentdom" value="#[contentdom]#" />
+ <input type="hidden" name="strictContentDom" value="#[strictContentDom]#" />
+ <input type="hidden" name="former" value="#[former]#" />
+ <input type="hidden" name="maximumRecords" value="#[maximumRecords]#" />
+ <input type="hidden" name="startRecord" value="#[startRecord]#" />
+ <input type="hidden" name="verify" value="#[search.verify]#" />
+ <input type="hidden" name="nav" value="#[search.navigation]#" />
+ <input type="hidden" name="prefermaskfilter" value="#[prefermaskfilter]#" />
+ <input type="hidden" name="depth" value="#[depth]#" />
+ <input type="hidden" name="constraint" value="#[constraint]#" />
+ <input type="hidden" name="meanCount" value="#[meanCount]#" />
+ <input id="contentDomTimezoneOffset" type="hidden" name="timezoneOffset" value=""><script>document.getElementById("contentDomTimezoneOffset").value = new Date().getTimezoneOffset();</script>
+ <div class="btn-group btn-group-justified hidden-sm hidden-md">
+ <div class="btn-group">
+ <button type="#(global)#submit::button#(/global)#" name="resource" value="global"
+ class="btn btn-lg #(global)#btn-default::btn-warning#(/global)#">Peer-to-Peer</button>
+ </div>
+ <div class="btn-group">
+ <button type="#(global)#button::submit#(/global)#" name="resource" value="local"
+ class="btn btn-lg #(global)#btn-success::btn-default#(/global)#">#(global)#Stealth Mode::Privacy#(/global)#</button>
+ </div>
+ </div>
+ <div class="btn-group btn-group-justified hidden-lg">
+ <div class="btn-group">
+ <button type="#(global)#submit::button#(/global)#" name="resource" value="global"
+ class="btn btn-xs #(global)#btn-default::btn-warning#(/global)#">Peer-to-Peer</button>
+ </div>
+ <div class="btn-group">
+ <button type="#(global)#button::submit#(/global)#" name="resource" value="local"
+ class="btn btn-xs #(global)#btn-success::btn-default#(/global)#">#(global)#Stealth&nbsp;Mode::Privacy#(/global)#</button>
+ </div>
+ </div>
</form>
-<script>$("#resource-switch-form").popover(); $("[name='resource-switch']").bootstrapSwitch();</script>
-#(/resource-select)#
+<script>
+$('#resource-switch-form').popover()
+</script>
+#(/resource-switches)#
<p class="navbutton"></p>
<form action="yacysearch.html" method="get" accept-charset="UTF-8" name="rankingSwitchForm">
diff --git a/htroot/yacysearchtrailer.java b/htroot/yacysearchtrailer.java
index 9111e5e56..367ded421 100644
--- a/htroot/yacysearchtrailer.java
+++ b/htroot/yacysearchtrailer.java
@@ -89,12 +89,6 @@ public class yacysearchtrailer {
return prop;
}
- final boolean clustersearch = sb.isRobinsonMode() && sb.getConfig(SwitchboardConstants.CLUSTER_MODE, "").equals(SwitchboardConstants.CLUSTER_MODE_PUBLIC_CLUSTER);
- final boolean indexReceiveGranted = sb.getConfigBool(SwitchboardConstants.INDEX_RECEIVE_ALLOW_SEARCH, true) || clustersearch;
- boolean p2pmode = sb.peers != null && sb.peers.sizeConnected() > 0 && indexReceiveGranted;
- boolean global = post == null || (!post.get("resource-switch", post.get("resource", "global")).equals("local") && p2pmode);
- boolean stealthmode = p2pmode && !global;
- prop.put("resource-select", !adminAuthenticated ? 0 : stealthmode ? 2 : global ? 1 : 0);
// find search event
final SearchEvent theSearch = SearchEventCache.getEvent(eventID);
if (theSearch == null) {
@@ -103,6 +97,13 @@ public class yacysearchtrailer {
}
final RequestHeader.FileType fileType = header.fileType();
+
+ final boolean clustersearch = sb.isRobinsonMode() && sb.getConfig(SwitchboardConstants.CLUSTER_MODE, "").equals(SwitchboardConstants.CLUSTER_MODE_PUBLIC_CLUSTER);
+ final boolean indexReceiveGranted = sb.getConfigBool(SwitchboardConstants.INDEX_RECEIVE_ALLOW_SEARCH, true) || clustersearch;
+ boolean p2pmode = sb.peers != null && sb.peers.sizeConnected() > 0 && indexReceiveGranted;
+ boolean global = post == null || (!post.get("resource-switch", post.get("resource", "global")).equals("local") && p2pmode);
+ boolean stealthmode = p2pmode && !global;
+
/* Add information about the current navigators generation (number of updates since their initialization) */
prop.put("nav-generation", theSearch.getNavGeneration());
@@ -125,6 +126,10 @@ public class yacysearchtrailer {
/* Maximum number of suggestions to display in the first results page */
final int meanMax = post.getInt("meanCount", 0);
+ prop.put("resource-switches", adminAuthenticated && (stealthmode || global));
+ prop.put("resource-switches_global", adminAuthenticated && global);
+ appendSearchFormValues("resource-switches_", post, prop, global, theSearch, former, snippetFetchStrategyName, startRecord, meanMax);
+
appendSearchFormValues("", post, prop, global, theSearch, former, snippetFetchStrategyName, startRecord, meanMax);
prop.put("contextRanking", !former.contains(" /date"));
prop.put("contextRanking_formerWithoutDate", former.replace(" /date", ""));
diff --git a/locales/fr.lng b/locales/fr.lng
index b4e4ca12b..f6c4976f6 100644
--- a/locales/fr.lng
+++ b/locales/fr.lng
@@ -2611,12 +2611,11 @@ and contributors, CC-BY-SA==et ses contributeurs, CC-BY-SA
#---------------------------
Your search is done using peers in the YaCy P2P network.==Recherche effectu&eacute;e gr&acirc;ce aux noeuds du r&eacute;seau P2P YaCy.
You can switch to 'Stealth Mode' which will switch off P2P, giving you full privacy. Expect less results then, because then only your own search index is used.==Vous pouvez passer en 'Mode furtif' ce qui d&eacute;sactivera le r&eacute;seau pair &agrave; pair et vous offrira une privatisation compl&egrave;te. Cependant vous obtiendrez probablement moins de r&eacute;sultats car la recherche sera alors bas&eacute;e uniquement sur votre propre index.
-"Privacy"=="Privé"
-&nbsp;Peer-to-Peer&nbsp;==&nbsp;Pair&nbsp;&agrave;&nbsp;pair&nbsp;
-Stealth&nbsp;Mode==Mode&nbsp;furtif
+Privacy==Privé
+>Peer-to-Peer<==>Pair&nbsp;&agrave;&nbsp;pair<
+Stealth Mode==Mode furtif
Your search is done using only your own peer, locally.==La recherche est r&eacute;alis&eacute;e uniquement sur les donn&eacute;es locales de votre noeud.
You can switch to 'Peer-to-Peer Mode' which will cause that your search is done using the other peers in the YaCy network.==Vous pouvez passer en mode 'Pair &agrave; pair' dans lequel votre recherche sera bas&eacute;e sur les autres noeuds du r&eacute;seau YaCy.
-"Peer-to-Peer"==Pair&nbsp;&agrave;&nbsp;pair
Context Ranking==Classement contextuel
Sort by Date==Trier par date
Video==Vid&eacute;o
diff --git a/locales/master.lng.xlf b/locales/master.lng.xlf
index 5a7e1be7b..b055dee1e 100644
--- a/locales/master.lng.xlf
+++ b/locales/master.lng.xlf
@@ -11758,13 +11758,13 @@
<source>&gt;Language</source>
</trans-unit>
<trans-unit id="2683fc85" xml:space="preserve" approved="no" translate="yes">
- <source>&amp;nbsp;&amp;nbsp;&amp;nbsp;Peer-to-Peer&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;</source>
+ <source>&gt;Peer-to-Peer&lt;</source>
</trans-unit>
<trans-unit id="93dee466" xml:space="preserve" approved="no" translate="yes">
- <source>&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Stealth&amp;nbsp;Mode&amp;nbsp;&amp;nbsp;&amp;nbsp;</source>
+ <source>Stealth Mode</source>
</trans-unit>
<trans-unit id="6fd46fdc" xml:space="preserve" approved="no" translate="yes">
- <source>"Privacy"</source>
+ <source>Privacy</source>
</trans-unit>
<trans-unit id="75b7ce85" xml:space="preserve" approved="no" translate="yes">
<source>Context Ranking</source>
@@ -11779,16 +11779,16 @@
<source>Images</source>
</trans-unit>
<trans-unit id="264da238" xml:space="preserve" approved="no" translate="yes">
- <source>"Your search is done using peers in the YaCy P2P network."</source>
+ <source>Your search is done using peers in the YaCy P2P network.</source>
</trans-unit>
<trans-unit id="1847f5e2" xml:space="preserve" approved="no" translate="yes">
- <source>"You can switch to 'Stealth Mode' which will switch off P2P, giving you full privacy. Expect less results then, because then only your own search index is used."</source>
+ <source>You can switch to 'Stealth Mode' which will switch off P2P, giving you full privacy. Expect less results then, because then only your own search index is used.</source>
</trans-unit>
<trans-unit id="8ec15852" xml:space="preserve" approved="no" translate="yes">
- <source>"Your search is done using only your own peer, locally."</source>
+ <source>Your search is done using only your own peer, locally.</source>
</trans-unit>
<trans-unit id="f970327e" xml:space="preserve" approved="no" translate="yes">
- <source>"You can switch to 'Peer-to-Peer Mode' which will cause that your search is done using the other peers in the YaCy network."</source>
+ <source>You can switch to 'Peer-to-Peer Mode' which will cause that your search is done using the other peers in the YaCy network.</source>
</trans-unit>
<trans-unit id="d978d81a" xml:space="preserve" approved="no" translate="yes">
<source>&gt;Documents</source>
diff --git a/locales/ru.lng b/locales/ru.lng
index c4cb8d055..a6a9758d7 100644
--- a/locales/ru.lng
+++ b/locales/ru.lng
@@ -4101,6 +4101,10 @@ Pictures==Изображения
#File: yacysearchtrailer.html
#---------------------------
show search results for "#[query]#" on map==Показать результат поиска "#[query]#" на карте
+Your search is done using peers in the YaCy P2P network.==Ваш поиск выполняется с использованием узлов P2P-сети YaCy.
+You can switch to 'Stealth Mode' which will switch off P2P, giving you full privacy. Expect less results then, because then only your own search index is used.==Вы можете перейти в режим Стелс, который отключит использование P2P, но обеспечит вашу полную анонимность. В этом случае результатов поиска будет меньше, потому что поиск будет осуществляться только в локальном индексе.
+Your search is done using only your own peer, locally.==Поиск выполняется только в вашем локальном индексе.
+You can switch to 'Peer-to-Peer Mode' which will cause that your search is done using the other peers in the YaCy network.==Вы можете перейти в режим P2P, который позволит производить поиск с использованием других узлов сети YaCy.
>Provider==>Домен
>Name Space==>Имя
>Author==>Автор
@@ -4108,17 +4112,13 @@ show search results for "#[query]#" on map==Показать результат
>Filetype==>Тип файла
>Language==>Язык
>Please support YaCy!==>Пожалуйста, поддержите YaCy!
-&nbsp;&nbsp;&nbsp;Peer-to-Peer&nbsp;&nbsp;&nbsp;&nbsp;==&nbsp;&nbsp;&nbsp;P2P&nbsp;&nbsp;&nbsp;&nbsp;
-&nbsp;&nbsp;&nbsp;&nbsp;Stealth&nbsp;Mode&nbsp;&nbsp;&nbsp;==&nbsp;&nbsp;&nbsp;&nbsp;Режим&nbsp;стелс&nbsp;&nbsp;&nbsp;
-"Privacy"=="Частный"
+>Peer-to-Peer<==>P2P<
+Stealth Mode==Режим стелс
+Privacy==Частный
Context Ranking==Фильтр по рейтингу
Sort by Date==Фильтр по дате
Documents==Документы
Images==Изображения
-"Your search is done using peers in the YaCy P2P network."=="Ваш поиск выполняется с использованием узлов P2P-сети YaCy."
-"You can switch to 'Stealth Mode' which will switch off P2P, giving you full privacy. Expect less results then, because then only your own search index is used."=="Вы можете перейти в режим Стелс, который отключит использование P2P, но обеспечит вашу полную анонимность. В этом случае результатов поиска будет меньше, потому что поиск будет осуществляться только в локальном индексе."
-"Your search is done using only your own peer, locally."=="Поиск выполняется только в вашем локальном индексе."
-"You can switch to 'Peer-to-Peer Mode' which will cause that your search is done using the other peers in the YaCy network."=="Вы можете перейти в режим P2P, который позволит производить поиск с использованием других узлов сети YaCy."
#-----------------------------
### Subdirectory api ###
diff --git a/locales/zh.lng b/locales/zh.lng
index 6b2fd9652..5c9144dfd 100644
--- a/locales/zh.lng
+++ b/locales/zh.lng
@@ -4529,22 +4529,22 @@ Pictures==图片
#File: yacysearchtrailer.html
#---------------------------
show search results for "#[query]#" on map==在地图上显示 "#[query]#" 的搜索结果
+Your search is done using peers in the YaCy P2P network.==您的搜索是靠YaCy P2P网络中的节点完成的。
+You can switch to 'Stealth Mode' which will switch off P2P, giving you full privacy. Expect less results then, because then only your own search index is used.==您可以切换到'隐形模式',这将关闭P2P,给你完全的隐私。期待较少的结果,因为那时只有您自己的搜索索引被使用。
+Your search is done using only your own peer, locally.==你的搜索是靠在本地的YaCy节点完成的。
+You can switch to 'Peer-to-Peer Mode' which will cause that your search is done using the other peers in the YaCy network.==您可以切换到'P2P',这将让您的搜索使用YaCy网络中的YaCy节点。
>Provider==>提供者
>Name Space==>命名空间
>Author==>作者
>Filetype==>文件类型
>Language==>语言
-&nbsp;&nbsp;&nbsp;Peer-to-Peer&nbsp;&nbsp;&nbsp;&nbsp;==&nbsp;&nbsp;&nbsp;P2P&nbsp;&nbsp;&nbsp;&nbsp;
-&nbsp;&nbsp;&nbsp;&nbsp;Stealth&nbsp;Mode&nbsp;&nbsp;&nbsp;==&nbsp;&nbsp;&nbsp;&nbsp;隐身&nbsp;模式&nbsp;&nbsp;&nbsp;
-"Privacy"=="隐私"
+>Peer-to-Peer<==>P2P<
+Stealth Mode==隐身 模式
+Privacy==隐私
Context Ranking==按内容排名
Sort by Date==按日期排序
Documents==文件
Images==图片
-"Your search is done using peers in the YaCy P2P network."=="您的搜索是靠YaCy P2P网络中的节点完成的。"
-"You can switch to 'Stealth Mode' which will switch off P2P, giving you full privacy. Expect less results then, because then only your own search index is used."=="您可以切换到'隐形模式',这将关闭P2P,给你完全的隐私。期待较少的结果,因为那时只有您自己的搜索索引被使用。"
-"Your search is done using only your own peer, locally."=="你的搜索是靠在本地的YaCy节点完成的。"
-"You can switch to 'Peer-to-Peer Mode' which will cause that your search is done using the other peers in the YaCy network."=="您可以切换到'P2P',这将让您的搜索使用YaCy网络中的YaCy节点。"
>Documents==>文件
>Images==>图片
#-----------------------------