PluginProbe ʕ •ᴥ•ʔ
SiteOrigin CSS / 1.2.4
SiteOrigin CSS v1.2.4
1.2.1 1.2.10 1.2.11 1.2.12 1.2.13 1.2.14 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.5.1 1.5.10 1.5.11 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 trunk 1.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.1 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.2.0
so-css / js / inspector.min.js
so-css / js Last commit date
URI.js 9 years ago URI.min.js 7 years ago css.js 7 years ago css.min.js 7 years ago csslint.js 9 years ago csslint.min.js 7 years ago editor.js 7 years ago editor.min.js 7 years ago inspector.js 7 years ago inspector.min.js 7 years ago jquery.sizes.js 11 years ago jquery.sizes.min.js 7 years ago specificity.js 11 years ago specificity.min.js 9 years ago
inspector.min.js
1 lines
1 !function(l,h,e){var d={model:{},collection:{},view:{},fn:{}},n=function(e,t){for(var s=[],i=SPECIFICITY.calculate(e),r=0;r<i.length;r++){var o=i[r];if(t)for(var c=0;c<o.parts.length;c++){var a=o.parts[c];s=s.concat(n(a.selector))}else s.push({selector:o.selector.trim(),specificity:parseInt(o.specificity.replace(/,/g,""))})}return s};d.view.inspector=Backbone.View.extend({active:!1,hl:!1,hoverEl:!1,pageSelectors:[],selectorTemplate:h.template('<div class="socss-selector"><%= selector %></div>'),initialize:function(){var t=this;this.hl=new d.view.highlighter,this.hl.initialize(),this.pageSelectors=d.fn.pageSelectors(),l("body").on("mouseover","*",function(e){if(!t.active)return!0;0===l(this).closest(".socss-element").length&&(e.stopPropagation(),t.setHoverEl(l(this)))}),l("body *").click(function(e){if(!t.active||t.$el.is(":hover"))return!0;e.preventDefault(),e.stopPropagation(),l(this).blur(),t.setActiveEl(t.hoverEl)}),this.$(".socss-enable-inspector").click(function(){t.toggleActive()}),this.$el.mouseenter(function(){t.hl.clear()});try{parent.socss.mainEditor.setInspector(this)}catch(e){console.log("No editor to register this inspector with")}},setHoverEl:function(e){this.hoverEl=e,this.hl.highlight(e)},activate:function(){this.active=!0,l("body").addClass("socss-active"),l("body").removeClass("socss-inactive")},deactivate:function(){this.active=!1,l("body").addClass("socss-inactive"),l("body").removeClass("socss-active"),this.hl.clear(),this.$(".socss-hierarchy").empty()},toggleActive:function(){this.active?this.deactivate():this.activate()},setActiveEl:function(t){var s=this,e=this.$(".socss-hierarchy");if(e.empty(),t){if("body"!==t.prop("tagName").toLowerCase()){for(var i=l(t);l(this.selectorTemplate({selector:d.fn.elSelector(i)})).prependTo(e).data("el",i),"body"!==(i=i.parent()).prop("tagName").toLowerCase(););l(this.selectorTemplate({selector:"body"})).prependTo(e).data("el",l("body")),this.$(".socss-hierarchy .socss-selector").hover(function(){s.hl.highlight(l(this).data("el"))}).click(function(e){e.preventDefault(),e.stopPropagation(),s.setActiveEl(l(this).data("el"))})}e.scrollLeft(99999);var r=this.pageSelectors.filter(function(e){try{return t.is(e.selector)}catch(e){return!1}}),o=this.$(".socss-selectors-window").empty();h.each(r,function(e){o.append(l(s.selectorTemplate(e)).data(e))}),o.find("> div").mouseenter(function(){s.hl.highlight(l(this).data("selector"))}).click(function(e){e.preventDefault(),e.stopPropagation(),s.trigger("click_selector",l(this).data("selector"))});var c=d.fn.elementAttributes(t);o=this.$(".socss-properties-window").empty(),h.each(c,function(e,t){o.append(l(s.selectorTemplate({selector:"<strong>"+t+"</strong>: "+e})).data("property",t+": "+e))}),o.find("> div").click(function(e){e.preventDefault(),e.stopPropagation(),s.trigger("click_property",l(this).data("property"))});var a=t.closest("a[href]"),n=this.$(".socss-link");a.length?n.show().find("a").html(a.attr("href").replace(/[\?&]*so_css_preview=1/,"")).attr("href",a.attr("href")):n.hide(),this.trigger("set_active_element",t,r)}}}),d.view.highlighter=Backbone.View.extend({template:h.template(l("#socss-template-hover").html().trim()),highlighted:[],highlight:function(e){this.clear();var a=this;l(e).each(function(e,t){if(!(t=l(t)).is(":visible"))return!0;var s,i=l(a.template());i.css({top:t.offset().top,left:t.offset().left,width:t.outerWidth(),height:t.outerHeight()}).appendTo("body");var r=t.padding();for(var o in r)0<parseInt(r[o])&&(s=i.find(".socss-guide-padding.socss-guide-"+o).show(),"top"===o||"bottom"===o?s.css("height",r[o]):(s.css("width",r[o]),s.css({width:r[o],top:r.top,bottom:r.bottom})));var c=t.margin();for(var o in c)0<parseInt(c[o])&&(s=i.find(".socss-guide-margin.socss-guide-"+o).show(),"top"===o||"bottom"===o?s.css("height",c[o]):s.css("width",c[o]));a.highlighted.push(i)})},clear:function(){for(;this.highlighted.length;)this.highlighted.pop().remove()}}),d.parsedCss={},d.fn.getParsedCss=function(){if(0===Object.keys(d.parsedCss).length){var s=window.css;l(".socss-theme-styles").each(function(){var e=l(this),t=s.parse(e.html(),{silent:!0});d.parsedCss[e.attr("id")]=t})}return d.parsedCss},d.fn.pageSelectors=function(){var s=[],e=d.fn.getParsedCss();for(var t in e)for(var i=e[t].stylesheet.rules,r=0;r<i.length;r++)if(void 0!==i[r].selectors)for(var o=0;o<i[r].selectors.length;o++)s=s.concat(n(i[r].selectors[o]));l("body *").each(function(){var e=l(this),t=d.fn.elSelector(e);s=s.concat(n(t))});var c=l("body"),a=d.fn.elSelector(c);return s=s.concat(n(a,!0)),(s=h.uniq(s,!1,function(e){return e.selector})).sort(function(e,t){return e.specificity>t.specificity?-1:1}),s},d.fn.elementAttributes=function(e){if(!document.styleSheets)return[];var t=[],s=d.fn.getParsedCss(),i=function(e){switch(e){case"charset":case"custom-media":case"document":case"font-face":case"host":case"import":case"keyframes":case"keyframe":case"media":case"namespace":case"page":case"supports":return!0}return!1};for(var r in s)for(var o=s[r].stylesheet.rules,c=0;c<o.length;c++){var a=o[c];if(void 0!==a.selectors&&!i(a.type))for(var n=0;n<a.selectors.length;n++)for(var l=SPECIFICITY.calculate(a.selectors[n]),h=0;h<l.length;h++)try{if(e.is(l[h].selector)){var p=a.declarations;for(h=0;h<p.length;h++)t.push({name:p[h].property,value:p[h].value,specificity:parseInt(l[h].specificity.replace(/,/g,""))})}}catch(e){}}t.sort(function(e,t){return e.specificity>t.specificity?1:-1}).reverse();for(var f={},v=0;v<t.length;v++)void 0===f[t[v].name]&&(f[t[v].name]=t[v].value);return f},d.fn.elSelector=function(e){var t="";return void 0!==e.attr("id")&&(t+="#"+e.attr("id")),void 0!==e.attr("class")&&(t+="."+e.attr("class").replace(/\s+/g,".")),""===t&&(t=e.prop("tagName").toLowerCase()),t},window.socssInspector=d}(jQuery,_,socssOptions),jQuery(function(e){var t=new window.socssInspector.view.inspector({el:e("#socss-inspector-interface").get(0)});t.activate(),window.socssInspector.mainInspector=t});