1. Ben Bass
  2. piefull

Commits

Ben Bass  committed dc3798e

add selector parameter to main()

  • Participants
  • Parent commits 6737f61
  • Branches default

Comments (0)

Files changed (1)

File piefull.js

View file
  */
 
 var piefull = {
-    // default parameters
+    // default parameters.
+    selector: '.piefull',
     yescol: '#00F',
     nocol: '#0F0',
     size: 24,
     PERCENT_RE: /(-?\d+(?:\.\d*)?(?:e[+\-]?\d+)?)%?/i,
     START_ANGLE: (2 * Math.PI) * 0.75,
 
-    main: function(size, yescol, nocol) {
+    main: function(selector, size, yescol, nocol) {
         var that = this;
         if (typeof document.querySelectorAll === 'undefined') {
             // we don't serve your type here...
             return;
         }
+        var _selector = selector || this.selector;
         var _piesize = size || this.size;
         var _yescol = yescol || this.yescol;
         var _nocol = nocol || this.nocol;
             ctx.closePath();
         };
 
-        var pies = document.querySelectorAll('.piefull');
+        var pies = document.querySelectorAll(_selector);
         for (var i=0; i<pies.length; i++) {
             var pie = pies[i];