OLD | NEW |
1 function generatePolygon(width, height, fontSize, points, content, elementId) { | 1 function generatePolygon(width, height, fontSize, points, content, elementId) { |
2 if (window.internals) | |
3 window.internals.settings.setCSSExclusionsEnabled(true); | |
4 var div = createOrInsert(elementId); | 2 var div = createOrInsert(elementId); |
5 var polygon = points.map(function(elem, index, array) { | 3 var polygon = points.map(function(elem, index, array) { |
6 return elem.toString() + 'px' + (index < array.length - 1 && index % 2 =
= 1 ? ',' : ''); | 4 return elem.toString() + 'px' + (index < array.length - 1 && index % 2 =
= 1 ? ',' : ''); |
7 }).join(' '); | 5 }).join(' '); |
8 polygon = 'polygon(' + polygon + ')'; | 6 polygon = 'polygon(' + polygon + ')'; |
9 div.style.setProperty('-webkit-shape-inside', polygon); | 7 div.style.setProperty('-webkit-shape-inside', polygon); |
10 div.style.setProperty('width', width + 'px'); | 8 div.style.setProperty('width', width + 'px'); |
11 div.style.setProperty('height', height + 'px'); | 9 div.style.setProperty('height', height + 'px'); |
12 div.style.setProperty('font', fontSize + 'px/1 Ahem, sans-serif'); | 10 div.style.setProperty('font', fontSize + 'px/1 Ahem, sans-serif'); |
13 div.style.setProperty('color', 'green'); | 11 div.style.setProperty('color', 'green'); |
(...skipping 18 matching lines...) Expand all Loading... |
32 if (elementId) | 30 if (elementId) |
33 return document.getElementById(elementId); | 31 return document.getElementById(elementId); |
34 | 32 |
35 var div = document.createElement('div'); | 33 var div = document.createElement('div'); |
36 if (document.body.childNodes.length) | 34 if (document.body.childNodes.length) |
37 docuemnt.body.insertBefore(div, document.body.childNodes[0]); | 35 docuemnt.body.insertBefore(div, document.body.childNodes[0]); |
38 else | 36 else |
39 document.body.appendChild(div); | 37 document.body.appendChild(div); |
40 return div; | 38 return div; |
41 } | 39 } |
OLD | NEW |