Sinch_Tonerconfigurator - Version 1.2.4

Version Notes

Version 1.2.4:
* Fix data change bug
* Fix compatibility with themes that don't inherit from default/default

Download this release

Release Info

Developer stockinchannel
Extension Sinch_Tonerconfigurator
Version 1.2.4
Comparing to
See all releases


Code changes from version 1.2.3 to 1.2.4

Files changed (20) hide show
  1. app/code/local/Sinch/Tonerconfigurator/Block/Configurator.php +35 -35
  2. app/code/local/Sinch/Tonerconfigurator/Block/Configuratordropdowns.php +13 -13
  3. app/code/local/Sinch/Tonerconfigurator/Helper/Category.php +26 -26
  4. app/code/local/Sinch/Tonerconfigurator/Helper/Data.php +4 -4
  5. app/code/local/Sinch/Tonerconfigurator/Model/Category.php +34 -29
  6. app/code/local/Sinch/Tonerconfigurator/controllers/AjaxController.php +38 -38
  7. app/code/local/Sinch/Tonerconfigurator/etc/config.xml +72 -55
  8. app/code/local/Sinch/Tonerconfigurator/etc/widget.xml +75 -75
  9. app/design/frontend/{default → base}/default/layout/tonerconfigurator.xml +10 -10
  10. app/design/frontend/{default → base}/default/template/tonerconfigurator/configurator.phtml +14 -14
  11. app/design/frontend/{default → base}/default/template/tonerconfigurator/configuratordropdowns.phtml +15 -15
  12. app/design/frontend/{default → base}/default/template/tonerconfigurator/configuratorscript.phtml +122 -117
  13. app/etc/modules/Sinch_Tonerconfigurator.xml +10 -10
  14. package.xml +7 -6
  15. skin/frontend/{default → base}/default/css/tonerconfigurator/custom.css +0 -0
  16. skin/frontend/{default → base}/default/css/tonerconfigurator/default-noback.css +0 -0
  17. skin/frontend/{default → base}/default/css/tonerconfigurator/default.css +0 -0
  18. skin/frontend/{default → base}/default/css/tonerconfigurator/inline-noback.css +0 -0
  19. skin/frontend/{default → base}/default/css/tonerconfigurator/inline.css +0 -0
  20. skin/frontend/{default → base}/default/js/tonerconfigurator/spin.js +1 -1
app/code/local/Sinch/Tonerconfigurator/Block/Configurator.php CHANGED
@@ -1,35 +1,35 @@
1
- <?php
2
- class Sinch_Tonerconfigurator_Block_Configurator extends Mage_Core_Block_Template implements Mage_Widget_Block_Interface
3
- {
4
- public $TonerConfiguratorTitles;
5
-
6
- protected $_templates;
7
-
8
- protected function _toHtml(){
9
- //$this->setTemplate($this->_templates['configurator']);
10
- return parent::_toHtml();
11
- }
12
-
13
- public function setConfiguratorTemplate($template, $type)
14
- {
15
- $this->_templates[$type] = $template;
16
- return $this;
17
- }
18
-
19
- public function __construct()
20
- {
21
- $this->TonerConfiguratorTitles = Mage::getSingleton('tonerconfigurator/category')->getTonerConfiguratorTitles();
22
- parent::__construct();
23
- $this->setTemplate('tonerconfigurator/configurator.phtml');
24
- }
25
-
26
- public function getMaxLevel(){
27
- return (Mage::getStoreConfig('tonerconfigurator/options/category_depth')+1);
28
- }
29
-
30
- public function getRootCat(){
31
- return Mage::getSingleton('tonerconfigurator/category')->getRootCat();
32
- }
33
- }
34
-
35
- ?>
1
+ <?php
2
+ class Sinch_Tonerconfigurator_Block_Configurator extends Mage_Core_Block_Template implements Mage_Widget_Block_Interface
3
+ {
4
+ public $TonerConfiguratorTitles;
5
+
6
+ protected $_templates;
7
+
8
+ protected function _toHtml(){
9
+ //$this->setTemplate($this->_templates['configurator']);
10
+ return parent::_toHtml();
11
+ }
12
+
13
+ public function setConfiguratorTemplate($template, $type)
14
+ {
15
+ $this->_templates[$type] = $template;
16
+ return $this;
17
+ }
18
+
19
+ public function __construct()
20
+ {
21
+ $this->TonerConfiguratorTitles = Mage::getSingleton('tonerconfigurator/category')->getTonerConfiguratorTitles();
22
+ parent::__construct();
23
+ $this->setTemplate('tonerconfigurator/configurator.phtml');
24
+ }
25
+
26
+ public function getMaxLevel(){
27
+ return (Mage::getStoreConfig('tonerconfigurator/options/category_depth')+1);
28
+ }
29
+
30
+ public function getRootCat(){
31
+ return Mage::getSingleton('tonerconfigurator/category')->getRootCat();
32
+ }
33
+ }
34
+
35
+ ?>
app/code/local/Sinch/Tonerconfigurator/Block/Configuratordropdowns.php CHANGED
@@ -1,13 +1,13 @@
1
- <?php
2
- class Sinch_Tonerconfigurator_Block_Configuratordropdowns extends Mage_Core_Block_Template
3
- {
4
- public $TonerConfiguratorTitles;
5
-
6
- protected $_templates;
7
-
8
- public function __construct(){
9
- parent::__construct();
10
- $this->setTemplate('tonerconfigurator/configurator.phtml');
11
- }
12
- }
13
- ?>
1
+ <?php
2
+ class Sinch_Tonerconfigurator_Block_Configuratordropdowns extends Mage_Core_Block_Template
3
+ {
4
+ public $TonerConfiguratorTitles;
5
+
6
+ protected $_templates;
7
+
8
+ public function __construct(){
9
+ parent::__construct();
10
+ $this->setTemplate('tonerconfigurator/configurator.phtml');
11
+ }
12
+ }
13
+ ?>
app/code/local/Sinch/Tonerconfigurator/Helper/Category.php CHANGED
@@ -1,26 +1,26 @@
1
- <?php
2
- class Sinch_Tonerconfigurator_Helper_Category extends Mage_Catalog_Helper_Category
3
- {
4
-
5
- public function canShow($category)
6
- {
7
- if (is_int($category)) {
8
- $category = Mage::getModel('catalog/category')->load($category);
9
- }
10
-
11
- if (!$category->getId()) {
12
- return false;
13
- }
14
-
15
- if (!$category->getIsActive()) {
16
- return false;
17
- }
18
- if (!$category->isInRootCategoryList()) {
19
- // return false;
20
- }
21
-
22
- return true;
23
- }
24
-
25
- }
26
- ?>
1
+ <?php
2
+ class Sinch_Tonerconfigurator_Helper_Category extends Mage_Catalog_Helper_Category
3
+ {
4
+
5
+ public function canShow($category)
6
+ {
7
+ if (is_int($category)) {
8
+ $category = Mage::getModel('catalog/category')->load($category);
9
+ }
10
+
11
+ if (!$category->getId()) {
12
+ return false;
13
+ }
14
+
15
+ if (!$category->getIsActive()) {
16
+ return false;
17
+ }
18
+ if (!$category->isInRootCategoryList()) {
19
+ // return false;
20
+ }
21
+
22
+ return true;
23
+ }
24
+
25
+ }
26
+ ?>
app/code/local/Sinch/Tonerconfigurator/Helper/Data.php CHANGED
@@ -1,5 +1,5 @@
1
- <?php
2
- class Sinch_Tonerconfigurator_Helper_Data extends Mage_Core_Helper_Abstract {
3
-
4
- }
5
  ?>
1
+ <?php
2
+ class Sinch_Tonerconfigurator_Helper_Data extends Mage_Core_Helper_Abstract {
3
+
4
+ }
5
  ?>
app/code/local/Sinch/Tonerconfigurator/Model/Category.php CHANGED
@@ -1,29 +1,34 @@
1
- <?php
2
- class Sinch_Tonerconfigurator_Model_Category {
3
- public function getTonerConfiguratorTitles(){
4
- $titles = Mage::getStoreConfig( 'tonerconfigurator/options/titles' );
5
- return $titles;
6
- }
7
- public function isRootCategory($catid){
8
- return $catid == $this->getRootCat();
9
- }
10
- public function getRootSubcatColl(){
11
- static $col;
12
- if(!$col){
13
- $col = Mage::getModel('catalog/category')->getCollection();
14
- $col->addAttributeToSelect('*');
15
- $col->addFieldToFilter('parent_id', $this->getRootCat());
16
- $col->addAttributeToSort('name', 'ASC');
17
- }
18
- return $col;
19
- }
20
- public function getRootCat(){
21
- static $rootCat;
22
- if(!$rootCat){
23
- $rootCat = Mage::getStoreConfig("tonerconfigurator/options/root_id");
24
- }
25
- return $rootCat;
26
- }
27
- }
28
-
29
- ?>
 
 
 
 
 
1
+ <?php
2
+ class Sinch_Tonerconfigurator_Model_Category {
3
+
4
+ public function showResults($catId){
5
+ $url = Mage::getModel("catalog/category")->load($catId)->getUrl();
6
+ Mage::app()->getFrontController()->getResponse()->setRedirect($url);
7
+ }
8
+ public function getTonerConfiguratorTitles(){
9
+ $titles = Mage::getStoreConfig( 'tonerconfigurator/options/titles' );
10
+ return $titles;
11
+ }
12
+ public function isRootCategory($catid){
13
+ return $catid == $this->getRootCat();
14
+ }
15
+ public function getRootSubcatColl(){
16
+ static $col;
17
+ if(!$col){
18
+ $col = Mage::getModel('catalog/category')->getCollection();
19
+ $col->addAttributeToSelect('*');
20
+ $col->addFieldToFilter('parent_id', $this->getRootCat());
21
+ $col->addAttributeToSort('name', 'ASC');
22
+ }
23
+ return $col;
24
+ }
25
+ public function getRootCat(){
26
+ static $rootCat;
27
+ if(!$rootCat){
28
+ $rootCat = Mage::getStoreConfig("tonerconfigurator/options/root_id");
29
+ }
30
+ return $rootCat;
31
+ }
32
+ }
33
+
34
+ ?>
app/code/local/Sinch/Tonerconfigurator/controllers/AjaxController.php CHANGED
@@ -1,38 +1,38 @@
1
- <?php
2
- class Sinch_Tonerconfigurator_AjaxController extends Mage_Core_Controller_Front_Action
3
- {
4
- public function loadDropdownAction(){
5
- $this->getResponse()->setHeader('Content-type', 'application/json');
6
- $catid = $this->getRequest()->getParam('catid', null);
7
- $lastlevel = $this->getRequest()->getParam('lastlevel', 0);
8
- if(!$catid){
9
- $this->getResponse()->setBody('{ "success": false, "subcategories": [] }');
10
- return;
11
- }
12
- $category = Mage::getModel('catalog/category')->load($catid);
13
- if(!$category->hasChildren()){
14
- $this->getResponse()->setBody('{ "success": false, "subcategories": [] }');
15
- return;
16
- }
17
- $children = (Mage::getSingleton('tonerconfigurator/category')->isRootCategory($catid) ? Mage::getSingleton('tonerconfigurator/category')->getRootSubcatColl() : $category->getChildrenCategories());
18
- $response = array();
19
- $response['success'] = false;
20
- $response['subcategories'] = array();
21
- foreach($children as $child){
22
- $childArray = array();
23
- $childArray['name'] = $child->getName();
24
- if($lastlevel){
25
- $childArray['URL'] = $child->getUrl();
26
- }else {
27
- $childArray['id'] = $child->getId();
28
- }
29
- $response['subcategories'][] = $childArray;
30
- }
31
- if(!empty($response['subcategories'])){
32
- $response['success'] = true;
33
- }
34
- $this->getResponse()->setBody(json_encode($response));
35
- return;
36
- }
37
- }
38
- ?>
1
+ <?php
2
+ class Sinch_Tonerconfigurator_AjaxController extends Mage_Core_Controller_Front_Action
3
+ {
4
+ public function loadDropdownAction(){
5
+ $this->getResponse()->setHeader('Content-type', 'application/json');
6
+ $catid = $this->getRequest()->getParam('catid', null);
7
+ $lastlevel = $this->getRequest()->getParam('lastlevel', 0);
8
+ if(!$catid){
9
+ $this->getResponse()->setBody('{ "success": false, "subcategories": [] }');
10
+ return;
11
+ }
12
+ $category = Mage::getModel('catalog/category')->load($catid);
13
+ if(!$category->hasChildren()){
14
+ $this->getResponse()->setBody('{ "success": false, "subcategories": [] }');
15
+ return;
16
+ }
17
+ $children = (Mage::getSingleton('tonerconfigurator/category')->isRootCategory($catid) ? Mage::getSingleton('tonerconfigurator/category')->getRootSubcatColl() : $category->getChildrenCategories());
18
+ $response = array();
19
+ $response['success'] = false;
20
+ $response['subcategories'] = array();
21
+ foreach($children as $child){
22
+ $childArray = array();
23
+ $childArray['name'] = $child->getName();
24
+ if($lastlevel){
25
+ $childArray['URL'] = $child->getUrl();
26
+ }else {
27
+ $childArray['id'] = $child->getId();
28
+ }
29
+ $response['subcategories'][] = $childArray;
30
+ }
31
+ if(!empty($response['subcategories'])){
32
+ $response['success'] = true;
33
+ }
34
+ $this->getResponse()->setBody(json_encode($response));
35
+ return;
36
+ }
37
+ }
38
+ ?>
app/code/local/Sinch/Tonerconfigurator/etc/config.xml CHANGED
@@ -1,55 +1,72 @@
1
- <?xml version="1.0"?>
2
- <config>
3
- <modules>
4
- <Sinch_Tonerconfigurator>
5
- <version>1.2.3</version>
6
- </Sinch_Tonerconfigurator>
7
- </modules>
8
-
9
- <frontend>
10
- <routers>
11
- <tonerconfigurator>
12
- <use>standard</use>
13
- <args>
14
- <module>Sinch_Tonerconfigurator</module>
15
- <frontName>tonerconfigurator</frontName>
16
- </args>
17
- </tonerconfigurator>
18
- </routers>
19
- </frontend>
20
- <global>
21
- <blocks>
22
- <tonerconfigurator>
23
- <class>Sinch_Tonerconfigurator_Block</class>
24
- </tonerconfigurator>
25
- </blocks>
26
- <helpers>
27
- <tonerconfigurator>
28
- <class>Sinch_Tonerconfigurator_Helper</class>
29
- </tonerconfigurator>
30
- <catalog>
31
- <rewrite>
32
- <category>Sinch_Tonerconfigurator_Helper_Category</category>
33
- </rewrite>
34
- </catalog>
35
- </helpers>
36
- <models>
37
- <tonerconfigurator>
38
- <class>Sinch_Tonerconfigurator_Model</class>
39
- </tonerconfigurator>
40
- </models>
41
- </global>
42
- <default>
43
- <tonerconfigurator>
44
- <options>
45
- <root_id>4</root_id>
46
- <titles>
47
- <title1>Printer Make</title1>
48
- <title2>Printer Family</title2>
49
- <title3>Printer Model</title3>
50
- </titles>
51
- <category_depth>2</category_depth>
52
- </options>
53
- </tonerconfigurator>
54
- </default>
55
- </config>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Sinch_Tonerconfigurator>
5
+ <version>1.2.4</version>
6
+ </Sinch_Tonerconfigurator>
7
+ </modules>
8
+
9
+ <frontend>
10
+ <routers>
11
+ <tonerconfigurator>
12
+ <use>standard</use>
13
+ <args>
14
+ <module>Sinch_Tonerconfigurator</module>
15
+ <frontName>tonerconfigurator</frontName>
16
+ </args>
17
+ </tonerconfigurator>
18
+ </routers>
19
+ </frontend>
20
+
21
+ <global>
22
+ <blocks>
23
+ <tonerconfigurator>
24
+ <class>Sinch_Tonerconfigurator_Block</class>
25
+ </tonerconfigurator>
26
+ </blocks>
27
+ <helpers>
28
+ <tonerconfigurator>
29
+ <class>Sinch_Tonerconfigurator_Helper</class>
30
+ </tonerconfigurator>
31
+ <catalog>
32
+ <rewrite>
33
+ <category>Sinch_Tonerconfigurator_Helper_Category</category>
34
+ </rewrite>
35
+ </catalog>
36
+ </helpers>
37
+ <models>
38
+ <tonerconfigurator>
39
+ <class>Sinch_Tonerconfigurator_Model</class>
40
+ <resourceModel>tonerconfigurator_mysql4</resourceModel>
41
+ </tonerconfigurator>
42
+ <tonerconfigurator_mysql4>
43
+ <class>Sinch_Tonerconfigurator_Model_Mysql4</class>
44
+ </tonerconfigurator_mysql4>
45
+ </models>
46
+ <resources>
47
+ <tonerconfigurator_write>
48
+ <connection>
49
+ <use>core_write</use>
50
+ </connection>
51
+ </tonerconfigurator_write>
52
+ <tonerconfigurator_read>
53
+ <connection>
54
+ <use>core_read</use>
55
+ </connection>
56
+ </tonerconfigurator_read>
57
+ </resources>
58
+ </global>
59
+ <default>
60
+ <tonerconfigurator>
61
+ <options>
62
+ <root_id>4</root_id>
63
+ <titles>
64
+ <title1>Printer Make</title1>
65
+ <title2>Printer Family</title2>
66
+ <title3>Printer Model</title3>
67
+ </titles>
68
+ <category_depth>2</category_depth>
69
+ </options>
70
+ </tonerconfigurator>
71
+ </default>
72
+ </config>
app/code/local/Sinch/Tonerconfigurator/etc/widget.xml CHANGED
@@ -1,76 +1,76 @@
1
- <?xml version="1.0"?>
2
- <widgets>
3
- <tonerconfigurator_configurator type="tonerconfigurator/configurator">
4
- <name>StockInTheChannel - Toner Configurator</name>
5
- <description type="desc">Adds the StockInTheChannel Toner Configurator - Coded By Sinch</description>
6
- <parameters>
7
- <title translate="label">
8
- <label>Title</label>
9
- <visible>1</visible>
10
- <required>1</required>
11
- <type>text</type>
12
- <value>Toner Configurator</value>
13
- </title>
14
- <styling translate="label">
15
- <label>Style</label>
16
- <visible>1</visible>
17
- <required>1</required>
18
- <type>select</type>
19
- <values translate="label">
20
- <main>
21
- <label>Default Style</label>
22
- <value>default</value>
23
- </main>
24
- <default_noback translate="label">
25
- <label>Default - No Background (White Text and Borders)</label>
26
- <value>default-noback</value>
27
- </default_noback>
28
- <inline translate="label">
29
- <label>Inline</label>
30
- <value>inline</value>
31
- </inline>
32
- <inline_noback translate="label">
33
- <label>Inline - No Background</label>
34
- <value>inline-noback</value>
35
- </inline_noback>
36
- <custom translate="label">
37
- <label>Custom (Empty By Default)</label>
38
- <value>custom</value>
39
- </custom>
40
- </values>
41
- </styling>
42
- <button_based translate="label">
43
- <label>Use Button to Submit</label>
44
- <visible>1</visible>
45
- <required>1</required>
46
- <type>select</type>
47
- <values translate="label">
48
- <yes>
49
- <label>Yes</label>
50
- <value>1</value>
51
- </yes>
52
- <no>
53
- <label>No</label>
54
- <value>0</value>
55
- </no>
56
- </values>
57
- </button_based>
58
- <search_text translate="label">
59
- <label>Search Text</label>
60
- <comment>The Text Used on the Search Button (if it exists)</comment>
61
- <visible>1</visible>
62
- <required>1</required>
63
- <type>text</type>
64
- <value>Search</value>
65
- </search_text>
66
- <loading_text translate="label">
67
- <label>Loading Text</label>
68
- <comment>The Text Used During AJAX Load</comment>
69
- <visible>1</visible>
70
- <required>1</required>
71
- <type>text</type>
72
- <value>Loading Category Information...</value>
73
- </loading_text>
74
- </parameters>
75
- </tonerconfigurator_configurator>
76
  </widgets>
1
+ <?xml version="1.0"?>
2
+ <widgets>
3
+ <tonerconfigurator_configurator type="tonerconfigurator/configurator">
4
+ <name>StockInTheChannel - Toner Configurator</name>
5
+ <description type="desc">Adds the StockInTheChannel Toner Configurator - Coded By Sinch</description>
6
+ <parameters>
7
+ <title translate="label">
8
+ <label>Title</label>
9
+ <visible>1</visible>
10
+ <required>1</required>
11
+ <type>text</type>
12
+ <value>Toner Configurator</value>
13
+ </title>
14
+ <styling translate="label">
15
+ <label>Style</label>
16
+ <visible>1</visible>
17
+ <required>1</required>
18
+ <type>select</type>
19
+ <values translate="label">
20
+ <main>
21
+ <label>Default Style</label>
22
+ <value>default</value>
23
+ </main>
24
+ <default_noback translate="label">
25
+ <label>Default - No Background (White Text and Borders)</label>
26
+ <value>default-noback</value>
27
+ </default_noback>
28
+ <inline translate="label">
29
+ <label>Inline</label>
30
+ <value>inline</value>
31
+ </inline>
32
+ <inline_noback translate="label">
33
+ <label>Inline - No Background</label>
34
+ <value>inline-noback</value>
35
+ </inline_noback>
36
+ <custom translate="label">
37
+ <label>Custom (Empty By Default)</label>
38
+ <value>custom</value>
39
+ </custom>
40
+ </values>
41
+ </styling>
42
+ <button_based translate="label">
43
+ <label>Use Button to Submit</label>
44
+ <visible>1</visible>
45
+ <required>1</required>
46
+ <type>select</type>
47
+ <values translate="label">
48
+ <yes>
49
+ <label>Yes</label>
50
+ <value>1</value>
51
+ </yes>
52
+ <no>
53
+ <label>No</label>
54
+ <value>0</value>
55
+ </no>
56
+ </values>
57
+ </button_based>
58
+ <search_text translate="label">
59
+ <label>Search Text</label>
60
+ <comment>The Text Used on the Search Button (if it exists)</comment>
61
+ <visible>1</visible>
62
+ <required>1</required>
63
+ <type>text</type>
64
+ <value>Search</value>
65
+ </search_text>
66
+ <loading_text translate="label">
67
+ <label>Loading Text</label>
68
+ <comment>The Text Used During AJAX Load</comment>
69
+ <visible>1</visible>
70
+ <required>1</required>
71
+ <type>text</type>
72
+ <value>Loading Category Information...</value>
73
+ </loading_text>
74
+ </parameters>
75
+ </tonerconfigurator_configurator>
76
  </widgets>
app/design/frontend/{default → base}/default/layout/tonerconfigurator.xml RENAMED
@@ -1,10 +1,10 @@
1
- <?xml version="1.0"?>
2
- <layout version="0.1.0">
3
- <default>
4
- </default>
5
- <!--<tonerconfigurator_index_index>
6
- <block type="tonerconfigurator/configurator" name="root">
7
- <action method="setConfiguratorTemplate"><template>tonerconfigurator/configurator.phtml</template><type>configurator</type></action>
8
- </block>
9
- </tonerconfigurator_index_index>-->
10
- </layout>
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <default>
4
+ </default>
5
+ <!--<tonerconfigurator_index_index>
6
+ <block type="tonerconfigurator/configurator" name="root">
7
+ <action method="setConfiguratorTemplate"><template>tonerconfigurator/configurator.phtml</template><type>configurator</type></action>
8
+ </block>
9
+ </tonerconfigurator_index_index>-->
10
+ </layout>
app/design/frontend/{default → base}/default/template/tonerconfigurator/configurator.phtml RENAMED
@@ -1,15 +1,15 @@
1
- <link href="<?php echo $this->getSkinUrl('css/tonerconfigurator/' . $this->getData('styling') . '.css', array('_use_rewrite' => true)); ?>" rel="stylesheet">
2
- <?php require_once('configuratorscript.phtml'); ?>
3
- <div class="toner-configurator">
4
- <div class="block-title">
5
- <strong><span><?php echo $this->getData('title') ?></span></strong>
6
- </div>
7
- <div class="loadingmask" style="display: none;">
8
- <div class="loader"><div class="spinner"></div><br /><span><?php echo $this->getData('loading_text'); ?></span></div>
9
- </div>
10
- <div class="block-content">
11
- <div class="configurator-dropdowns-div">
12
- <?php require('configuratordropdowns.phtml'); ?>
13
- </div>
14
- </div>
15
  </div>
1
+ <link href="<?php echo $this->getSkinUrl('css/tonerconfigurator/' . $this->getData('styling') . '.css', array('_use_rewrite' => true)); ?>" rel="stylesheet">
2
+ <?php require_once('configuratorscript.phtml'); ?>
3
+ <div class="toner-configurator">
4
+ <div class="block-title">
5
+ <strong><span><?php echo $this->getData('title') ?></span></strong>
6
+ </div>
7
+ <div class="loadingmask" style="display: none;">
8
+ <div class="loader"><div class="spinner"></div><br /><span><?php echo $this->getData('loading_text'); ?></span></div>
9
+ </div>
10
+ <div class="block-content">
11
+ <div class="configurator-dropdowns-div">
12
+ <?php require('configuratordropdowns.phtml'); ?>
13
+ </div>
14
+ </div>
15
  </div>
app/design/frontend/{default → base}/default/template/tonerconfigurator/configuratordropdowns.phtml RENAMED
@@ -1,16 +1,16 @@
1
- <?php
2
- $size = Mage::getStoreConfig("tonerconfigurator/options/category_depth")+1;
3
- ?>
4
- <ul class="configurator-categories">
5
- <?php for($level = 1; $level <= $size; $level++): ?>
6
- <li class="toner-li-<?php echo $level ?>">
7
- <select class="toner-select-<?php echo $level ?>" <?php if(($level == $size) && ($this->getData('button_based')==1)){ echo "onchange=\"changeLastLevel(this.value, $(this).up('.toner-configurator'))\""; } else { echo "onchange=\"changeCategory(" . $level . ", this.value, $(this).up('.toner-configurator'))\""; } ?>> <?php if (isset($this->TonerConfiguratorTitles['title'.($level)])):?>
8
- <option value=""><?php echo $this->TonerConfiguratorTitles['title'.$level]?></option>
9
- <?php endif; ?>
10
- </select>
11
- </li>
12
- <?php endfor; ?>
13
- </ul>
14
- <?php if($this->getData('button_based')==1): ?>
15
- <button type="button" class="toner-button-submit" disabled onclick="changeCategory(<?php echo $size ?>, $(this).up('.toner-configurator').getElementsByClassName('toner-select-<?php echo $size ?>')[0].options[$(this).up('.toner-configurator').getElementsByClassName('toner-select-<?php echo $size ?>')[0].selectedIndex].value, $(this).up('.toner-configurator'))"><?php echo($this->getData('search_text')) ?></button>
16
  <?php endif;?>
1
+ <?php
2
+ $size = Mage::getStoreConfig("tonerconfigurator/options/category_depth")+1;
3
+ ?>
4
+ <ul class="configurator-categories">
5
+ <?php for($level = 1; $level <= $size; $level++): ?>
6
+ <li class="toner-li-<?php echo $level ?>">
7
+ <select class="toner-select-<?php echo $level ?>" <?php if(($level == $size) && ($this->getData('button_based')==1)){ echo "onchange=\"changeLastLevel(this.value, $(this).up('.toner-configurator'))\""; } else { echo "onchange=\"changeCategory(" . $level . ", this.options[this.selectedIndex], $(this).up('.toner-configurator'))\""; } ?>> <?php if (isset($this->TonerConfiguratorTitles['title'.($level)])):?>
8
+ <option value=""><?php echo $this->TonerConfiguratorTitles['title'.$level]?></option>
9
+ <?php endif; ?>
10
+ </select>
11
+ </li>
12
+ <?php endfor; ?>
13
+ </ul>
14
+ <?php if($this->getData('button_based')==1): ?>
15
+ <button type="button" class="toner-button-submit" disabled onclick="changeCategory(<?php echo $size ?>, $(this).up('.toner-configurator').getElementsByClassName('toner-select-<?php echo $size ?>')[0].options[$(this).up('.toner-configurator').getElementsByClassName('toner-select-<?php echo $size ?>')[0].selectedIndex], $(this).up('.toner-configurator'))"><?php echo($this->getData('search_text')) ?></button>
16
  <?php endif;?>
app/design/frontend/{default → base}/default/template/tonerconfigurator/configuratorscript.phtml RENAMED
@@ -1,118 +1,123 @@
1
- <script src="<?php echo $this->getSkinUrl('js/tonerconfigurator/spin.js', array('_use_rewrite' => true)); ?>" type="text/javascript"></script>
2
- <script>
3
- window.maxtonerlevel = <?php echo $this->getMaxLevel() ?>;
4
- function changeCategory(level, val, configurator){
5
- if(val == null || val == "")return;
6
- var reloadurl = '<?php echo $this->getUrl('tonerconfigurator/ajax/loadDropdown') ?>';
7
- if(maxtonerlevel == level){
8
- window.location.href = val;
9
- loadMask(true, configurator);
10
- return;
11
- }
12
- loadMask(true, configurator);
13
- var inputs = configurator.getElementsByTagName('select');
14
- for (var i = 0; i < inputs.length; i++) {
15
- inputs[i].disabled = true;
16
- }
17
- var newLevel = level+1;
18
- reloadurl += 'catid/'+val;
19
- if(newLevel == maxtonerlevel){
20
- reloadurl += '/lastlevel/1';
21
- }
22
- new Ajax.Request(reloadurl, {
23
- method: 'get',
24
- parameters: '',
25
- onComplete: function(transport){
26
- var newCategories = transport.responseJSON;
27
- if(!newCategories || !newCategories.success)alert("Somthing Went Wrong");
28
- for(var i = level; i < maxtonerlevel; i++){
29
- var a = configurator.getElementsByTagName('select')[i];
30
- for(var j = 0; j < a.options.length; j++){
31
- a.remove(j);
32
- }
33
- var o = document.createElement('option');
34
- o.text = a.getAttribute('data-tonertitle'); //Implicitly sets label as well
35
- o.selected = true;
36
- a.add(o, null); //Null param is for pre-HTML5 and pre-gecko7 support
37
- }
38
- var modifiedSelect = configurator.getElementsByTagName('select')[level];
39
- for(var i = 0; i < newCategories.subcategories.length; i++){
40
- var data = ((newCategories.subcategories[i].id == null) ? newCategories.subcategories[i].URL : newCategories.subcategories[i].id);
41
- var o = document.createElement('option');
42
- o.text = newCategories.subcategories[i].name;
43
- o.value = data;
44
- modifiedSelect.add(o, null);
45
- }
46
- var inputs = configurator.getElementsByTagName('select');
47
- for (var i = 0; i < newLevel; i++) {
48
- inputs[i].disabled = false;
49
- }
50
- <?php if($this->getData('button_based')==1): ?>
51
- var toner_b = configurator.getElementsByClassName('toner-button-submit')[0];
52
- if((newLevel != window.maxtonerlevel) && (toner_b.disabled == false)){
53
- toner_b.disabled = true;
54
- } else if(newLevel == window.maxtonerlevel){
55
- toner_b.disabled = true;
56
- }
57
- <?php endif; ?>
58
- loadMask(false, configurator);
59
- },
60
- onTimeout: function() { alert('Timeout!'); },
61
- onFailure: function() { alert('Something went wrong...') },
62
- });
63
- }
64
- <?php if($this->getData('button_based')==1): ?>
65
- function changeLastLevel(option, configurator){
66
- var toner_b = configurator.getElementsByClassName('toner-button-submit')[0];
67
- if(option == "" && !(toner_b.disabled)){
68
- toner_b.disabled = true;
69
- } else if(option != "" && toner_b.disabled){
70
- toner_b.disabled = false;
71
- }
72
- }
73
- <?php endif; ?>
74
-
75
- function loadMask(show, configurator){
76
- var a = configurator.getElementsByClassName('loadingmask')[0];
77
- if(show){
78
- a.style.display = 'block';
79
- a.style.visibility = 'visible';
80
- } else {
81
- a.style.display = 'none';
82
- a.style.visibility = 'hidden';
83
- }
84
- }
85
-
86
- Event.observe(window,"load", function(){
87
- var opts = {
88
- lines: 17, // The number of lines to draw
89
- length: 5, // The length of each line
90
- width: 2, // The line thickness
91
- radius: 7, // The radius of the inner circle
92
- corners: 1, // Corner roundness (0..1)
93
- rotate: 0, // The rotation offset
94
- direction: 1, // 1: clockwise, -1: counterclockwise
95
- color: '#000', // #rgb or #rrggbb
96
- speed: 1.2, // Rounds per second
97
- trail: 66, // Afterglow percentage
98
- shadow: false, // Whether to render a shadow
99
- hwaccel: true, // Whether to use hardware acceleration
100
- className: 'aspinner', // The CSS class to assign to the spinner
101
- zIndex: 2e9, // The z-index (defaults to 2000000000)
102
- top: 'auto', // Top position relative to parent in px
103
- left: 'auto' // Left position relative to parent in px
104
- };
105
- var spinners = document.getElementsByClassName('spinner');
106
- for(var i = 0; i < spinners.length; i++){
107
- var spinner = new Spinner(opts).spin(spinners[i]);
108
- }
109
- var configurators = document.getElementsByClassName('toner-configurator');
110
- for(var i = 0; i < configurators.length; i++){
111
- var selects = configurators[i].getElementsByTagName('select');
112
- for(var j = 0; j < selects.length; j++){
113
- selects[j].setAttribute("data-tonertitle", selects[j].options[0].text);
114
- }
115
- changeCategory(0, <?php echo $this->getRootCat(); ?>, configurators[i]);
116
- }
117
- });
 
 
 
 
 
118
  </script>
1
+ <script src="<?php echo $this->getSkinUrl('js/tonerconfigurator/spin.js', array('_use_rewrite' => true)); ?>" type="text/javascript"></script>
2
+ <script>
3
+ window.maxtonerlevel = <?php echo $this->getMaxLevel() ?>;
4
+ function changeCategory(level, val, configurator){
5
+ if(!val.hasAttribute('value'))return;
6
+ var reloadurl = '<?php echo $this->getUrl('tonerconfigurator/ajax/loadDropdown') ?>';
7
+ if(val.value.indexOf('/') != -1){
8
+ window.location.href = val.value;
9
+ loadMask(true, configurator);
10
+ return;
11
+ }
12
+ loadMask(true, configurator);
13
+ var inputs = configurator.getElementsByTagName('select');
14
+ for (var i = 0; i < inputs.length; i++) {
15
+ inputs[i].disabled = true;
16
+ }
17
+ var newLevel = level+1;
18
+ reloadurl += 'catid/'+val.value;
19
+ if(newLevel == maxtonerlevel){
20
+ reloadurl += '/lastlevel/1';
21
+ }
22
+ new Ajax.Request(reloadurl, {
23
+ method: 'get',
24
+ parameters: '',
25
+ onComplete: function(transport){
26
+ var newCategories = transport.responseJSON;
27
+ if(!newCategories || !newCategories.success){
28
+ console.log("Received an invalid or non-success response from the Tonerconfigurator AJAX request");
29
+ return;
30
+ }
31
+ for(var i = level; i < maxtonerlevel; i++){
32
+ var a = configurator.getElementsByTagName('select')[i];
33
+ for(var j = a.options.length - 1; j >= 0; j--){ //Remove backwards otherwise the indexes shift too fast/too slow depending on how you look at it
34
+ a.remove(j);
35
+ }
36
+ var o = document.createElement('option');
37
+ o.text = a.getAttribute('data-tonertitle'); //Implicitly sets label as well
38
+ o.selected = true;
39
+ a.add(o, null); //Null param is for pre-HTML5 and pre-gecko7 support
40
+ }
41
+ var modifiedSelect = configurator.getElementsByTagName('select')[level];
42
+ for(var i = 0; i < newCategories.subcategories.length; i++){
43
+ var data = ((newCategories.subcategories[i].id == null) ? newCategories.subcategories[i].URL : newCategories.subcategories[i].id);
44
+ var o = document.createElement('option');
45
+ o.text = newCategories.subcategories[i].name;
46
+ o.value = data;
47
+ modifiedSelect.add(o, null);
48
+ }
49
+ var inputs = configurator.getElementsByTagName('select');
50
+ for (var i = 0; i < newLevel; i++) {
51
+ inputs[i].disabled = false;
52
+ }
53
+ <?php if($this->getData('button_based')==1): ?>
54
+ var toner_b = configurator.getElementsByClassName('toner-button-submit')[0];
55
+ if((newLevel != window.maxtonerlevel) && (toner_b.disabled == false)){
56
+ toner_b.disabled = true;
57
+ } else if(newLevel == window.maxtonerlevel){
58
+ toner_b.disabled = true;
59
+ }
60
+ <?php endif; ?>
61
+ loadMask(false, configurator);
62
+ },
63
+ onTimeout: function() { console.log('Tonerconfigurator AJAX Timeout'); },
64
+ onFailure: function() { console.log('Tonerconfigurator AJAX Failure') }
65
+ });
66
+ }
67
+ <?php if($this->getData('button_based')==1): ?>
68
+ function changeLastLevel(option, configurator){
69
+ var toner_b = configurator.getElementsByClassName('toner-button-submit')[0];
70
+ if(option == "" && !(toner_b.disabled)){
71
+ toner_b.disabled = true;
72
+ } else if(option != "" && toner_b.disabled){
73
+ toner_b.disabled = false;
74
+ }
75
+ }
76
+ <?php endif; ?>
77
+
78
+ function loadMask(show, configurator){
79
+ var a = configurator.getElementsByClassName('loadingmask')[0];
80
+ if(show){
81
+ a.style.display = 'block';
82
+ a.style.visibility = 'visible';
83
+ } else {
84
+ a.style.display = 'none';
85
+ a.style.visibility = 'hidden';
86
+ }
87
+ }
88
+
89
+ Event.observe(window,"load", function(){
90
+ var opts = {
91
+ lines: 17, // The number of lines to draw
92
+ length: 5, // The length of each line
93
+ width: 2, // The line thickness
94
+ radius: 7, // The radius of the inner circle
95
+ corners: 1, // Corner roundness (0..1)
96
+ rotate: 0, // The rotation offset
97
+ direction: 1, // 1: clockwise, -1: counterclockwise
98
+ color: '#000', // #rgb or #rrggbb
99
+ speed: 1.2, // Rounds per second
100
+ trail: 66, // Afterglow percentage
101
+ shadow: false, // Whether to render a shadow
102
+ hwaccel: true, // Whether to use hardware acceleration
103
+ className: 'aspinner', // The CSS class to assign to the spinner
104
+ zIndex: 2e9, // The z-index (defaults to 2000000000)
105
+ top: 'auto', // Top position relative to parent in px
106
+ left: 'auto' // Left position relative to parent in px
107
+ };
108
+ var spinners = document.getElementsByClassName('spinner');
109
+ for(var i = 0; i < spinners.length; i++){
110
+ var spinner = new Spinner(opts).spin(spinners[i]);
111
+ }
112
+ var configurators = document.getElementsByClassName('toner-configurator');
113
+ for(var i = 0; i < configurators.length; i++){
114
+ var selects = configurators[i].getElementsByTagName('select');
115
+ for(var j = 0; j < selects.length; j++){
116
+ selects[j].setAttribute("data-tonertitle", selects[j].options[0].text);
117
+ }
118
+ var opt = document.createElement('option');
119
+ opt.setAttribute('value', <?php echo $this->getRootCat(); ?>);
120
+ changeCategory(0, opt, configurators[i]);
121
+ }
122
+ });
123
  </script>
app/etc/modules/Sinch_Tonerconfigurator.xml CHANGED
@@ -1,10 +1,10 @@
1
- <?xml version="1.0"?>
2
-
3
- <config>
4
- <modules>
5
- <Sinch_Tonerconfigurator>
6
- <active>true</active>
7
- <codePool>local</codePool>
8
- </Sinch_Tonerconfigurator>
9
- </modules>
10
- </config>
1
+ <?xml version="1.0"?>
2
+
3
+ <config>
4
+ <modules>
5
+ <Sinch_Tonerconfigurator>
6
+ <active>true</active>
7
+ <codePool>local</codePool>
8
+ </Sinch_Tonerconfigurator>
9
+ </modules>
10
+ </config>
package.xml CHANGED
@@ -1,19 +1,20 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Sinch_Tonerconfigurator</name>
4
- <version>1.2.3</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Stockinthechannel.com's Toner Configurator</summary>
10
  <description>Toner Configurator for use with Stockinthechannel.com's Toner Feed Export</description>
11
- <notes>Version 1.2.3:&#xD;
12
- * Fix Category 404's for non-default categories</notes>
 
13
  <authors><author><name>stockinchannel</name><user>stockinchannel</user><email>support@stockinthechannel.com</email></author><author><name>Nick Anstee</name><user>nicka101</user><email>nick@stockinthechannel.com</email></author></authors>
14
- <date>2014-01-07</date>
15
- <time>13:25:28</time>
16
- <contents><target name="magelocal"><dir name="Sinch"><dir name="Tonerconfigurator"><dir name="Block"><file name="Configurator.php" hash="aa540c9a2bbc7bbdbfa52bd996c40967"/><file name="Configuratordropdowns.php" hash="b71cd48c7afd90c1a85f3379875480c3"/></dir><dir name="Helper"><file name="Category.php" hash="4ae090a183e13b2b6f88669bcb7f00ef"/><file name="Data.php" hash="963744c7c85b3179d7a8287d253c17ac"/></dir><dir name="Model"><file name="Category.php" hash="fa7553d4c8b6d8f166d145f2ea0204f8"/></dir><dir name="controllers"><file name="AjaxController.php" hash="05ec5f6fc5cfb950ede11fff4a7f1d63"/></dir><dir name="etc"><file name="config.xml" hash="ba7ca4cf159f21a49c9f150e48632c07"/><file name="widget.xml" hash="6cd08f045ee8517d267d5d1c4e64990a"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Sinch_Tonerconfigurator.xml" hash="27db1fe889731da93159361df23dcd45"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="template"><dir name="tonerconfigurator"><file name="configurator.phtml" hash="8a8863f441cfb008fcb4c0e5673d35ca"/><file name="configuratordropdowns.phtml" hash="a3cf9439915387af3382c65b2422c765"/><file name="configuratorscript.phtml" hash="97c0906802690f04455b89b7ed530255"/></dir></dir><dir name="layout"><file name="tonerconfigurator.xml" hash="212a8975fa16dea8516740c013e352d1"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="css"><dir name="tonerconfigurator"><file name="custom.css" hash="d41d8cd98f00b204e9800998ecf8427e"/><file name="default-noback.css" hash="8cc8540b73809ad6d3e41fb263e6afb3"/><file name="default.css" hash="e4244af2f6e0c5341d30824d050fdd5b"/><file name="inline-noback.css" hash="089a41d0fdb9f61ce83c7af7c6766599"/><file name="inline.css" hash="c9586ceccebc9c928df0deaa96fbf31b"/></dir></dir><dir name="js"><dir name="tonerconfigurator"><file name="spin.js" hash="a0a33607d171b0b3a1935e45c6a96de9"/></dir></dir></dir></dir></dir></target></contents>
17
  <compatible/>
18
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
19
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Sinch_Tonerconfigurator</name>
4
+ <version>1.2.4</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Stockinthechannel.com's Toner Configurator</summary>
10
  <description>Toner Configurator for use with Stockinthechannel.com's Toner Feed Export</description>
11
+ <notes>Version 1.2.4:&#xD;
12
+ * Fix data change bug&#xD;
13
+ * Fix compatibility with themes that don't inherit from default/default</notes>
14
  <authors><author><name>stockinchannel</name><user>stockinchannel</user><email>support@stockinthechannel.com</email></author><author><name>Nick Anstee</name><user>nicka101</user><email>nick@stockinthechannel.com</email></author></authors>
15
+ <date>2014-09-04</date>
16
+ <time>12:53:43</time>
17
+ <contents><target name="magelocal"><dir name="Sinch"><dir name="Tonerconfigurator"><dir name="Block"><file name="Configurator.php" hash="a382b2c544ffec9b2faeccfbfa6ffae4"/><file name="Configuratordropdowns.php" hash="68c452cbe13fd7d9d026e02de3d13841"/></dir><dir name="Helper"><file name="Category.php" hash="2b5bb13b363a835e9a0e017fcc80924c"/><file name="Data.php" hash="be435611423863055377da4e6735b1bc"/></dir><dir name="Model"><file name="Category.php" hash="d52497433a47a126055a60f1243fec43"/></dir><dir name="controllers"><file name="AjaxController.php" hash="449b572f5276449f46eb529154dd085d"/></dir><dir name="etc"><file name="config.xml" hash="7045c80f23a42793266d259fe8020c54"/><file name="widget.xml" hash="b7c986d728390a52ca896c4e57a4b412"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Sinch_Tonerconfigurator.xml" hash="81f9dff948280c948016596cac095774"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="tonerconfigurator"><file name="configurator.phtml" hash="81e35f0a88858640116294edabae5dd2"/><file name="configuratordropdowns.phtml" hash="dff371d8c83e30ff334dc8a4a6f6783a"/><file name="configuratorscript.phtml" hash="14e143ceedd5a6676791519569cc817d"/></dir></dir><dir name="layout"><file name="tonerconfigurator.xml" hash="0ca3c170efd859ea25f891db0564d38c"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="tonerconfigurator"><file name="custom.css" hash="d41d8cd98f00b204e9800998ecf8427e"/><file name="default-noback.css" hash="8cc8540b73809ad6d3e41fb263e6afb3"/><file name="default.css" hash="e4244af2f6e0c5341d30824d050fdd5b"/><file name="inline-noback.css" hash="089a41d0fdb9f61ce83c7af7c6766599"/><file name="inline.css" hash="c9586ceccebc9c928df0deaa96fbf31b"/></dir></dir><dir name="js"><dir name="tonerconfigurator"><file name="spin.js" hash="aa8432b65b8253ea69b681a8b06bb297"/></dir></dir></dir></dir></dir></target></contents>
18
  <compatible/>
19
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
20
  </package>
skin/frontend/{default → base}/default/css/tonerconfigurator/custom.css RENAMED
File without changes
skin/frontend/{default → base}/default/css/tonerconfigurator/default-noback.css RENAMED
File without changes
skin/frontend/{default → base}/default/css/tonerconfigurator/default.css RENAMED
File without changes
skin/frontend/{default → base}/default/css/tonerconfigurator/inline-noback.css RENAMED
File without changes
skin/frontend/{default → base}/default/css/tonerconfigurator/inline.css RENAMED
File without changes
skin/frontend/{default → base}/default/js/tonerconfigurator/spin.js RENAMED
@@ -1 +1 @@
1
- (function(t,e){if(typeof exports=="object")module.exports=e();else if(typeof define=="function"&&define.amd)define(e);else t.Spinner=e()})(this,function(){"use strict";var t=["webkit","Moz","ms","O"],e={},i;function o(t,e){var i=document.createElement(t||"div"),o;for(o in e)i[o]=e[o];return i}function n(t){for(var e=1,i=arguments.length;e<i;e++)t.appendChild(arguments[e]);return t}var r=function(){var t=o("style",{type:"text/css"});n(document.getElementsByTagName("head")[0],t);return t.sheet||t.styleSheet}();function s(t,o,n,s){var a=["opacity",o,~~(t*100),n,s].join("-"),f=.01+n/s*100,l=Math.max(1-(1-t)/o*(100-f),t),d=i.substring(0,i.indexOf("Animation")).toLowerCase(),u=d&&"-"+d+"-"||"";if(!e[a]){r.insertRule("@"+u+"keyframes "+a+"{"+"0%{opacity:"+l+"}"+f+"%{opacity:"+t+"}"+(f+.01)+"%{opacity:1}"+(f+o)%100+"%{opacity:"+t+"}"+"100%{opacity:"+l+"}"+"}",r.cssRules.length);e[a]=1}return a}function a(e,i){var o=e.style,n,r;if(o[i]!==undefined)return i;i=i.charAt(0).toUpperCase()+i.slice(1);for(r=0;r<t.length;r++){n=t[r]+i;if(o[n]!==undefined)return n}}function f(t,e){for(var i in e)t.style[a(t,i)||i]=e[i];return t}function l(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var o in i)if(t[o]===undefined)t[o]=i[o]}return t}function d(t){var e={x:t.offsetLeft,y:t.offsetTop};while(t=t.offsetParent)e.x+=t.offsetLeft,e.y+=t.offsetTop;return e}var u={lines:12,length:7,width:5,radius:10,rotate:0,corners:1,color:"#000",direction:1,speed:1,trail:100,opacity:1/4,fps:20,zIndex:2e9,className:"spinner",top:"auto",left:"auto",position:"relative"};function p(t){if(typeof this=="undefined")return new p(t);this.opts=l(t||{},p.defaults,u)}p.defaults={};l(p.prototype,{spin:function(t){this.stop();var e=this,n=e.opts,r=e.el=f(o(0,{className:n.className}),{position:n.position,width:0,zIndex:n.zIndex}),s=n.radius+n.length+n.width,a,l;if(t){t.insertBefore(r,t.firstChild||null);l=d(t);a=d(r);f(r,{left:(n.left=="auto"?l.x-a.x+(t.offsetWidth>>1):parseInt(n.left,10)+s)+"px",top:(n.top=="auto"?l.y-a.y+(t.offsetHeight>>1):parseInt(n.top,10)+s)+"px"})}r.setAttribute("role","progressbar");e.lines(r,e.opts);if(!i){var u=0,p=(n.lines-1)*(1-n.direction)/2,c,h=n.fps,m=h/n.speed,y=(1-n.opacity)/(m*n.trail/100),g=m/n.lines;(function v(){u++;for(var t=0;t<n.lines;t++){c=Math.max(1-(u+(n.lines-t)*g)%m*y,n.opacity);e.opacity(r,t*n.direction+p,c,n)}e.timeout=e.el&&setTimeout(v,~~(1e3/h))})()}return e},stop:function(){var t=this.el;if(t){clearTimeout(this.timeout);if(t.parentNode)t.parentNode.removeChild(t);this.el=undefined}return this},lines:function(t,e){var r=0,a=(e.lines-1)*(1-e.direction)/2,l;function d(t,i){return f(o(),{position:"absolute",width:e.length+e.width+"px",height:e.width+"px",background:t,boxShadow:i,transformOrigin:"left",transform:"rotate("+~~(360/e.lines*r+e.rotate)+"deg) translate("+e.radius+"px"+",0)",borderRadius:(e.corners*e.width>>1)+"px"})}for(;r<e.lines;r++){l=f(o(),{position:"absolute",top:1+~(e.width/2)+"px",transform:e.hwaccel?"translate3d(0,0,0)":"",opacity:e.opacity,animation:i&&s(e.opacity,e.trail,a+r*e.direction,e.lines)+" "+1/e.speed+"s linear infinite"});if(e.shadow)n(l,f(d("#000","0 0 4px "+"#000"),{top:2+"px"}));n(t,n(l,d(e.color,"0 0 1px rgba(0,0,0,.1)")))}return t},opacity:function(t,e,i){if(e<t.childNodes.length)t.childNodes[e].style.opacity=i}});function c(){function t(t,e){return o("<"+t+' xmlns="urn:schemas-microsoft.com:vml" class="spin-vml">',e)}r.addRule(".spin-vml","behavior:url(#default#VML)");p.prototype.lines=function(e,i){var o=i.length+i.width,r=2*o;function s(){return f(t("group",{coordsize:r+" "+r,coordorigin:-o+" "+-o}),{width:r,height:r})}var a=-(i.width+i.length)*2+"px",l=f(s(),{position:"absolute",top:a,left:a}),d;function u(e,r,a){n(l,n(f(s(),{rotation:360/i.lines*e+"deg",left:~~r}),n(f(t("roundrect",{arcsize:i.corners}),{width:o,height:i.width,left:i.radius,top:-i.width>>1,filter:a}),t("fill",{color:i.color,opacity:i.opacity}),t("stroke",{opacity:0}))))}if(i.shadow)for(d=1;d<=i.lines;d++)u(d,-2,"progid:DXImageTransform.Microsoft.Blur(pixelradius=2,makeshadow=1,shadowopacity=.3)");for(d=1;d<=i.lines;d++)u(d);return n(e,l)};p.prototype.opacity=function(t,e,i,o){var n=t.firstChild;o=o.shadow&&o.lines||0;if(n&&e+o<n.childNodes.length){n=n.childNodes[e+o];n=n&&n.firstChild;n=n&&n.firstChild;if(n)n.opacity=i}}}var h=f(o("group"),{behavior:"url(#default#VML)"});if(!a(h,"transform")&&h.adj)c();else i=a(h,"animation");return p});
1
+ (function(t,e){if(typeof exports=="object")module.exports=e();else if(typeof define=="function"&&define.amd)define(e);else t.Spinner=e()})(this,function(){"use strict";var t=["webkit","Moz","ms","O"],e={},i;function o(t,e){var i=document.createElement(t||"div"),o;for(o in e)i[o]=e[o];return i}function n(t){for(var e=1,i=arguments.length;e<i;e++)t.appendChild(arguments[e]);return t}var r=function(){var t=o("style",{type:"text/css"});n(document.getElementsByTagName("head")[0],t);return t.sheet||t.styleSheet}();function s(t,o,n,s){var a=["opacity",o,~~(t*100),n,s].join("-"),f=.01+n/s*100,l=Math.max(1-(1-t)/o*(100-f),t),d=i.substring(0,i.indexOf("Animation")).toLowerCase(),u=d&&"-"+d+"-"||"";if(!e[a]){r.insertRule("@"+u+"keyframes "+a+"{"+"0%{opacity:"+l+"}"+f+"%{opacity:"+t+"}"+(f+.01)+"%{opacity:1}"+(f+o)%100+"%{opacity:"+t+"}"+"100%{opacity:"+l+"}"+"}",r.cssRules.length);e[a]=1}return a}function a(e,i){var o=e.style,n,r;if(o[i]!==undefined)return i;i=i.charAt(0).toUpperCase()+i.slice(1);for(r=0;r<t.length;r++){n=t[r]+i;if(o[n]!==undefined)return n}}function f(t,e){for(var i in e)t.style[a(t,i)||i]=e[i];return t}function l(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var o in i)if(t[o]===undefined)t[o]=i[o]}return t}function d(t){var e={x:t.offsetLeft,y:t.offsetTop};while(t=t.offsetParent)e.x+=t.offsetLeft,e.y+=t.offsetTop;return e}var u={lines:12,length:7,width:5,radius:10,rotate:0,corners:1,color:"#000",direction:1,speed:1,trail:100,opacity:1/4,fps:20,zIndex:2e9,className:"spinner",top:"auto",left:"auto",position:"relative"};function p(t){if(typeof this=="undefined")return new p(t);this.opts=l(t||{},p.defaults,u)}p.defaults={};l(p.prototype,{spin:function(t){this.stop();var e=this,n=e.opts,r=e.el=f(o(0,{className:n.className}),{position:n.position,width:0,zIndex:n.zIndex}),s=n.radius+n.length+n.width,a,l;if(t){t.insertBefore(r,t.firstChild||null);l=d(t);a=d(r);f(r,{left:(n.left=="auto"?l.x-a.x+(t.offsetWidth>>1):parseInt(n.left,10)+s)+"px",top:(n.top=="auto"?l.y-a.y+(t.offsetHeight>>1):parseInt(n.top,10)+s)+"px"})}r.setAttribute("role","progressbar");e.lines(r,e.opts);if(!i){var u=0,p=(n.lines-1)*(1-n.direction)/2,c,h=n.fps,m=h/n.speed,y=(1-n.opacity)/(m*n.trail/100),g=m/n.lines;(function v(){u++;for(var t=0;t<n.lines;t++){c=Math.max(1-(u+(n.lines-t)*g)%m*y,n.opacity);e.opacity(r,t*n.direction+p,c,n)}e.timeout=e.el&&setTimeout(v,~~(1e3/h))})()}return e},stop:function(){var t=this.el;if(t){clearTimeout(this.timeout);if(t.parentNode)t.parentNode.removeChild(t);this.el=undefined}return this},lines:function(t,e){var r=0,a=(e.lines-1)*(1-e.direction)/2,l;function d(t,i){return f(o(),{position:"absolute",width:e.length+e.width+"px",height:e.width+"px",background:t,boxShadow:i,transformOrigin:"left",transform:"rotate("+~~(360/e.lines*r+e.rotate)+"deg) translate("+e.radius+"px"+",0)",borderRadius:(e.corners*e.width>>1)+"px"})}for(;r<e.lines;r++){l=f(o(),{position:"absolute",top:1+~(e.width/2)+"px",transform:e.hwaccel?"translate3d(0,0,0)":"",opacity:e.opacity,animation:i&&s(e.opacity,e.trail,a+r*e.direction,e.lines)+" "+1/e.speed+"s linear infinite"});if(e.shadow)n(l,f(d("#000","0 0 4px "+"#000"),{top:2+"px"}));n(t,n(l,d(e.color,"0 0 1px rgba(0,0,0,.1)")))}return t},opacity:function(t,e,i){if(e<t.childNodes.length)t.childNodes[e].style.opacity=i}});function c(){function t(t,e){return o("<"+t+' xmlns="urn:schemas-microsoft.com:vml" class="spin-vml">',e)}r.addRule(".spin-vml","behavior:url(#default#VML)");p.prototype.lines=function(e,i){var o=i.length+i.width,r=2*o;function s(){return f(t("group",{coordsize:r+" "+r,coordorigin:-o+" "+-o}),{width:r,height:r})}var a=-(i.width+i.length)*2+"px",l=f(s(),{position:"absolute",top:a,left:a}),d;function u(e,r,a){n(l,n(f(s(),{rotation:360/i.lines*e+"deg",left:~~r}),n(f(t("roundrect",{arcsize:i.corners}),{width:o,height:i.width,left:i.radius,top:-i.width>>1,filter:a}),t("fill",{color:i.color,opacity:i.opacity}),t("stroke",{opacity:0}))))}if(i.shadow)for(d=1;d<=i.lines;d++)u(d,-2,"progid:DXImageTransform.Microsoft.Blur(pixelradius=2,makeshadow=1,shadowopacity=.3)");for(d=1;d<=i.lines;d++)u(d);return n(e,l)};p.prototype.opacity=function(t,e,i,o){var n=t.firstChild;o=o.shadow&&o.lines||0;if(n&&e+o<n.childNodes.length){n=n.childNodes[e+o];n=n&&n.firstChild;n=n&&n.firstChild;if(n)n.opacity=i}}}var h=f(o("group"),{behavior:"url(#default#VML)"});if(!a(h,"transform")&&h.adj)c();else i=a(h,"animation");return p});