Sha256: f250fab4e5507c80f2a0cdcca26040e6693ac01db8b171f434781f623a6ed494

Contents?: true

Size: 1.44 KB

Versions: 19

Compression:

Stored size: 1.44 KB

Contents

/// Author Courtenay Probert
/// Version 1.1

$(function() {
	function editMe(cms) {
		var view = $(cms).attr("data-view");
        if(!view)
            alert("View missing");
            
		var page = $(cms).attr("data-page");
        if(!page)
            alert("Page missing");
            
        try{
            if(window.parentSandboxBridge != undefined)
                window.parentSandboxBridge.editView(view, page);
            else
                alert("No Parent Sandbox Bridge");
        } catch (e) {
            alert(e);
        }
	}

	$("a[href^='http']")
		.attr('target','_blank')
		.click(function(e){
			e.preventDefault();
			href = $(this).attr("href")
			alert("Loading: "+ href);
			window.parentSandboxBridge.openExternalURL(href);
	});	

	$(".cms").each(function(i) {
		var $this = $(this);
		$this.addClass("cmsEdit");
		var bgColor = $(this).css("background-color");

		$this
		  .bind("dblclick", function() {
			editMe(this);
		  })
		  .attr("title", "Double click to edit")
		  .mouseover(function() {
			var htmlStr = $(this).html();
			if ($.trim(htmlStr) == "")
			  $this.html("Double click to add text");
			
			$(this)
			  .css({
				backgroundColor: 'AliceBlue',
				cursor: 'pointer'
			  });
		  })
		  .mouseout(function() {
			if ($this.html() == "Double click to add text")
			  $this.html("");
			
			$this.css({
			  backgroundColor: bgColor
			});
		 });
	});
});

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
scms-2.1.0 assets/air-monkey-hook.js
scms-2.0.9 assets/air-monkey-hook.js
scms-2.0.8 assets/air-monkey-hook.js
scms-2.0.7 assets/air-monkey-hook.js
scms-2.0.6 assets/air-monkey-hook.js
scms-2.0.5 assets/air-monkey-hook.js
scms-2.0.3 assets/air-monkey-hook.js
scms-2.0.2 assets/air-monkey-hook.js
scms-2.0.1 assets/air-monkey-hook.js
scms-2.0.0 assets/air-monkey-hook.js
scms-1.9.6 assets/blank-template/scripts/air-monkey-hook.js
scms-1.9.5 assets/blank-template/scripts/air-monkey-hook.js
scms-1.9.4 assets/blank-template/scripts/air-monkey-hook.js
scms-1.9.3 assets/blank-template/scripts/air-monkey-hook.js
scms-1.9.2 assets/blank-template/scripts/air-monkey-hook.js
scms-1.9.0 assets/blank-template/scripts/air-monkey-hook.js
scms-1.8.8 assets/blank-template/public/scripts/air-monkey-hook.js
scms-1.8.7 assets/blank-template/public/scripts/air-monkey-hook.js
scms-1.8.6 assets/blank-template/public/scripts/air-monkey-hook.js