Skip to content

Commit

Permalink
3.2.9.8.9 pre-release, option "Post Types" and Visual Composer compat…
Browse files Browse the repository at this point in the history
…ibility
  • Loading branch information
johnclause committed Apr 13, 2015
1 parent 5e56bfa commit 0cfc3d8
Show file tree
Hide file tree
Showing 11 changed files with 664 additions and 552 deletions.
40 changes: 39 additions & 1 deletion admin/js/common.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
/*
Copyright 2014 qTranslate Team (email : [email protected] )
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/*
// debugging tools, do not check in
var cc=0;
Expand Down Expand Up @@ -303,7 +320,8 @@ var qTranslateX=function(pg)
setLangCookie(qTranslateConfig.activeLanguage);
}

this.getActiveLanguage=function() { return qTranslateConfig.activeLanguage; }
this.getActiveLanguage = function() { return qTranslateConfig.activeLanguage; }
this.getActiveLanguageName = function() { return qTranslateConfig.language_name[qTranslateConfig.activeLanguage]; }

var contentHooks={};
var contentHookId = 0;
Expand Down Expand Up @@ -903,6 +921,26 @@ var qTranslateX=function(pg)
*/
this.addLanguageSwitchAfterListener=function(func){ qTranslateConfig.onTabSwitchFunctionsLoad.push(func); }

/**
* @since 3.2.9.8.9
* Designed as interface for other plugin integration. The documentation is available at
* https://qtranslatexteam.wordpress.com/integration/
*
*/
this.enableLanguageSwitchingButtons=function(on){
var display = on ? 'block' : 'none';
for(var lang in qTranslateConfig.tabSwitches){
var tabSwitches = qTranslateConfig.tabSwitches[lang];
for(var i=0; i < tabSwitches.length; ++i){
var tabSwitch = tabSwitches[i];
var tabSwitchParent = tabSwitches[i].parentElement;
tabSwitchParent.style.display = display;
break;
}
break;
}
}

this.getWrapForm=function(){
var wraps = document.getElementsByClassName('wrap');
for(var i=0; i < wraps.length; ++i){
Expand Down
2 changes: 1 addition & 1 deletion admin/js/common.min.js

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions admin/js/edit-post.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,28 @@ qTranslateConfig.js={
if( !qTranslateConfig.page_config.anchors)
qTranslateConfig.page_config.anchors = ['post','postexcerpt'];//,'slugdiv'

qtx.addLanguageSwitchAfterListener(this.setSlugLanguage);

//co('window.vc: ',window.vc);
if(window.vc && !qTranslateConfig.plugin_js_composer_off){//Visual Composer
qtx.addLanguageSwitchAfterListener(this.onTabSwitchVisualComposer);
}

return true;
}
/*
,
onTabSwitch: function(lang)
{
qTranslateConfig.js.setSlugLanguage(lang);
}
*/
,
onTabSwitchVisualComposer: function(lang)
{
if(!window.vc) return;
if(!vc.app) return;
if (vc.app.status != 'shown') return;
vc.app.show();
}
};
2 changes: 1 addition & 1 deletion admin/js/edit-post.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 0cfc3d8

Please sign in to comment.