From 454e36b4ae694a5ff48d0617f2ef0b1e62e0815c Mon Sep 17 00:00:00 2001 From: chris Date: Tue, 29 Oct 2013 11:09:20 +0800 Subject: [PATCH] iFrame ajaxStop --- app/assets/javascripts/lib/items/items.js.erb | 21 +++++++++++-------- .../javascripts/lib/items/page_part.js.erb | 4 ++-- app/views/layouts/page_layout.html.erb | 9 ++++---- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/app/assets/javascripts/lib/items/items.js.erb b/app/assets/javascripts/lib/items/items.js.erb index 91f54f25a..6e03b4ad4 100644 --- a/app/assets/javascripts/lib/items/items.js.erb +++ b/app/assets/javascripts/lib/items/items.js.erb @@ -116,20 +116,23 @@ function customOpenSlide() { }); } function iFrameContent() { - $('#pageslide_iframe').load(function() { - var $iContents = $(this).contents(), - $pc = $iContents.find('.page_content'); - $pc.each(function(index, el) { + function iFrameFunction(iContents, pc) { + pc.each(function(index, el) { if($(this).siblings('*').length == 0) { var _parentH = $(this).parent('*').outerHeight(); $(this).css('height', _parentH); } }); - $iContents.find('#orbit-bar').hide(); - $iContents.find('.main_wrap').css('margin-top', 0); - $iContents.find('a').not('.edit_link a').on('click', function(event) { + iContents.find('#orbit-bar').hide(); + iContents.find('.main_wrap').css('margin-top', 0); + iContents.find('a').not('.edit_link a').on('click', function(event) { event.preventDefault(); - }); + }).css('cursor', 'default'); + } + $('#pageslide_iframe').load(function() { + var $iContents = $(this).contents(), + $pc = $iContents.find('.page_content'); + $(this).get(0).contentWindow.externalFunction(iFrameFunction, $iContents, $pc); }); } function pageSetting(id, edit) { @@ -375,7 +378,6 @@ $(function() { if(_val) { $.each(_data, function(index, val) { if(_val == val.main[1]) { - getView(val.main[1]); $.each(val.sub, function(index, val) { var _selected = _select && $(this)[1] == _select.sub ? 'selected="selected"' : ''; $subSelete.append(''); @@ -383,6 +385,7 @@ $(function() { $.each(val.count, function(index, val) { $pageCount.append(''); }); + getView(val.main[1]); $pageDivCount.show(); if(event.target.id == 'page_module_app_id') { diff --git a/app/assets/javascripts/lib/items/page_part.js.erb b/app/assets/javascripts/lib/items/page_part.js.erb index 1460ddb29..2e2851787 100644 --- a/app/assets/javascripts/lib/items/page_part.js.erb +++ b/app/assets/javascripts/lib/items/page_part.js.erb @@ -46,14 +46,14 @@ $(function() { if(_val) { $.each(_data, function(index, val) { if(_val == val.main[1]) { - getView(val.main[1]); $.each(val.sub, function(index, val) { var _selected = _select && $(this)[1] == _select.sub ? 'selected="selected"' : ''; $subSelete.append(''); }); $.each(val.count, function(index, val) { $pageCount.append(''); - }); + }); + getView(val.main[1]); if(event.target.id == 'page_part_module_app') { $pageCategory.empty(); diff --git a/app/views/layouts/page_layout.html.erb b/app/views/layouts/page_layout.html.erb index 056c30b5a..83e575094 100644 --- a/app/views/layouts/page_layout.html.erb +++ b/app/views/layouts/page_layout.html.erb @@ -29,12 +29,11 @@ <% end -%> <% if @edit %>