Completed
Push — master ( b6dd21...9691ed )
by Raúl
14s queued 11s
created

simulator.js ➔ findQuantitySelector   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 2
eloc 5
c 2
b 0
f 0
nc 2
dl 0
loc 8
rs 10
nop 0
1
/**
2
* This file is part of the official Paga+Tarde module for PrestaShop.
3
*
4
* @author    Paga+Tarde <[email protected]>
5
* @copyright 2015-2016 Paga+Tarde
6
* @license   proprietary
7
*/
8
function findPriceSelector()
9
{
10
    var priceDOM = document.getElementById("our_price_display");
11
    if (priceDOM != null) {
0 ignored issues
show
Best Practice introduced by
Comparing priceDOM to null using the != operator is not safe. Consider using !== instead.
Loading history...
12
        return '#our_price_display';
13
    } else {
0 ignored issues
show
Comprehensibility introduced by
else is not necessary here since all if branches return, consider removing it to reduce nesting and make code more readable.
Loading history...
14
        priceDOM = document.querySelector(".current-price span[itemprop=price]")
15
        if (priceDOM != null) {
16
            return ".current-price span[itemprop=price]";
17
        }
18
    }
19
20
    return 'default';
21
}
22
23
function findQuantitySelector()
24
{
25
    var quantityDOM = document.getElementById("quantity_wanted");
26
    if (quantityDOM != null) {
0 ignored issues
show
Best Practice introduced by
Comparing quantityDOM to null using the != operator is not safe. Consider using !== instead.
Loading history...
27
        return '#quantity_wanted';
28
    }
29
    return 'default';
30
}