Version Notes
Support for hidden SEO questions
Bug fixes
Download this release
Release Info
Developer | NanoRep |
Extension | NanoRep_Widgets_1_1_0 |
Version | 1.4.0 |
Comparing to | |
See all releases |
Code changes from version 1.3.9 to 1.4.0
- app/code/local/NanoRep/Widgets/Block/Support.php +6 -6
- app/code/local/NanoRep/Widgets/Helper/Data.php +7 -3
- app/code/local/NanoRep/Widgets/etc/config.xml +2 -1
- app/code/local/NanoRep/Widgets/etc/system.xml +11 -2
- app/design/frontend/default/default/layout/nanorepwidgets.xml +4 -0
- app/design/frontend/default/default/template/nanorepwidgets/support.phtml +7 -3
- app/design/frontend/default/default/template/nanorepwidgets/top.phtml +20 -19
- package.xml +6 -5
- skin/frontend/default/default/nanorepwidgets/annyang.js +272 -0
- skin/frontend/default/default/nanorepwidgets/grammer.grxml +27 -0
- skin/frontend/default/default/nanorepwidgets/voice.js +63 -0
app/code/local/NanoRep/Widgets/Block/Support.php
CHANGED
@@ -104,12 +104,12 @@ class NanoRep_Widgets_Block_Support extends Mage_Core_Block_Template
|
|
104 |
$out .= '<h3>' . Mage::getStoreConfig('nanorepwidgets/support_widget/product_faq_headline') . '</h3>';
|
105 |
}
|
106 |
}
|
107 |
-
else{
|
108 |
-
$out .= '<div id="nanoRepGeneralFaq">';
|
109 |
-
if(Mage::getStoreConfig('nanorepwidgets/support_widget/general_faq_headline') != ""){
|
110 |
-
$out .= '<h3>' . Mage::getStoreConfig('nanorepwidgets/support_widget/general_faq_headline') . '</h3>';
|
111 |
-
}
|
112 |
-
}
|
113 |
foreach($items as $item)
|
114 |
{
|
115 |
$product_attributes = array();
|
104 |
$out .= '<h3>' . Mage::getStoreConfig('nanorepwidgets/support_widget/product_faq_headline') . '</h3>';
|
105 |
}
|
106 |
}
|
107 |
+
// else{
|
108 |
+
// $out .= '<div id="nanoRepGeneralFaq">';
|
109 |
+
// if(Mage::getStoreConfig('nanorepwidgets/support_widget/general_faq_headline') != ""){
|
110 |
+
// $out .= '<h3>' . Mage::getStoreConfig('nanorepwidgets/support_widget/general_faq_headline') . '</h3>';
|
111 |
+
// }
|
112 |
+
// }
|
113 |
foreach($items as $item)
|
114 |
{
|
115 |
$product_attributes = array();
|
app/code/local/NanoRep/Widgets/Helper/Data.php
CHANGED
@@ -40,6 +40,10 @@ class NanoRep_Widgets_Helper_Data extends Mage_Core_Helper_Abstract
|
|
40 |
public function isSupportWidgetEnabled(){
|
41 |
return Mage::getStoreConfigFlag("nanorepwidgets/support_widget/active");
|
42 |
}
|
|
|
|
|
|
|
|
|
43 |
|
44 |
// public function getSupportWidgetUsername(){
|
45 |
// return Mage::getStoreConfig("nanorepwidgets/support_widget/username");
|
@@ -90,9 +94,9 @@ class NanoRep_Widgets_Helper_Data extends Mage_Core_Helper_Abstract
|
|
90 |
return Mage::getStoreConfig("nanorepwidgets/support_widget/product_faq_headline");
|
91 |
}
|
92 |
|
93 |
-
public function getSupportWidgetGeneralFaqHeadline(){
|
94 |
-
return Mage::getStoreConfig("nanorepwidgets/support_widget/general_faq_headline");
|
95 |
-
}
|
96 |
|
97 |
public function getSupportWidgetMaxItems(){
|
98 |
return Mage::getStoreConfig("nanorepwidgets/support_widget/max_items");
|
40 |
public function isSupportWidgetEnabled(){
|
41 |
return Mage::getStoreConfigFlag("nanorepwidgets/support_widget/active");
|
42 |
}
|
43 |
+
|
44 |
+
public function isSupportWidgetQuestionsHidden(){
|
45 |
+
return Mage::getStoreConfigFlag("nanorepwidgets/support_widget/question_hidden");
|
46 |
+
}
|
47 |
|
48 |
// public function getSupportWidgetUsername(){
|
49 |
// return Mage::getStoreConfig("nanorepwidgets/support_widget/username");
|
94 |
return Mage::getStoreConfig("nanorepwidgets/support_widget/product_faq_headline");
|
95 |
}
|
96 |
|
97 |
+
// public function getSupportWidgetGeneralFaqHeadline(){
|
98 |
+
// return Mage::getStoreConfig("nanorepwidgets/support_widget/general_faq_headline");
|
99 |
+
// }
|
100 |
|
101 |
public function getSupportWidgetMaxItems(){
|
102 |
return Mage::getStoreConfig("nanorepwidgets/support_widget/max_items");
|
app/code/local/NanoRep/Widgets/etc/config.xml
CHANGED
@@ -12,7 +12,7 @@
|
|
12 |
<config>
|
13 |
<modules>
|
14 |
<NanoRep_Widgets>
|
15 |
-
<version>1.
|
16 |
</NanoRep_Widgets>
|
17 |
</modules>
|
18 |
<global>
|
@@ -205,6 +205,7 @@
|
|
205 |
<days>200</days>
|
206 |
<product_faq_headline>Popular questions by other visitors:</product_faq_headline>
|
207 |
<general_faq_headline></general_faq_headline>
|
|
|
208 |
<cache_timeout>86400</cache_timeout>
|
209 |
</support_widget>
|
210 |
<orders_status>
|
12 |
<config>
|
13 |
<modules>
|
14 |
<NanoRep_Widgets>
|
15 |
+
<version>1.4.0</version>
|
16 |
</NanoRep_Widgets>
|
17 |
</modules>
|
18 |
<global>
|
205 |
<days>200</days>
|
206 |
<product_faq_headline>Popular questions by other visitors:</product_faq_headline>
|
207 |
<general_faq_headline></general_faq_headline>
|
208 |
+
<question_hidden>1</question_hidden>
|
209 |
<cache_timeout>86400</cache_timeout>
|
210 |
</support_widget>
|
211 |
<orders_status>
|
app/code/local/NanoRep/Widgets/etc/system.xml
CHANGED
@@ -276,14 +276,23 @@
|
|
276 |
<show_in_website>1</show_in_website>
|
277 |
<show_in_store>1</show_in_store>
|
278 |
</product_faq_headline>
|
279 |
-
<general_faq_headline translate="label">
|
280 |
<label>General FAQ Label</label>
|
281 |
<frontend_type>text</frontend_type>
|
282 |
<sort_order>35</sort_order>
|
283 |
<show_in_default>1</show_in_default>
|
284 |
<show_in_website>1</show_in_website>
|
285 |
<show_in_store>1</show_in_store>
|
286 |
-
</general_faq_headline>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
287 |
<cache_timeout translate="label">
|
288 |
<label>Cache Update Every</label>
|
289 |
<frontend_type>text</frontend_type>
|
276 |
<show_in_website>1</show_in_website>
|
277 |
<show_in_store>1</show_in_store>
|
278 |
</product_faq_headline>
|
279 |
+
<!-- <general_faq_headline translate="label">
|
280 |
<label>General FAQ Label</label>
|
281 |
<frontend_type>text</frontend_type>
|
282 |
<sort_order>35</sort_order>
|
283 |
<show_in_default>1</show_in_default>
|
284 |
<show_in_website>1</show_in_website>
|
285 |
<show_in_store>1</show_in_store>
|
286 |
+
</general_faq_headline> -->
|
287 |
+
<question_hidden translate="label">
|
288 |
+
<label>Hide the questions for SEO</label>
|
289 |
+
<frontend_type>select</frontend_type>
|
290 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
291 |
+
<sort_order>36</sort_order>
|
292 |
+
<show_in_default>1</show_in_default>
|
293 |
+
<show_in_website>1</show_in_website>
|
294 |
+
<show_in_store>1</show_in_store>
|
295 |
+
</question_hidden>
|
296 |
<cache_timeout translate="label">
|
297 |
<label>Cache Update Every</label>
|
298 |
<frontend_type>text</frontend_type>
|
app/design/frontend/default/default/layout/nanorepwidgets.xml
CHANGED
@@ -19,6 +19,10 @@
|
|
19 |
<block type="nanorepwidgets/general" name="nanorep_general_widget" as="nanorep_general_widget" template="nanorepwidgets/general.phtml" />
|
20 |
<block type="nanorepwidgets/events" name="nanorep_events" as="nanorep_events" template="nanorepwidgets/events.phtml" />
|
21 |
</reference>
|
|
|
|
|
|
|
|
|
22 |
</default>
|
23 |
|
24 |
<nanorepwidgets_index_getcustomerhistory>
|
19 |
<block type="nanorepwidgets/general" name="nanorep_general_widget" as="nanorep_general_widget" template="nanorepwidgets/general.phtml" />
|
20 |
<block type="nanorepwidgets/events" name="nanorep_events" as="nanorep_events" template="nanorepwidgets/events.phtml" />
|
21 |
</reference>
|
22 |
+
<reference name="head">
|
23 |
+
<action method="addItem"><type>skin_js</type><file>nanorepwidgets/annyang.js</file></action>
|
24 |
+
<action method="addItem"><type>skin_js</type><file>nanorepwidgets/voice.js</file></action>
|
25 |
+
</reference>
|
26 |
</default>
|
27 |
|
28 |
<nanorepwidgets_index_getcustomerhistory>
|
app/design/frontend/default/default/template/nanorepwidgets/support.phtml
CHANGED
@@ -10,8 +10,13 @@ if (!is_null($this -> getProduct())) {
|
|
10 |
|
11 |
<?php if($this->helper("nanorepwidgets")->isSupportWidgetEnabled()):?>
|
12 |
<!--do not modify this script -->
|
|
|
|
|
|
|
13 |
<?php $this->getXml(true); ?>
|
14 |
-
<?php $this->
|
|
|
|
|
15 |
<script type='text/javascript'>
|
16 |
|
17 |
document.observe("dom:loaded", function() {
|
@@ -24,8 +29,7 @@ if (!is_null($this -> getProduct())) {
|
|
24 |
}
|
25 |
onloadFnc();
|
26 |
});
|
27 |
-
|
28 |
-
var _nRepData = _nRepData || [];
|
29 |
_nRepData['kb'] = '8331305';
|
30 |
/* API here */;
|
31 |
_nRepData['embed'] = {
|
10 |
|
11 |
<?php if($this->helper("nanorepwidgets")->isSupportWidgetEnabled()):?>
|
12 |
<!--do not modify this script -->
|
13 |
+
<?php if($this->helper("nanorepwidgets")->isSupportWidgetQuestionsHidden()):?>
|
14 |
+
<noscript>
|
15 |
+
<?php endif; ?>
|
16 |
<?php $this->getXml(true); ?>
|
17 |
+
<?php if($this->helper("nanorepwidgets")->isSupportWidgetQuestionsHidden()):?>
|
18 |
+
</noscript>
|
19 |
+
<?php endif; ?>
|
20 |
<script type='text/javascript'>
|
21 |
|
22 |
document.observe("dom:loaded", function() {
|
29 |
}
|
30 |
onloadFnc();
|
31 |
});
|
32 |
+
|
|
|
33 |
_nRepData['kb'] = '8331305';
|
34 |
/* API here */;
|
35 |
_nRepData['embed'] = {
|
app/design/frontend/default/default/template/nanorepwidgets/top.phtml
CHANGED
@@ -14,35 +14,37 @@
|
|
14 |
<?php if($this->helper("nanorepwidgets")->isFloatWidgetActive()): ?>
|
15 |
<div class='nanorep_loadingData' id='nanoRepProxyContainer' style='position:absolute;top:-500px;left:0px;'>
|
16 |
</div>
|
|
|
17 |
<script type='text/javascript'>
|
18 |
<?php
|
19 |
-
$
|
20 |
-
|
21 |
-
|
22 |
-
$
|
23 |
-
|
24 |
-
|
25 |
-
$
|
26 |
-
}
|
27 |
-
|
28 |
-
if($productID == ""){
|
29 |
-
if($_product->getData($productIdAttribute) != ""){
|
30 |
$productID = $_product->getData($productIdAttribute);
|
31 |
}
|
32 |
-
|
33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
}
|
35 |
-
}
|
36 |
-
if($productID == ""){
|
37 |
-
$productID = $_product->getId();
|
38 |
}
|
39 |
?>
|
40 |
var _nRepData = _nRepData || [];
|
41 |
_nRepData["context"] = {
|
42 |
"Website" : "<?php echo $_SERVER['HTTP_HOST']; ?>"<?php if(!is_null($_product)): ?>,
|
43 |
"ProductID" : "<?php echo $productID?>"<?php if($_product->getAttributeText('manufacturer') != ""): ?>,
|
44 |
-
"Manufacturer" : "<?php echo $_product->getAttributeText('manufacturer'); ?>"<?php endif; ?><?php if(!is_null($_product->getCategory())):
|
45 |
-
<?php endif; ?>
|
46 |
<?php endif; ?>
|
47 |
};
|
48 |
_nRepData["customParams"] = {
|
@@ -60,4 +62,3 @@
|
|
60 |
<?php endif; ?>
|
61 |
};
|
62 |
</script>
|
63 |
-
<?php endif; ?>
|
14 |
<?php if($this->helper("nanorepwidgets")->isFloatWidgetActive()): ?>
|
15 |
<div class='nanorep_loadingData' id='nanoRepProxyContainer' style='position:absolute;top:-500px;left:0px;'>
|
16 |
</div>
|
17 |
+
<?php endif; ?>
|
18 |
<script type='text/javascript'>
|
19 |
<?php
|
20 |
+
if(!is_null($_product)){
|
21 |
+
$productID = "";
|
22 |
+
$productIdAttribute = Mage::getStoreConfig('nanorepwidgets/account_settings/product_id_attribute');
|
23 |
+
if($productIdAttribute == "id"){
|
24 |
+
$productID = $_product->getId();
|
25 |
+
}
|
26 |
+
elseif($productIdAttribute == "sku"){
|
|
|
|
|
|
|
|
|
27 |
$productID = $_product->getData($productIdAttribute);
|
28 |
}
|
29 |
+
|
30 |
+
if($productID == ""){
|
31 |
+
if($_product->getData($productIdAttribute) != ""){
|
32 |
+
$productID = $_product->getData($productIdAttribute);
|
33 |
+
}
|
34 |
+
else{
|
35 |
+
$productID = $_product->getAttributeText($productIdAttribute);
|
36 |
+
}
|
37 |
+
}
|
38 |
+
if($productID == ""){
|
39 |
+
$productID = $_product->getId();
|
40 |
}
|
|
|
|
|
|
|
41 |
}
|
42 |
?>
|
43 |
var _nRepData = _nRepData || [];
|
44 |
_nRepData["context"] = {
|
45 |
"Website" : "<?php echo $_SERVER['HTTP_HOST']; ?>"<?php if(!is_null($_product)): ?>,
|
46 |
"ProductID" : "<?php echo $productID?>"<?php if($_product->getAttributeText('manufacturer') != ""): ?>,
|
47 |
+
"Manufacturer" : "<?php echo $_product->getAttributeText('manufacturer'); ?>"<?php endif; ?><?php if(!is_null($_product->getCategory())): ?>,<?php endif; ?>
|
|
|
48 |
<?php endif; ?>
|
49 |
};
|
50 |
_nRepData["customParams"] = {
|
62 |
<?php endif; ?>
|
63 |
};
|
64 |
</script>
|
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>NanoRep_Widgets_1_1_0</name>
|
4 |
-
<version>1.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.gnu.org/licenses/gpl.html">GPL v3.0</license>
|
7 |
<channel>community</channel>
|
@@ -45,11 +45,12 @@ Agents get a 360
|
|
45 |
degree view of customers’ activity before
|
46 |
working on cases.
|
47 |
</description>
|
48 |
-
<notes>
|
|
|
49 |
<authors><author><name>NanoRep</name><user>avivnanore</user><email>aviv@nanorep.com</email></author></authors>
|
50 |
-
<date>2014-
|
51 |
-
<time>
|
52 |
-
<contents><target name="magelocal"><dir name="NanoRep"><dir name="Widgets"><dir name="Block"><dir name="Adminhtml"><file name="Mynanorep.php" hash="8d2fc0ec21bf7c5583c308e81d4cabd8"/><dir name="Order"><file name="Grid.php" hash="4c2d639873e7d5dd099c9cbaa2013a50"/><dir name="View"><file name="Queries.php" hash="87b00acce9293ff50893be42e27e0542"/></dir></dir></dir><file name="Customerhistoryjson.php" hash="fa7ce0515f0de6e479d669691f5b85b2"/><file name="Events.php" hash="3ed310081949aa73c80710b29d559413"/><file name="General.php" hash="0e591128716cdf4fafd71a69ce98c755"/><file name="Success.php" hash="6ae59952edefcd75006f5f8323444765"/><file name="Support.php" hash="
|
53 |
<compatible/>
|
54 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
55 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>NanoRep_Widgets_1_1_0</name>
|
4 |
+
<version>1.4.0</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.gnu.org/licenses/gpl.html">GPL v3.0</license>
|
7 |
<channel>community</channel>
|
45 |
degree view of customers’ activity before
|
46 |
working on cases.
|
47 |
</description>
|
48 |
+
<notes>Support for hidden SEO questions
|
49 |
+
Bug fixes</notes>
|
50 |
<authors><author><name>NanoRep</name><user>avivnanore</user><email>aviv@nanorep.com</email></author></authors>
|
51 |
+
<date>2014-05-09</date>
|
52 |
+
<time>16:27:01</time>
|
53 |
+
<contents><target name="magelocal"><dir name="NanoRep"><dir name="Widgets"><dir name="Block"><dir name="Adminhtml"><file name="Mynanorep.php" hash="8d2fc0ec21bf7c5583c308e81d4cabd8"/><dir name="Order"><file name="Grid.php" hash="4c2d639873e7d5dd099c9cbaa2013a50"/><dir name="View"><file name="Queries.php" hash="87b00acce9293ff50893be42e27e0542"/></dir></dir></dir><file name="Customerhistoryjson.php" hash="fa7ce0515f0de6e479d669691f5b85b2"/><file name="Events.php" hash="3ed310081949aa73c80710b29d559413"/><file name="General.php" hash="0e591128716cdf4fafd71a69ce98c755"/><file name="Success.php" hash="6ae59952edefcd75006f5f8323444765"/><file name="Support.php" hash="5356b2420c1bf8facce79888e1a2f62f"/><file name="Top.php" hash="8ab75cf1143182f643b91a88d9ce569e"/></dir><dir name="Helper"><file name="Data.php" hash="ea377f4c8590004eca92a98f5aa425f1"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Source"><file name="Attribute.php" hash="170f0dfbdcfa9b67bc18b0d03494e23b"/><file name="ProductIdAttribute.php" hash="f61e5d9a386bc030a78c012f81e88c2d"/></dir></dir></dir></dir><file name="History.php" hash="99ed12e3dfcb7a563825fd8418a50e59"/><dir name="Mysql4"><file name="Query.php" hash="c5f69b8c5e93e7d06fc1ff16c873790d"/><file name="Setup.php" hash="be89f73150df986eb994ebcf3dc7416e"/></dir><file name="Observer.php" hash="ccb1fff903eabbc01711a9bed8111689"/><file name="Query.php" hash="9f0f7f077766745d88535ae2a1805cb5"/><file name="Session.php" hash="4cd0cfe4a67bade3eb710aac7f8cfb40"/><dir name="System"><dir name="Config"><dir name="Source"><file name="FloatWidgetActivePages.php" hash="8feb17fe6ee045cba82f481a0bf90d5d"/><file name="OrdersStatusActivePages.php" hash="6bd1beff14a6fa24b78e3393a03245a4"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="MynanorepController.php" hash="6846f66016c3faddcd8f6f4fb2b9deca"/></dir><file name="IndexController.php" hash="fddc21b9390b15e04b0aa391919f3930"/><file name="QueryController.php" hash="35975131cad35dcea58801613b3ab960"/></dir><dir name="etc"><file name="config.xml" hash="ad6a530dbfe258567442dbce07961a41"/><file name="system.xml" hash="34d30e80e2a84d87512938f55661c5f5"/></dir><dir name="sql"><dir name="nanorepwidgets_setup"><file name="mysql4-data-upgrade-1.2.2-1.2.3.php" hash="feaf8b31078707d0df7ff6758ec7a5d6"/><file name="mysql4-install-1.2.2.php" hash="869d64ee7d1d121a3b617c22b875949b"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="NanoRep_Widgets.xml" hash="4fbaad20e02fa3ed2147ba15864c3cab"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="nanorepwidgets.xml" hash="08efb271c36a4f5a0f725ad3e1d1bd2b"/></dir><dir name="template"><dir name="nanorepwidgets"><file name="cdc.phtml" hash="ccc4e010b3ee2b8229b36ca9b6a87c0b"/><file name="events.phtml" hash="cbdce563c3e4032c6bf23ed732485c7d"/><file name="general.phtml" hash="e5505af4b24fbb6d719962ca986cf589"/><file name="grid.phtml" hash="5d3d5cadd384525b13d4f5b8e1a40f22"/><file name="success.phtml" hash="c637a727aa20ec91105f3dbeb20832a7"/><file name="support.phtml" hash="cca1d2073e3d312173a6120c6ffd9f01"/><file name="top.phtml" hash="731fcaa36efaa09944b0af0655d8d175"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir><dir name="default"><dir name="default"><dir name="template"><dir name="nanorepwidgets"><file name="mynanorep.phtml" hash="270b613ddddc94ad3e617c397f1f53a1"/><dir name="order"><dir name="view"><file name="queries.phtml" hash="bfb44dd77bba62629277aae45239ea6b"/><dir name="tab"><file name="info.phtml" hash="6dde16c3fe3bdddb65ca977d99872811"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="default"><dir name="default"><dir name="layout"><file name="nanorepwidgets.xml" hash="d818dd9f9b17bedccba27a8f715b71dd"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="nanorepwidgets"><file name="annyang.js" hash="127c5cd1786a47a18b54a91d69049f09"/><file name="grammer.grxml" hash="de15f31d142790ad346ae2179b626e23"/><file name="head.css" hash="1779a092e2c2a771a0725e1cdd682a46"/><file name="head.js" hash="8bafa94d8432b42e2e6e7f6af91db39e"/><file name="voice.js" hash="b9f98913690d4fc544b729d25d56e647"/></dir></dir></dir></dir></target></contents>
|
54 |
<compatible/>
|
55 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
56 |
</package>
|
skin/frontend/default/default/nanorepwidgets/annyang.js
ADDED
@@ -0,0 +1,272 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
//! annyang
|
2 |
+
//! version : 1.1.0
|
3 |
+
//! author : Tal Ater @TalAter
|
4 |
+
//! license : MIT
|
5 |
+
//! https://www.TalAter.com/annyang/
|
6 |
+
(function (undefined) {
|
7 |
+
"use strict";
|
8 |
+
|
9 |
+
// Save a reference to the global object (window in the browser)
|
10 |
+
var root = this;
|
11 |
+
|
12 |
+
// Get the SpeechRecognition object, while handling browser prefixes
|
13 |
+
var SpeechRecognition = root.SpeechRecognition ||
|
14 |
+
root.webkitSpeechRecognition ||
|
15 |
+
root.mozSpeechRecognition ||
|
16 |
+
root.msSpeechRecognition ||
|
17 |
+
root.oSpeechRecognition;
|
18 |
+
|
19 |
+
// Check browser support
|
20 |
+
// This is done as early as possible, to make it as fast as possible for unsupported browsers
|
21 |
+
if (!SpeechRecognition) {
|
22 |
+
root.annyang = null;
|
23 |
+
return undefined;
|
24 |
+
}
|
25 |
+
|
26 |
+
var commandsList = [];
|
27 |
+
var recognition;
|
28 |
+
var callbacks = { start: [], error: [], end: [], result: [], resultMatch: [], resultNoMatch: [], errorNetwork: [], errorPermissionBlocked: [], errorPermissionDenied: [] };
|
29 |
+
var autoRestart;
|
30 |
+
var lastStartedAt = 0;
|
31 |
+
var debugState = false;
|
32 |
+
var debugStyle = 'font-weight: bold; color: #00f;';
|
33 |
+
|
34 |
+
// The command matching code is a modified version of Backbone.Router by Jeremy Ashkenas, under the MIT license.
|
35 |
+
var optionalParam = /\s*\((.*?)\)\s*/g;
|
36 |
+
var optionalRegex = /(\(\?:[^)]+\))\?/g;
|
37 |
+
var namedParam = /(\(\?)?:\w+/g;
|
38 |
+
var splatParam = /\*\w+/g;
|
39 |
+
var escapeRegExp = /[\-{}\[\]+?.,\\\^$|#]/g;
|
40 |
+
var escapeRegExp = /[\-{}\[\]+?.,\\\^$|#]/g;
|
41 |
+
var commandToRegExp = function(command) {
|
42 |
+
command = command.replace(escapeRegExp, '[\\$&]|')
|
43 |
+
.replace(optionalParam, '(?:$1)?')
|
44 |
+
.replace(namedParam, function(match, optional) {
|
45 |
+
return optional ? match : '([^\\s]+)';
|
46 |
+
})
|
47 |
+
.replace(splatParam, '(.*?)')
|
48 |
+
.replace(optionalRegex, '\\s*$1?\\s*');
|
49 |
+
return new RegExp('^' + command + '$', 'i');
|
50 |
+
};
|
51 |
+
|
52 |
+
// This method receives an array of callbacks to iterate over, and invokes each of them
|
53 |
+
var invokeCallbacks = function(callbacks) {
|
54 |
+
callbacks.forEach(function(callback) {
|
55 |
+
callback.callback.apply(callback.context);
|
56 |
+
});
|
57 |
+
};
|
58 |
+
|
59 |
+
var initIfNeeded = function() {
|
60 |
+
if (!isInitialized()) {
|
61 |
+
root.annyang.init({}, false);
|
62 |
+
}
|
63 |
+
};
|
64 |
+
|
65 |
+
var isInitialized = function() {
|
66 |
+
return recognition !== undefined;
|
67 |
+
};
|
68 |
+
|
69 |
+
root.annyang = {
|
70 |
+
// Initialize annyang with a list of commands to recognize.
|
71 |
+
// e.g. annyang.init({'hello :name': helloFunction})
|
72 |
+
// annyang understands commands with named variables, splats, and optional words.
|
73 |
+
init: function(commands, resetCommands) {
|
74 |
+
|
75 |
+
// resetCommands defaults to true
|
76 |
+
if (resetCommands === undefined) {
|
77 |
+
resetCommands = true;
|
78 |
+
} else {
|
79 |
+
resetCommands = !!resetCommands;
|
80 |
+
}
|
81 |
+
|
82 |
+
// Abort previous instances of recognition already running
|
83 |
+
if (recognition && recognition.abort) {
|
84 |
+
recognition.abort();
|
85 |
+
}
|
86 |
+
|
87 |
+
// initiate SpeechRecognition
|
88 |
+
recognition = new SpeechRecognition();
|
89 |
+
|
90 |
+
// Set the max number of alternative transcripts to try and match with a command
|
91 |
+
recognition.maxAlternatives = 5;
|
92 |
+
recognition.continuous = true;
|
93 |
+
// Sets the language to the default 'en-US'. This can be changed with annyang.setLanguage()
|
94 |
+
recognition.lang = 'en-US';
|
95 |
+
|
96 |
+
recognition.onstart = function() { invokeCallbacks(callbacks.start); };
|
97 |
+
|
98 |
+
recognition.onerror = function(event) {
|
99 |
+
invokeCallbacks(callbacks.error);
|
100 |
+
switch (event.error) {
|
101 |
+
case 'network':
|
102 |
+
invokeCallbacks(callbacks.errorNetwork);
|
103 |
+
break;
|
104 |
+
case 'not-allowed':
|
105 |
+
case 'service-not-allowed':
|
106 |
+
// if permission to use the mic is denied, turn off auto-restart
|
107 |
+
autoRestart = false;
|
108 |
+
// determine if permission was denied by user or automatically.
|
109 |
+
if (new Date().getTime()-lastStartedAt < 200) {
|
110 |
+
invokeCallbacks(callbacks.errorPermissionBlocked);
|
111 |
+
} else {
|
112 |
+
invokeCallbacks(callbacks.errorPermissionDenied);
|
113 |
+
}
|
114 |
+
break;
|
115 |
+
}
|
116 |
+
};
|
117 |
+
|
118 |
+
recognition.onend = function() {
|
119 |
+
invokeCallbacks(callbacks.end);
|
120 |
+
// annyang will auto restart if it is closed automatically and not by user action.
|
121 |
+
if (autoRestart) {
|
122 |
+
// play nicely with the browser, and never restart annyang automatically more than once per second
|
123 |
+
var timeSinceLastStart = new Date().getTime()-lastStartedAt;
|
124 |
+
if (timeSinceLastStart < 1000) {
|
125 |
+
setTimeout(root.annyang.start, 1000-timeSinceLastStart);
|
126 |
+
} else {
|
127 |
+
root.annyang.start();
|
128 |
+
}
|
129 |
+
}
|
130 |
+
};
|
131 |
+
|
132 |
+
recognition.onresult = function(event) {
|
133 |
+
invokeCallbacks(callbacks.result);
|
134 |
+
var results = event.results[event.resultIndex];
|
135 |
+
var commandText;
|
136 |
+
// go over each of the 5 results and alternative results received (we've set maxAlternatives to 5 above)
|
137 |
+
for (var i = 0; i<results.length; i++) {
|
138 |
+
// the text recognized
|
139 |
+
commandText = results[i].transcript.trim();
|
140 |
+
if (debugState) {
|
141 |
+
root.console.log('Speech recognized: %c'+commandText, debugStyle);
|
142 |
+
}
|
143 |
+
|
144 |
+
// try and match recognized text to one of the commands on the list
|
145 |
+
for (var j = 0, l = commandsList.length; j < l; j++) {
|
146 |
+
var result = commandsList[j].command.exec(commandText);
|
147 |
+
if (result) {
|
148 |
+
root.console.log(result);
|
149 |
+
var parameters = result.slice(1);
|
150 |
+
if (debugState) {
|
151 |
+
root.console.log('command matched: %c'+commandsList[j].originalPhrase, debugStyle);
|
152 |
+
if (parameters.length) {
|
153 |
+
root.console.log('with parameters', parameters);
|
154 |
+
}
|
155 |
+
}
|
156 |
+
// execute the matched command
|
157 |
+
commandsList[j].callback.apply(this, parameters);
|
158 |
+
invokeCallbacks(callbacks.resultMatch);
|
159 |
+
return true;
|
160 |
+
}
|
161 |
+
}
|
162 |
+
}
|
163 |
+
invokeCallbacks(callbacks.resultNoMatch);
|
164 |
+
return false;
|
165 |
+
};
|
166 |
+
|
167 |
+
// build commands list
|
168 |
+
if (resetCommands) {
|
169 |
+
commandsList = [];
|
170 |
+
}
|
171 |
+
if (commands.length) {
|
172 |
+
this.addCommands(commands);
|
173 |
+
}
|
174 |
+
},
|
175 |
+
|
176 |
+
// Start listening (asking for permission first, if needed).
|
177 |
+
// Call this after you've initialized annyang with commands.
|
178 |
+
// Receives an optional options object:
|
179 |
+
// { autoRestart: true }
|
180 |
+
start: function(options) {
|
181 |
+
initIfNeeded();
|
182 |
+
options = options || {};
|
183 |
+
if (options.autoRestart !== undefined) {
|
184 |
+
autoRestart = !!options.autoRestart;
|
185 |
+
} else {
|
186 |
+
autoRestart = true;
|
187 |
+
}
|
188 |
+
lastStartedAt = new Date().getTime();
|
189 |
+
recognition.start();
|
190 |
+
},
|
191 |
+
|
192 |
+
// abort the listening session (aka stop)
|
193 |
+
abort: function() {
|
194 |
+
autoRestart = false;
|
195 |
+
if (isInitialized) {
|
196 |
+
recognition.abort();
|
197 |
+
}
|
198 |
+
},
|
199 |
+
|
200 |
+
// Turn on output of debug messages to the console. Ugly, but super-handy!
|
201 |
+
debug: function(newState) {
|
202 |
+
if (arguments.length > 0) {
|
203 |
+
debugState = !!newState;
|
204 |
+
} else {
|
205 |
+
debugState = true;
|
206 |
+
}
|
207 |
+
},
|
208 |
+
|
209 |
+
// Set the language the user will speak in. If not called, defaults to 'en-US'.
|
210 |
+
// e.g. 'fr-FR' (French-France), 'es-CR' (Español-Costa Rica)
|
211 |
+
setLanguage: function(language) {
|
212 |
+
initIfNeeded();
|
213 |
+
recognition.lang = language;
|
214 |
+
},
|
215 |
+
|
216 |
+
// Add additional commands that annyang will respond to. Similar in syntax to annyang.init()
|
217 |
+
addCommands: function(commands) {
|
218 |
+
var cb,
|
219 |
+
command;
|
220 |
+
|
221 |
+
initIfNeeded();
|
222 |
+
|
223 |
+
for (var phrase in commands) {
|
224 |
+
if (commands.hasOwnProperty(phrase)) {
|
225 |
+
cb = root[commands[phrase]] || commands[phrase];
|
226 |
+
if (typeof cb !== 'function') {
|
227 |
+
continue;
|
228 |
+
}
|
229 |
+
//convert command to regex
|
230 |
+
command = commandToRegExp(phrase);
|
231 |
+
|
232 |
+
if (debugState) {
|
233 |
+
root.console.log('Command RegExp: %c'+command, debugStyle);
|
234 |
+
}
|
235 |
+
|
236 |
+
commandsList.push({ command: command, callback: cb, originalPhrase: phrase });
|
237 |
+
}
|
238 |
+
}
|
239 |
+
if (debugState) {
|
240 |
+
root.console.log('Commands successfully loaded: %c'+commandsList.length, debugStyle);
|
241 |
+
}
|
242 |
+
},
|
243 |
+
|
244 |
+
// Remove existing commands. Called with a single phrase or an array of phrases
|
245 |
+
removeCommands: function(commandsToRemove) {
|
246 |
+
commandsToRemove = Array.isArray(commandsToRemove) ? commandsToRemove : [commandsToRemove];
|
247 |
+
commandsList = commandsList.filter(function(command) {
|
248 |
+
for (var i = 0; i<commandsToRemove.length; i++) {
|
249 |
+
if (commandsToRemove[i] === command.originalPhrase) {
|
250 |
+
return false;
|
251 |
+
}
|
252 |
+
}
|
253 |
+
return true;
|
254 |
+
});
|
255 |
+
},
|
256 |
+
|
257 |
+
// Lets the user add a callback of one of 9 types:
|
258 |
+
// start, error, end, result, resultMatch, resultNoMatch, errorNetwork, errorPermissionBlocked, errorPermissionDenied
|
259 |
+
// Can also optionally receive a context for the callback function as the third argument
|
260 |
+
addCallback: function(type, callback, context) {
|
261 |
+
if (callbacks[type] === undefined) {
|
262 |
+
return;
|
263 |
+
}
|
264 |
+
var cb = root[callback] || callback;
|
265 |
+
if (typeof cb !== 'function') {
|
266 |
+
return;
|
267 |
+
}
|
268 |
+
callbacks[type].push({callback: cb, context: context || this});
|
269 |
+
}
|
270 |
+
};
|
271 |
+
|
272 |
+
}).call(this);
|
skin/frontend/default/default/nanorepwidgets/grammer.grxml
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<grammar xmlns="http://www.w3.org/2001/06/grammar" root="main">
|
3 |
+
|
4 |
+
<rule id="main" scope="public">
|
5 |
+
|
6 |
+
<item repeat="1-16">
|
7 |
+
<ruleref uri="#digit">
|
8 |
+
<tag>out.concept = out.concept + rules.digit;</tag>
|
9 |
+
</ruleref>
|
10 |
+
</item>
|
11 |
+
</rule>
|
12 |
+
|
13 |
+
<rule id="digit">
|
14 |
+
<one-of>
|
15 |
+
<item>0</item>
|
16 |
+
<item>1</item>
|
17 |
+
<item>2</item>
|
18 |
+
<item>3</item>
|
19 |
+
<item>4</item>
|
20 |
+
<item>5</item>
|
21 |
+
<item>6</item>
|
22 |
+
<item>7</item>
|
23 |
+
<item>8</item>
|
24 |
+
<item>9</item>
|
25 |
+
</one-of>
|
26 |
+
</rule>
|
27 |
+
</grammar>
|
skin/frontend/default/default/nanorepwidgets/voice.js
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// if (annyang) {
|
2 |
+
// // Let's define a command
|
3 |
+
var nanorep_questions = [{label:"כמה זה עולה?",data:0,objectId:"27923761",count:0,percent:0,likes:0},{label:"How to locate billing address",data:0,objectId:"19047959",count:0,percent:0,likes:0},{label:"What is the Tag Module Hierarchy?",data:0,objectId:"22779720",count:0,percent:0,likes:0},{label:"How does the Data Replication operate?",data:0,objectId:"22779702",count:0,percent:0,likes:0},{label:"How does the Distributed Data Storage work?",data:0,objectId:"22779678",count:0,percent:0,likes:0},{label:"What is the Client/Server Architecture?",data:0,objectId:"22779636",count:0,percent:0,likes:0},{label:"where can I find pricing information?",data:0,objectId:"19050627",count:0,percent:0,likes:0},{label:"How do I get a premium verification letter?",data:0,objectId:"19048186",count:0,percent:0,likes:0},{label:"How do I send out a provider directory?",data:0,objectId:"19048171",count:0,percent:0,likes:0},{label:"Reinstatement due to joining another plan",data:0,objectId:"19048140",count:0,percent:0,likes:0},{label:"How do I send out the rating for a plan?",data:0,objectId:"19048089",count:0,percent:0,likes:0},{label:"How do I change payment method?",data:0,objectId:"19048079",count:0,percent:0,likes:0},{label:"explaining billing with no consent",data:0,objectId:"19048014",count:0,percent:0,likes:0},{label:"How do you find the Market the member's plan is sold?",data:0,objectId:"19047899",count:0,percent:0,likes:0},{label:"How do you change a member's demographics?",data:0,objectId:"19047831",count:0,percent:0,likes:0},{label:"What if someone calls to inform CompanyX that member is deceased?",data:0,objectId:"19047803",count:0,percent:0,likes:0}];
|
4 |
+
// var commands = {};
|
5 |
+
//
|
6 |
+
// for (q = 0; q < nanorep_questions.length; q++){
|
7 |
+
// if(nanorep_questions[q] != undefined){
|
8 |
+
// console.log(nanorep_questions[q].label);
|
9 |
+
// var c = { "question" : q, "nanorep_questions" : nanorep_questions };
|
10 |
+
// commands[nanorep_questions[q].label] = function() { console.log(this); }.bind(c);
|
11 |
+
// }
|
12 |
+
// }
|
13 |
+
//
|
14 |
+
// annyang.debug();
|
15 |
+
//
|
16 |
+
// annyang.addCommands(commands);
|
17 |
+
// console.log(commands);
|
18 |
+
// // Start listening.
|
19 |
+
// annyang.start();
|
20 |
+
// }
|
21 |
+
|
22 |
+
(function () {
|
23 |
+
/*global annyang,jQuery */
|
24 |
+
"use strict";
|
25 |
+
var root = this;
|
26 |
+
|
27 |
+
if (annyang) {
|
28 |
+
annyang.debug();
|
29 |
+
annyang.setLanguage('he');
|
30 |
+
|
31 |
+
var askFullQuestion = function(pre_question ,question) {
|
32 |
+
console.log(question);
|
33 |
+
switch(pre_question){
|
34 |
+
case "האם":
|
35 |
+
case "מה":
|
36 |
+
case "למה":
|
37 |
+
case "כמה":
|
38 |
+
case "איפה":
|
39 |
+
case "מתי":
|
40 |
+
$('search').setValue(pre_question + ' ' + question);
|
41 |
+
break;
|
42 |
+
}
|
43 |
+
};
|
44 |
+
|
45 |
+
var askQuestion = function(question) {
|
46 |
+
console.log(question);
|
47 |
+
$('search').setValue(question);
|
48 |
+
|
49 |
+
};
|
50 |
+
|
51 |
+
annyang.addCommands({
|
52 |
+
'יש לי שאלה *question' : askQuestion,
|
53 |
+
'שאלה *question' : askQuestion,
|
54 |
+
'ברצוני לדעת *question' : askQuestion,
|
55 |
+
'ברצוני לשאול *question' : askQuestion,
|
56 |
+
':pre_question *question' : askFullQuestion
|
57 |
+
// 'I like to ask a question *etc' : askQuestion,
|
58 |
+
// 'I\'d to ask a question *etc' : askQuestion,
|
59 |
+
});
|
60 |
+
annyang.start();
|
61 |
+
}
|
62 |
+
|
63 |
+
}).call(this);
|