Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1255)

Side by Side Diff: lib/src/prism/plugins/previewer-gradient/prism-previewer-gradient.min.js

Issue 1418513006: update elements and fix some bugs (Closed) Base URL: git@github.com:dart-lang/polymer_elements.git@master
Patch Set: code review updates Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 !function(){if(("undefined"==typeof self||self.Prism)&&("undefined"==typeof glob al||global.Prism)){var e={css:!0,less:!0,sass:[{lang:"sass",before:"punctuation" ,inside:"inside",root:Prism.languages.sass&&Prism.languages.sass["variable-line" ]},{lang:"sass",before:"punctuation",inside:"inside",root:Prism.languages.sass&& Prism.languages.sass["property-line"]}],scss:!0,stylus:[{lang:"stylus",before:"f unc",inside:"rest",root:Prism.languages.stylus&&Prism.languages.stylus["property -declaration"].inside},{lang:"stylus",before:"func",inside:"rest",root:Prism.lan guages.stylus&&Prism.languages.stylus["variable-declaration"].inside}]};Prism.ho oks.add("before-highlight",function(i){if(i.language&&e[i.language]&&!e[i.langua ge].initialized){var t=e[i.language];"Array"!==Prism.util.type(t)&&(t=[t]),t.for Each(function(t){var r,s,a,n;t===!0?(r=Prism.plugins.Previewer&&Prism.plugins.Pr eviewer.byType.color?"color":"important",s=i.language,t=i.language):(r=t.before| |"important",s=t.inside||t.lang,a=t.root||Prism.languages,n=t.skip,t=i.language) ,!n&&Prism.languages[t]&&(Prism.languages.insertBefore(s,r,{gradient:{pattern:/( ?:\b|\B-[a-z]{1,10}-)(?:repeating-)?(?:linear|radial)-gradient\((?:(?:rgb|hsl)a? \(.+?\)|[^\)])+\)/gi,inside:{"function":/[\w-]+(?=\()/,punctuation:/[(),]/}}},a) ,i.grammar=Prism.languages[t],e[i.language]={initialized:!0})})}});var i={},t=fu nction(e,i,t){var r="180deg";return/^(?:-?\d*\.?\d+(?:deg|rad)|to\b|top|right|bo ttom|left)/.test(t[0])&&(r=t.shift(),r.indexOf("to ")<0&&(r.indexOf("top")>=0?r= r.indexOf("left")>=0?"to bottom right":r.indexOf("right")>=0?"to bottom left":"t o bottom":r.indexOf("bottom")>=0?r=r.indexOf("left")>=0?"to top right":r.indexOf ("right")>=0?"to top left":"to top":r.indexOf("left")>=0?r="to right":r.indexOf( "right")>=0?r="to left":e&&(r.indexOf("deg")>=0?r=90-parseFloat(r)+"deg":r.index Of("rad")>=0&&(r=Math.PI/2-parseFloat(r)+"rad")))),i+"("+r+","+t.join(",")+")"}, r=function(e,i,t){if(t[0].indexOf("at")<0){var r="center",s="ellipse",a="farthes t-corner";if(/\bcenter|top|right|bottom|left\b|^\d+/.test(t[0])&&(r=t.shift().re place(/\s*-?\d+(?:rad|deg)\s*/,"")),/\bcircle|ellipse|closest|farthest|contain|c over\b/.test(t[0])){var n=t.shift().split(/\s+/);!n[0]||"circle"!==n[0]&&"ellips e"!==n[0]||(s=n.shift()),n[0]&&(a=n.shift()),"cover"===a?a="farthest-corner":"co ntain"===a&&(a="clothest-side")}return i+"("+s+" "+a+" at "+r+","+t.join(",")+") "}return i+"("+t.join(",")+")"},s=function(e){if(i[e])return i[e];var s=e.match( /^(\b|\B-[a-z]{1,10}-)((?:repeating-)?(?:linear|radial)-gradient)/),a=s&&s[1],n= s&&s[2],l=e.replace(/^(?:\b|\B-[a-z]{1,10}-)(?:repeating-)?(?:linear|radial)-gra dient\(|\)$/g,"").split(/\s*,\s*/);return i[e]=n.indexOf("linear")>=0?t(a,n,l):n .indexOf("radial")>=0?r(a,n,l):n+"("+l.join(",")+")"};Prism.plugins.Previewer&&n ew Prism.plugins.Previewer("gradient",function(e){return this.firstChild.style.b ackgroundImage="",this.firstChild.style.backgroundImage=s(e),!!this.firstChild.s tyle.backgroundImage},"*",function(){this._elt.innerHTML="<div></div>"})}}();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698